fix: 仪表盘概览标题颜色过浅改用CSS变量;模块状态列表从3个扩展至6个与定时任务数匹配

This commit is contained in:
Yuzhiran Dev
2026-05-17 17:01:14 +08:00
parent f2d778b5ce
commit eb472d232e
2 changed files with 17 additions and 27 deletions
+12 -19
View File
@@ -185,25 +185,17 @@ def get_scheduler_status():
@router.get("/modules/status", dependencies=[Depends(get_current_user)]) @router.get("/modules/status", dependencies=[Depends(get_current_user)])
def get_modules_status(): def get_modules_status():
today_str = date.today().isoformat() today_str = date.today().isoformat()
module_logs = { log_based: dict = {
"creator": { "scheduled_collect": {"name": "📡 内容采集", "log": LOGS_DIR / f"collector_{today_str}.log"},
"key": "🤖 内容创作引擎", "scheduled_sync": {"name": "🔄 指标同步", "log": LOGS_DIR / f"sync_{today_str}.log"},
"log": LOGS_DIR / f"creator_{today_str}.log", "scheduled_generate": {"name": "🤖 内容创作", "log": LOGS_DIR / f"creator_{today_str}.log"},
"config_file": PROJECT_ROOT / "automation" / "data" / "outlines" / today_str, "scheduled_optimize": {"name": "🔍 内容优化", "log": LOGS_DIR / f"optimizer_{today_str}.log"},
}, "scheduled_optimize_sources": {"name": "📡 信息源优化", "log": LOGS_DIR / f"optimizer_sources_{today_str}.log"},
"optimizer": { "scheduled_metrics_sync": {"name": "📊 指标同步", "log": LOGS_DIR / f"metrics_sync_{today_str}.log"},
"key": "🔍 内容优化器",
"log": LOGS_DIR / f"optimizer_{today_str}.log",
"config_file": PROJECT_ROOT / "automation" / "data" / "drafts" / today_str,
},
"collector": {
"key": "📡 内容收集器",
"log": LOGS_DIR / f"collector_{today_str}.log",
"config_file": PROJECT_ROOT / "automation" / "data",
},
} }
jobs = {j.id: j for j in scheduler.get_jobs()}
modules = [] modules = []
for mod_id, cfg in module_logs.items(): for mod_id, cfg in log_based.items():
log_file = cfg["log"] log_file = cfg["log"]
last_run = None last_run = None
task_count = 0 task_count = 0
@@ -215,10 +207,11 @@ def get_modules_status():
task_count = content.count("完成") + content.count("success") + content.count("SUCCESS") task_count = content.count("完成") + content.count("success") + content.count("SUCCESS")
total = task_count + content.count("失败") + content.count("failed") + content.count("ERROR") total = task_count + content.count("失败") + content.count("failed") + content.count("ERROR")
success_rate = round(task_count / total * 100) if total > 0 else None success_rate = round(task_count / total * 100) if total > 0 else None
status = "running" if log_file.exists() else ("idle" if mod_id in jobs else "stopped")
modules.append({ modules.append({
"id": mod_id, "id": mod_id,
"title": cfg["key"], "title": cfg["name"],
"status": "running" if log_file.exists() else "stopped", "status": status,
"last_run": last_run or "从未运行", "last_run": last_run or "从未运行",
"task_count": task_count, "task_count": task_count,
"success_rate": success_rate, "success_rate": success_rate,
+5 -8
View File
@@ -37,7 +37,7 @@
<main class="content-area"> <main class="content-area">
<!-- 系统概览页面 --> <!-- 系统概览页面 -->
<div id="page-overview" class="page" :class="{ active: currentPage === 'overview' }"> <div id="page-overview" class="page" :class="{ active: currentPage === 'overview' }">
<h2 style="font-size: 28px; font-weight: 700; margin-bottom: 32px; color: #e0e6ed;"> <h2 style="font-size: var(--font-size-h1); font-weight: 700; margin-bottom: var(--spacing-xl); color: var(--color-text-primary);">
<el-icon style="vertical-align:-2px;"><IconDashboard /></el-icon> 系统概览 <el-icon style="vertical-align:-2px;"><IconDashboard /></el-icon> 系统概览
</h2> </h2>
@@ -80,13 +80,13 @@
</div> </div>
<!-- 模块状态 --> <!-- 模块状态 -->
<h3 style="font-size: 20px; font-weight: 600; margin-bottom: 24px; color: #e0e6ed;"> <h3 style="font-size: var(--font-size-h2); font-weight: 600; margin-bottom: var(--spacing-lg); color: var(--color-text-primary);">
<el-icon style="vertical-align:-2px;"><IconSetting /></el-icon> 模块状态 <el-icon style="vertical-align:-2px;"><IconSetting /></el-icon> 模块状态
<span style="font-size: 13px; font-weight: 400; color: #909399; margin-left: 12px;"> <span style="font-size: var(--font-size-small); font-weight: 400; color: var(--color-text-secondary); margin-left: var(--spacing-sm);">
定时任务: 定时任务:
<el-icon v-if="schedulerRunning" style="color:#67C23A;vertical-align:-2px;"><IconCheck /></el-icon> <el-icon v-if="schedulerRunning" style="color:#67C23A;vertical-align:-2px;"><IconCheck /></el-icon>
<el-icon v-else style="color:#F56C6C;vertical-align:-2px;"><IconClose /></el-icon> <el-icon v-else style="color:#F56C6C;vertical-align:-2px;"><IconClose /></el-icon>
{{ schedulerStatus }} {{ schedulerRunning ? '运行中' : '未启动' }}
</span> </span>
</h3> </h3>
<div class="module-grid"> <div class="module-grid">
@@ -214,10 +214,7 @@
this.modules = data.modules || []; this.modules = data.modules || [];
const s = data.scheduler || {}; const s = data.scheduler || {};
this.schedulerRunning = s.running; this.schedulerRunning = s.running;
this.schedulerStatus = (s.running ? '运行中' : '未启动'); this.schedulerStatus = (s.running ? `运行中 · ${s.jobs ? s.jobs.length : 0} 个任务` : '未启动');
if (s.jobs && s.jobs.length) {
this.schedulerStatus += ' · ' + s.jobs.length + ' 个任务';
}
} }
} catch (e) { } catch (e) {
console.error('获取模块状态失败:', e); console.error('获取模块状态失败:', e);