功能: 添加管理员上传工具检测和上传功能

- 后端: 添加 GET /api/admin/check-upload-tool 检测工具是否存在
- 后端: 添加 POST /api/admin/upload-tool 允许管理员手动上传exe
- 前端: 管理员界面新增上传工具管理卡片
- 前端: 支持检测工具状态、显示文件信息、手动上传
- 验证: 文件必须是.exe格式且大小>20MB
This commit is contained in:
WanWanYun
2025-11-12 20:44:41 +08:00
parent 0fc378576f
commit e5ba17329c
3 changed files with 268 additions and 2 deletions

View File

@@ -1381,6 +1381,73 @@
</tbody>
</table>
</div>
<!-- 上传工具管理区域 -->
<div class="card" style="margin-top: 30px;">
<h3 style="margin-bottom: 20px;">
<i class="fas fa-cloud-upload-alt"></i> 上传工具管理
</h3>
<!-- 工具状态显示 -->
<div v-if="uploadToolStatus !== null">
<div v-if="uploadToolStatus.exists" style="padding: 15px; background: #d4edda; border-left: 4px solid #28a745; border-radius: 6px; margin-bottom: 20px;">
<div style="display: flex; align-items: center; justify-content: space-between;">
<div>
<div style="color: #155724; font-weight: 600; margin-bottom: 5px;">
<i class="fas fa-check-circle"></i> 上传工具已存在
</div>
<div style="color: #155724; font-size: 13px;">
文件大小: {{ uploadToolStatus.fileInfo.sizeMB }} MB
</div>
<div style="color: #155724; font-size: 12px; margin-top: 3px;">
最后修改: {{ formatDate(uploadToolStatus.fileInfo.modifiedAt) }}
</div>
</div>
<button class="btn btn-primary" @click="checkUploadTool" style="background: #28a745;">
<i class="fas fa-sync-alt"></i> 重新检测
</button>
</div>
</div>
<div v-else style="padding: 15px; background: #fff3cd; border-left: 4px solid #ffc107; border-radius: 6px; margin-bottom: 20px;">
<div style="color: #856404; font-weight: 600; margin-bottom: 5px;">
<i class="fas fa-exclamation-triangle"></i> 上传工具不存在
</div>
<div style="color: #856404; font-size: 13px;">
普通用户将无法下载上传工具,请上传工具文件
</div>
</div>
</div>
<!-- 操作按钮组 -->
<div style="display: flex; gap: 10px; margin-top: 15px; flex-wrap: wrap;">
<button class="btn btn-primary" @click="checkUploadTool" :disabled="checkingUploadTool" style="background: #17a2b8;">
<i class="fas fa-search" v-if="!checkingUploadTool"></i>
<i class="fas fa-spinner fa-spin" v-else></i>
{{ checkingUploadTool ? '检测中...' : '检测上传工具' }}
</button>
<button v-if="uploadToolStatus && !uploadToolStatus.exists" class="btn btn-primary" @click="$refs.uploadToolInput.click()" :disabled="uploadingTool" style="background: #28a745;">
<i class="fas fa-upload" v-if="!uploadingTool"></i>
<i class="fas fa-spinner fa-spin" v-else></i>
{{ uploadingTool ? '上传中...' : '上传工具文件' }}
</button>
<input ref="uploadToolInput" type="file" accept=".exe" style="display: none;" @change="handleUploadToolFile">
</div>
<!-- 使用说明 -->
<div style="margin-top: 20px; padding: 12px; background: #e7f3ff; border-left: 4px solid #2196F3; border-radius: 6px;">
<div style="color: #0c5460; font-size: 13px; line-height: 1.6;">
<strong><i class="fas fa-info-circle"></i> 说明:</strong>
<ul style="margin: 8px 0 0 20px; padding-left: 0;">
<li>上传工具文件应为 .exe 格式,大小通常在 20-50 MB</li>
<li>上传后,普通用户可以在设置页面下载该工具</li>
<li>如果安装脚本下载失败,可以在这里手动上传</li>
</ul>
</div>
</div>
</div>
</div>
<!-- 忘记密码模态框 -->