feat(developer): 添加转载警告并改进标签选择方式

在应用上传页面添加非原创应用的转载警告提示
将编辑页面的标签选择从复选框改为多选下拉框,提升用户体验
This commit is contained in:
2025-07-11 18:55:04 +08:00
parent f5687bc4fe
commit 99eb4d1800
2 changed files with 13 additions and 10 deletions

View File

@@ -82,6 +82,9 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$platforms_json = json_encode($platforms); $platforms_json = json_encode($platforms);
$appFilePath = $app['file_path']; // 默认使用现有文件路径 $appFilePath = $app['file_path']; // 默认使用现有文件路径
// 获取选中的标签
$selectedTags = $_POST['tags'] ?? [];
// 处理应用文件上传 // 处理应用文件上传
if (!empty($_FILES['app_file']['tmp_name'])) { if (!empty($_FILES['app_file']['tmp_name'])) {
$uploadDir = '../uploads/apps/'; $uploadDir = '../uploads/apps/';
@@ -196,7 +199,6 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
} }
// 验证标签选择 // 验证标签选择
$selectedTags = $_POST['tags'] ?? [];
if (empty($selectedTags)) { if (empty($selectedTags)) {
$error = '至少需要选择一个应用标签'; $error = '至少需要选择一个应用标签';
} }
@@ -294,17 +296,15 @@ if (!($conn instanceof mysqli)) {
</div> </div>
</div> </div>
<div class="mb-3"> <div class="mb-3">
<label class="form-label">应用标签 (至少选择1个)</label> <label for="tags" class="form-label">应用标签 (至少选择1个)</label>
<div class="row"> <select id="tags" name="tags[]" multiple class="form-control">
<?php foreach ($tags as $tag): ?> <?php foreach ($tags as $tag): ?>
<div class="col-6 col-md-4 col-lg-3"> <option value="<?php echo $tag['id']; ?>" <?php echo in_array($tag['id'], $appTags) ? 'selected' : ''; ?>>
<div class="form-check"> <?php echo htmlspecialchars($tag['name']); ?>
<input class="form-check-input" type="checkbox" id="tag_<?php echo $tag['id']; ?>" name="tags[]" value="<?php echo $tag['id']; ?>" <?php echo in_array($tag['id'], $appTags) ? 'checked' : ''; ?>> </option>
<label class="form-check-label" for="tag_<?php echo $tag['id']; ?>"><?php echo htmlspecialchars($tag['name']); ?></label>
</div>
</div>
<?php endforeach; ?> <?php endforeach; ?>
</div> </select>
<small class="form-text text-muted">按住Ctrl键可选择多个标签</small>
</div> </div>
<div class="mb-3"> <div class="mb-3">
<label for="app_file" class="form-label">更新应用文件</label> <label for="app_file" class="form-label">更新应用文件</label>

View File

@@ -433,6 +433,9 @@ if (!($conn instanceof mysqli)) {
</div> </div>
<?php endif; ?> <?php endif; ?>
<form method="post" enctype="multipart/form-data"> <form method="post" enctype="multipart/form-data">
<div class="alert alert-warning mb-3">
<strong>警告:</strong>如果该应用非您本人开发,请务必添加"转载"标签。
</div>
<div class="form-group mb-3"> <div class="form-group mb-3">
<label for="name" class="form-label">应用名称</label> <label for="name" class="form-label">应用名称</label>
<input type="text" id="name" name="name" class="form-control" required> <input type="text" id="name" name="name" class="form-control" required>