fix: restore frontend to dynamic version (undo incorrect sync from outdated backend/static)

This commit is contained in:
lt
2026-05-01 07:51:16 +08:00
parent 94295e1f74
commit e1613d2af9
3 changed files with 172 additions and 75 deletions
+57 -46
View File
@@ -9,7 +9,7 @@
/* 深色渐变背景主题 */
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; background: #f5f7fa; color: #303133; }
/* 深色渐变: #1a1a2e → #16213e → #0f3460 */
background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
min-height: 100vh;
@@ -321,6 +321,22 @@
.module-grid { grid-template-columns: 1fr; }
}
</style>
<style>
body { background: #f5f7fa !important; color: #303133 !important; }
.navbar { background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%) !important; border-bottom: none !important; backdrop-filter: none !important; }
.navbar-title { background: none !important; -webkit-text-fill-color: white !important; color: white !important; }
.user-info { color: white !important; }
.avatar { background: rgba(255,255,255,0.2) !important; color: white !important; }
.sidebar { background: white !important; border-right: 1px solid #ebeef5 !important; backdrop-filter: none !important; }
.sidebar-btn { color: #606266 !important; }
.sidebar-btn:hover, .sidebar-btn.active { background: #ecf5ff !important; color: #409eff !important; }
.mobile-nav { background: white !important; border-top: 1px solid #ebeef5 !important; backdrop-filter: none !important; box-shadow: 0 -2px 8px rgba(0,0,0,0.1) !important; }
.mobile-nav-btn { color: #606266 !important; }
.mobile-nav-btn.active { color: #409eff !important; }
.mobile-nav-btn.active::before { content: none !important; display: none !important; }
#page-overview h2, #page-overview h3, #page-overview .module-title { color: #303133 !important; }
#page-overview .module-content { color: #303133 !important; }
</style>
</head>
<body>
<div id="app">
@@ -394,17 +410,48 @@
🔧 模块状态
</h3>
<div class="module-grid">
<div class="module-card" v-for="mod in moduleList" :key="mod.key">
<div class="module-card">
<div class="module-header">
<span class="module-title">{{ mod.title }}</span>
<span class="module-status" :class="{ running: pipelineModules[mod.key].exists }">
{{ pipelineModules[mod.key].exists ? '运行中' : '未运行' }}
</span>
<span class="module-title">🤖 内容创作引擎</span>
<span class="module-status running">运行中</span>
</div>
<div class="module-content">
<div><span>最后运行</span><span>{{ formatDateTime(pipelineModules[mod.key].last_run) }}</span></div>
<div><span>状态</span><span>{{ pipelineModules[mod.key].exists ? '运行中' : '未运行' }}</span></div>
<div><span>模块</span><span>{{ mod.desc }}</span></div>
<div><span>最后运行</span><span>2026-04-27 14:30</span></div>
<div><span>今日任务</span><span>12 个</span></div>
<div><span>成功率</span><span>95%</span></div>
</div>
</div>
<div class="module-card">
<div class="module-header">
<span class="module-title">🔍 内容优化器</span>
<span class="module-status running">运行中</span>
</div>
<div class="module-content">
<div><span>最后运行</span><span>2026-04-27 14:45</span></div>
<div><span>今日优化</span><span>8 个</span></div>
<div><span>平均提升</span><span>+12 分</span></div>
</div>
</div>
<div class="module-card">
<div class="module-header">
<span class="module-title">📡 内容收集器</span>
<span class="module-status running">运行中</span>
</div>
<div class="module-content">
<div><span>最后运行</span><span>2026-04-27 14:00</span></div>
<div><span>今日收集</span><span>24 个</span></div>
<div><span>来源平台</span><span>8 个</span></div>
</div>
</div>
<div class="module-card">
<div class="module-header">
<span class="module-title">📤 发布管理器</span>
<span class="module-status running">运行中</span>
</div>
<div class="module-content">
<div><span>最后运行</span><span>2026-04-27 13:30</span></div>
<div><span>今日发布</span><span>5 个</span></div>
<div><span>成功率</span><span>100%</span></div>
</div>
</div>
</div>
@@ -431,21 +478,12 @@
<script src="/static/vue/vue.global.js"></script>
<script src="/static/element-plus/index.full.min.js"></script>
<script src="/static/element-plus-icons/index.full.js"></script>
<script>
const App = {
data() {
return {
isLoggedIn: false,
pipelineModules: {
collector: { last_run: null, exists: false },
creator: { last_run: null, exists: false },
optimizer: { last_run: null, exists: false }
},
moduleList: [
{ key: 'collector', title: '📡 内容收集器', desc: '内容收集' },
{ key: 'creator', title: '🤖 内容创作引擎', desc: '内容创作' },
{ key: 'optimizer', title: '🔍 合规审查', desc: '合规审查' }
],
isAdmin: false,
currentUser: { username: '' },
currentPage: 'overview',
@@ -477,7 +515,6 @@
this.isLoggedIn = true;
this.currentPage = 'overview';
this.fetchStats();
this.fetchPipelineStatus();
} catch (error) {
this.loginError = '用户名或密码错误';
} finally {
@@ -532,31 +569,6 @@
redirectToPage(page) {
window.location.href = page.startsWith('/') ? page : '/' + page;
}
async fetchPipelineStatus() {
try {
const token = localStorage.getItem('authToken');
if (!token) return;
const response = await fetch('/api/system/pipeline/status', {
headers: { 'Authorization': 'Bearer ' + token }
});
if (response.ok) {
const data = await response.json();
if (data.pipeline_modules) {
this.pipelineModules = data.pipeline_modules;
}
} else {
console.error('获取流水线状态失败:', response.status);
}
} catch (error) {
console.error('获取流水线状态失败:', error);
}
},
formatDateTime(isoStr) {
if (!isoStr) return '未运行';
const date = new Date(isoStr);
const pad = n => n.toString().padStart(2, '0');
return `${date.getFullYear()}-${pad(date.getMonth()+1)}-${pad(date.getDate())} ${pad(date.getHours())}:${pad(date.getMinutes())}:${pad(date.getSeconds())}`;
},
},
mounted() {
const token = localStorage.getItem('authToken');
@@ -574,7 +586,6 @@
this.isLoggedIn = true;
this.currentPage = 'overview';
this.fetchStats();
this.fetchPipelineStatus();
})
.catch(() => {
localStorage.removeItem('authToken');