style: 统一表单输入框使用 form-floating 样式

重构多个表单页面的输入框样式,将普通输入框和标签组合改为使用 Bootstrap 的 form-floating 样式,提升表单的视觉一致性和用户体验
This commit is contained in:
2025-07-07 22:08:17 +08:00
parent a631bdc5b5
commit e5bcd5e039
8 changed files with 65 additions and 62 deletions

View File

@@ -153,9 +153,9 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['add_app'])) {
<h2>添加App</h2>
<form method="post" enctype="multipart/form-data">
<div class="mb-3">
<label for="name" class="form-label">App名称</label>
<div class="form-floating mb-3">
<input type="text" class="form-control" id="name" name="name" required>
<label for="name">App名称</label>
</div>
<div class="mb-3">
<label for="tags" class="form-label">标签</label>
@@ -169,9 +169,9 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['add_app'])) {
</select>
<small class="form-text text-muted">按住Ctrl键可选择多个标签</small>
</div>
<div class="mb-3">
<label for="description" class="form-label">描述</label>
<div class="form-floating mb-3">
<textarea class="form-control" id="description" name="description" rows="3" required></textarea>
<label for="description">描述</label>
</div>
<div class="mb-3">
<label for="age_rating" class="form-label">年龄分级</label>
@@ -182,9 +182,9 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['add_app'])) {
<option value="17+">17+</option>
</select>
</div>
<div class="mb-3" id="ageRatingDescriptionGroup" style="display: none;">
<label for="age_rating_description" class="form-label">年龄分级说明</label>
<div class="form-floating mb-3" id="ageRatingDescriptionGroup" style="display: none;">
<textarea class="form-control" id="age_rating_description" name="age_rating_description" rows="3" placeholder="请说明为何需要此年龄分级"></textarea>
<label for="age_rating_description">年龄分级说明</label>
<div class="form-text">当年龄分级为12+或以上时,此项为必填</div>
</div>
@@ -235,21 +235,21 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['add_app'])) {
</div>
</div>
</div>
<div class="mb-3">
<label for="version" class="form-label">版本号</label>
<div class="form-floating mb-3">
<input type="text" class="form-control" id="version" name="version" required>
<label for="version">版本号</label>
</div>
<div class="mb-3">
<label for="changelog" class="form-label">更新日志</label>
<div class="form-floating mb-3">
<textarea class="form-control" id="changelog" name="changelog" rows="3" required></textarea>
<label for="changelog">更新日志</label>
</div>
<div class="mb-3">
<label for="app_file" class="form-label">App文件</label>
<div class="form-floating mb-3">
<input class="form-control" type="file" id="app_file" name="app_file" required>
<label for="app_file">App文件</label>
</div>
<div class="mb-3">
<label for="images" class="form-label">预览图片 (可多选)</label>
<div class="form-floating mb-3">
<input class="form-control" type="file" id="images" name="images[]" multiple>
<label for="images">预览图片 (可多选)</label>
</div>
<button type="submit" class="btn btn-primary" name="add_app">添加App</button>
<a href="index.php" class="btn btn-secondary ms-2">取消</a>

View File

@@ -162,9 +162,9 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['edit_app'])) {
<h2>编辑App: <?php echo htmlspecialchars($app['name']); ?></h2>
<form method="post" enctype="multipart/form-data">
<div class="mb-3">
<label for="name" class="form-label">App名称</label>
<div class="form-floating mb-3">
<input type="text" class="form-control" id="name" name="name" value="<?php echo htmlspecialchars($app['name']); ?>" required>
<label for="name">App名称</label>
</div>
<div class="mb-3">
<label for="tags" class="form-label">标签</label>
@@ -188,9 +188,9 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['edit_app'])) {
</select>
<div class="form-text">按住Ctrl键可选择多个标签</div>
</div>
<div class="mb-3">
<label for="description" class="form-label">描述</label>
<div class="form-floating mb-3">
<textarea class="form-control" id="description" name="description" rows="3" required><?php echo htmlspecialchars($app['description']); ?></textarea>
<label for="description">描述</label>
</div>
<div class="mb-3">
<label for="age_rating" class="form-label">年龄分级</label>
@@ -275,14 +275,14 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['edit_app'])) {
</div>
</div>
</div>
<div class="mb-3">
<label for="version" class="form-label">新版本号</label>
<div class="form-floating mb-3">
<input type="text" class="form-control" id="version" name="version" placeholder="如: 1.0.1">
<label for="version">新版本号</label>
<div class="form-text">仅在上传新安装包时填写</div>
</div>
<div class="mb-3">
<label for="changelog" class="form-label">更新日志</label>
<div class="form-floating mb-3">
<textarea class="form-control" id="changelog" name="changelog" rows="3" placeholder="描述本次更新内容"></textarea>
<label for="changelog">更新日志</label>
</div>
<div class="mb-3">
<label for="app_file" class="form-label">新App文件 (可选)</label>

View File

@@ -227,14 +227,14 @@ if (!$stmt) {
<div class="card-body">
<form method="post" action="manage_developers.php">
<input type="hidden" name="user_id" value="<?php echo $editUser['id']; ?>">
<div class="mb-3">
<label for="username" class="form-label">用户名</label>
<input type="text" id="username" name="username" value="<?php echo htmlspecialchars($editUser['username']); ?>" class="form-control" required>
</div>
<div class="mb-3">
<label for="email" class="form-label">邮箱</label>
<input type="email" id="email" name="email" value="<?php echo htmlspecialchars($editUser['email']); ?>" class="form-control" required>
</div>
<div class="form-floating mb-3">
<input type="text" class="form-control" id="username" name="username" value="<?php echo htmlspecialchars($editUser['username']); ?>" required>
<label for="username">用户名</label>
</div>
<div class="form-floating mb-3">
<input type="email" class="form-control" id="email" name="email" value="<?php echo htmlspecialchars($editUser['email']); ?>" required>
<label for="email">邮箱</label>
</div>
<button type="submit" name="update_user" class="btn btn-primary me-2">更新用户</button>
<a href="manage_developers.php" class="btn btn-secondary">取消</a>
</form>

View File

@@ -80,9 +80,9 @@ $tagsResult = $conn->query("SELECT * FROM tags ORDER BY created_at DESC");
</div>
<div class="card-body">
<form method="post">
<div class="mb-3">
<label for="tag_name" class="form-label">标签名称</label>
<div class="form-floating mb-3">
<input type="text" class="form-control" id="tag_name" name="tag_name" required>
<label for="tag_name">标签名称</label>
</div>
<button type="submit" name="add_tag" class="btn btn-primary">添加标签</button>
</form>
@@ -130,9 +130,9 @@ $tagsResult = $conn->query("SELECT * FROM tags ORDER BY created_at DESC");
<div class="modal-body">
<form method="post">
<input type="hidden" name="tag_id" value="<?php echo $tag['id']; ?>">
<div class="mb-3">
<label for="edit_tag_name<?php echo $tag['id']; ?>" class="form-label">标签名称</label>
<div class="form-floating mb-3">
<input type="text" class="form-control" id="edit_tag_name<?php echo $tag['id']; ?>" name="tag_name" value="<?php echo htmlspecialchars($tag['name']); ?>" required>
<label for="edit_tag_name<?php echo $tag['id']; ?>">标签名称</label>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">取消</button>

View File

@@ -285,14 +285,14 @@ if (isset($_GET['success'])) {
<form method="post" enctype="multipart/form-data">
<div class="modal-body">
<input type="hidden" name="version_id" value="<?php echo $version['id']; ?>">
<div class="mb-3">
<label for="version_<?php echo $version['id']; ?>" class="form-label">版本号</label>
<input type="text" class="form-control" id="version_<?php echo $version['id']; ?>" name="version" value="<?php echo htmlspecialchars($version['version']); ?>" required>
</div>
<div class="mb-3">
<label for="changelog_<?php echo $version['id']; ?>" class="form-label">更新日志</label>
<textarea class="form-control" id="changelog_<?php echo $version['id']; ?>" name="changelog" rows="3" required><?php echo htmlspecialchars($version['changelog']); ?></textarea>
</div>
<div class="form-floating mb-3">
<input type="text" class="form-control" id="version_<?php echo $version['id']; ?>" name="version" value="<?php echo htmlspecialchars($version['version']); ?>" required>
<label for="version_<?php echo $version['id']; ?>">版本号</label>
</div>
<div class="form-floating mb-3">
<textarea class="form-control" id="changelog_<?php echo $version['id']; ?>" name="changelog" rows="3" required><?php echo htmlspecialchars($version['changelog']); ?></textarea>
<label for="changelog_<?php echo $version['id']; ?>">更新日志</label>
</div>
<div class="mb-3">
<label for="new_app_file_<?php echo $version['id']; ?>" class="form-label">更新App文件 (可选)</label>
<input class="form-control" type="file" id="new_app_file_<?php echo $version['id']; ?>" name="new_app_file">
@@ -322,14 +322,14 @@ if (isset($_GET['success'])) {
</div>
<form method="post" enctype="multipart/form-data">
<div class="modal-body">
<div class="mb-3">
<label for="version" class="form-label">版本号</label>
<input type="text" class="form-control" id="version" name="version" placeholder="如: 1.0.0" required>
</div>
<div class="mb-3">
<label for="changelog" class="form-label">更新日志</label>
<textarea class="form-control" id="changelog" name="changelog" rows="3" placeholder="描述本次更新内容" required></textarea>
</div>
<div class="form-floating mb-3">
<input type="text" class="form-control" id="version" name="version" placeholder="如: 1.0.0" required>
<label for="version">版本号</label>
</div>
<div class="form-floating mb-3">
<textarea class="form-control" id="changelog" name="changelog" rows="3" placeholder="描述本次更新内容" required></textarea>
<label for="changelog">更新日志</label>
</div>
<div class="mb-3">
<label for="app_file" class="form-label">App文件</label>
<input class="form-control" type="file" id="app_file" name="app_file" required>

View File

@@ -183,9 +183,9 @@ if (!($conn instanceof mysqli)) {
<form method="post">
<div class="modal-body">
<input type="hidden" name="app_id" value="<?php echo $app['id']; ?>">
<div class="mb-3">
<label for="rejection_reason<?php echo $app['id']; ?>" class="form-label">拒绝原因</label>
<div class="form-floating mb-3">
<textarea class="form-control" id="rejection_reason<?php echo $app['id']; ?>" name="rejection_reason" rows="3" required></textarea>
<label for="rejection_reason<?php echo $app['id']; ?>">拒绝原因</label>
<div class="form-text">请详细说明拒绝原因,帮助开发者改进应用</div>
</div>
</div>

View File

@@ -105,17 +105,17 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
<div class="alert alert-danger" role="alert"><?php echo $error; ?></div>
<?php endif; ?>
<form method="post">
<div class="mb-3">
<label for="username" class="form-label">用户名</label>
<input type="text" id="username" name="username" class="form-control" required>
<div class="form-floating mb-3">
<input type="text" class="form-control" id="username" name="username" required>
<label for="username">用户名</label>
</div>
<div class="form-group">
<label for="email" class="form-label">邮箱</label>
<input type="email" id="email" name="email" class="form-control" required>
<div class="form-floating mb-3">
<input type="email" class="form-control" id="email" name="email" required>
<label for="email">邮箱</label>
</div>
<div class="mb-3">
<label for="password" class="form-label">密码</label>
<input type="password" id="password" name="password" class="form-control" required>
<div class="form-floating mb-3">
<input type="password" class="form-control" id="password" name="password" required>
<label for="password">密码</label>
</div>
<div class="mb-3 form-check">
<input type="checkbox" class="form-check-input" id="agree" name="agree" required>

View File

@@ -123,7 +123,10 @@ $tagResult = $conn->query("SELECT id, name FROM tags ORDER BY name");
<form method="get" action="tags.php" class="mb-4">
<div class="row g-3">
<div class="col-md-6">
<input type="text" name="search" class="form-control" placeholder="搜索应用..." value="<?php echo isset($_GET['search']) ? htmlspecialchars($_GET['search']) : ''; ?>">
<div class="form-floating">
<input type="text" name="search" class="form-control" id="searchInput" placeholder="搜索应用..." value="<?php echo isset($_GET['search']) ? htmlspecialchars($_GET['search']) : ''; ?>">
<label for="searchInput">搜索应用...</label>
</div>
</div>
<div class="col-md-2">
<button class="btn btn-primary w-100" type="submit">搜索</button>