UI优化完善初版

This commit is contained in:
lt
2026-05-01 06:48:21 +08:00
parent e1ba31afda
commit cfb60d7aae
12228 changed files with 1358947 additions and 2593 deletions
+22 -7
View File
@@ -89,17 +89,32 @@
data() { return { isLoggedIn: false, isAdmin: false, currentUser: { username: '' }, logType: 'creator', logDate: '', logContent: '', loadingLogs: false } },
methods: {
async fetchLogs() {
// 验证输入
if (!this.logType || !this.logDate) {
this.$message.warning('请选择日志类型和日期');
return;
}
this.loadingLogs = true;
try {
const logs = {
creator: "2026-04-27 11:45:23 | 成功生成选题 B02 - AI 在内容创作中的应用\n2026-04-27 11:30:15 | 开始生成选题 C03 - 数字化转型案例研究\n2026-04-27 10:30:12 | 创建新选题 A01 - 可持续发展趋势分析",
optimizer: "2026-04-27 12:05:30 | 优化完成选题 C03 - 合规分提升至 78\n2026-04-27 11:50:45 | 优化中选题 B02 - 等待人工审核",
collector: "2026-04-27 10:30:12 | 收集到 3 个新选题\n2026-04-27 09:45:20 | 更新行业热点数据\n2026-04-27 09:00:00 | 启动每日收集任务"
}[this.logType] || '暂无日志数据';
this.logContent = "日志类型:" + this.logType + "\n日期:" + (this.logDate || '今天') + "\n\n" + logs;
const token = localStorage.getItem('authToken');
const response = await fetch(`/api/logs?type=${encodeURIComponent(this.logType)}&date=${encodeURIComponent(this.logDate)}`, {
headers: { 'Authorization': 'Bearer ' + token }
});
if (!response.ok) {
const errorData = await response.json().catch(() => ({}));
throw new Error(errorData.detail || `请求失败: ${response.status}`);
}
const data = await response.json();
// 后端返回: { type, date, content }
this.logContent = `日志类型:${data.type}\n日期:${data.date}\n\n${data.content || '(日志文件为空)'}`;
this.$message.success('日志加载成功');
} catch (error) {
this.$message.error('获取日志失败');
console.error('获取日志失败:', error);
this.$message.error(`获取日志失败: ${error.message}`);
this.logContent = '';
} finally {
this.loadingLogs = false;
}