feat: 按菜单功能拆分页面 - index.html(主入口+概览)、topics.html、logs.html、users.html

This commit is contained in:
lt
2026-04-27 13:09:38 +08:00
parent 87ebd94719
commit 0a19cc203b
4 changed files with 474 additions and 228 deletions
+130
View File
@@ -0,0 +1,130 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>宇之然内容创作平台 - 选题管理</title>
<link rel="stylesheet" href="/static/element-plus.css?v=20260427" />
<script src="/static/element-plus.full.js?v=20260427"></script>
<style>
body { margin: 0; padding: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
.sidebar { width: 160px; position: fixed; height: 100vh; left: 0; top: 0; background: #f5f5f5; border-right: 1px solid #e0e0e0; }
.main-content { margin-left: 160px; width: calc(100vw - 160px); min-height: 100vh; overflow-x: auto; }
.card { background: white; border-radius: 12px; padding: 24px; margin-bottom: 24px; box-shadow: 0 2px 12px rgba(0,0,0,0.08); transition: all 0.3s; }
.card:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.12); }
.status-badge { display: inline-flex; align-items: center; gap: 4px; }
.status-dot { width: 6px; height: 6px; border-radius: 50%; }
.status-dot.pending { background: #E6A23C; }
.status-dot.review { background: #F56C6C; }
.status-dot.ready { background: #67C23A; }
.status-dot.published { background: #409EFF; }
.loading-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(255,255,255,0.8); display: flex; align-items: center; justify-content: center; z-index: 9999; }
aside a { display: block; width: 100%; text-align: left; border: none; background: transparent; border-radius: 8px; margin-bottom: 4px; padding: 8px 16px; color: #4b5563; text-decoration: none; }
aside a:hover { background-color: #f3f4f6; }
@media (max-width: 768px) { .sidebar { display: none; } .main-content { margin-left: 0; width: 100vw; } }
</style>
</head>
<body>
<div id="app">
<nav class="bg-gradient-to-r from-blue-600 to-blue-700 text-white shadow-lg">
<div class="container mx-auto px-6 py-4 flex justify-between items-center">
<h1 class="text-2xl font-bold nav-title">宇之然内容创作平台 - 选题管理</h1>
</div>
</nav>
<div class="page flex gap-6">
<aside class="w-40 flex-shrink-0 hidden md:block sidebar">
<a href="/" class="block px-4 py-2 rounded-lg bg-blue-50 text-blue-600 font-semibold">📊 系统概览</a>
<a href="/topics.html" class="block px-4 py-2 rounded-lg text-gray-600">📋 选题管理</a>
<a href="/logs.html" class="block px-4 py-2 rounded-lg text-gray-600">📄 系统日志</a>
<a href="/users.html" class="block px-4 py-2 rounded-lg text-gray-600">👥 用户管理</a>
</aside>
<main class="flex-1 main-content">
<div class="card" style="padding: 20px; margin-top: 20px;">
<div class="flex justify-between items-center mb-6">
<h2 class="text-2xl font-bold text-gray-800">📋 选题管理</h2>
</div>
<div class="card mb-6" style="display: inline-block; min-width: fit-content;">
<div class="flex flex-wrap gap-2 items-center">
<el-button type="primary" size="small" @click="refreshAll">🔄 批量刷新</el-button>
<el-button type="success" size="small" @click="triggerGenerateSelected" :disabled="selectedTopicIds.length === 0">▶ 批量创作</el-button>
<el-button type="warning" size="small" @click="triggerOptimizeSelected" :disabled="selectedTopicIds.length === 0">🔍 批量优化</el-button>
<span class="ml-auto text-sm text-gray-500" v-if="selectedTopicIds.length > 0">已选 {{ selectedTopicIds.length }} 项</span>
</div>
</div>
<div class="quick-filter mb-4">
<el-tag size="large" :type="filterStatus === '' ? 'primary' : ''" @click="filterStatus = ''">全部 ({{ topics.length }})</el-tag>
<el-tag size="large" :type="filterStatus === '待处理' ? 'primary' : ''" @click="filterStatus = '待处理'">待处理 ({{ countByStatus('待处理') }})</el-tag>
<el-tag size="large" :type="filterStatus === '待审查' ? 'primary' : ''" @click="filterStatus = '待审查'">待审查 ({{ countByStatus('待审查') }})</el-tag>
<el-tag size="large" :type="filterStatus === '待发布' ? 'primary' : ''" @click="filterStatus = '待发布'">待发布 ({{ countByStatus('待发布') }})</el-tag>
<el-tag size="large" :type="filterStatus === '已发布' ? 'primary' : ''" @click="filterStatus = '已发布'">已发布 ({{ countByStatus('已发布') }})</el-tag>
</div>
<div class="card" style="width: 100%; overflow-x: auto; box-sizing: border-box;">
<el-table :data="filteredTopics" stripe v-loading="loadingTable" :row-key="topic => topic.id" @selection-change="selectedTopicIds = $event">
<el-table-column type="selection" width="55"></el-table-column>
<el-table-column prop="id" label="ID" width="70" fixed></el-table-column>
<el-table-column prop="title" label="标题" min-width="220"></el-table-column>
<el-table-column prop="field" label="领域" width="100"></el-table-column>
<el-table-column prop="priority_score" label="优先级" width="70">
<template #default="scope">
<el-tag :type="getPriorityType(scope.row.priority_score)" size="small">{{ scope.row.priority_score }}</el-tag>
</template>
</el-table-column>
<el-table-column prop="status" label="状态" width="90">
<template #default="scope">
<span class="status-badge">
<span class="status-dot" :class="getStatusClass(scope.row.status)"></span>
{{ scope.row.status }}
</span>
</template>
</el-table-column>
<el-table-column prop="compliance_score" label="合规分" width="90">
<template #default="scope">
<el-progress :percentage="scope.row.compliance_score || 0" :format="() => scope.row.compliance_score || '-'" :stroke-width="15"></el-progress>
</template>
</el-table-column>
<el-table-column prop="created_at" label="创建时间" width="140"><template #default="scope">{{ formatDate(scope.row.created_at) }}</template></el-table-column>
<el-table-column prop="generated_at" label="创作时间" width="140"><template #default="scope">{{ scope.row.generated_at ? formatDate(scope.row.generated_at) : '-' }}</template></el-table-column>
<el-table-column prop="published_at" label="发布时间" width="140"><template #default="scope">{{ scope.row.published_at ? formatDate(scope.row.published_at) : '-' }}</template></el-table-column>
<el-table-column prop="updated_at" label="更新时间" width="140"><template #default="scope">{{ formatDate(scope.row.updated_at) }}</template></el-table-column>
<el-table-column label="操作" width="210" fixed="right">
<template #default="scope">
<div class="flex flex-wrap gap-1" style="justify-content: flex-start;">
<el-button size="small" @click="openPreview(scope.row)" type="primary">预览</el-button>
<el-button size="small" type="success" :disabled="scope.row.status !== '待处理'" @click="createTopic(scope.row)">创作</el-button>
<el-button size="small" type="warning" :disabled="scope.row.status !== '待审查'" @click="optimizeTopic(scope.row)">审查</el-button>
<el-button v-if="scope.row.status === '待发布'" size="small" type="primary" @click="handlePublish(scope.row)">发布</el-button>
<el-button size="small" type="danger" @click="deleteTopic(scope.row.id)">删除</el-button>
</div>
</template>
</el-table-column>
</el-table>
</div>
</div>
</main>
</div>
</div>
<script src="/static/vue.global.prod.js?v=20260427"></script>
<script>
const TopicsPage = {
data() {
return {
// 选题管理页面的数据...
}
},
computed: {
// 计算属性...
},
methods: {
// 方法...
}
}
Vue.createApp(TopicsPage).mount('#app')
</script>
</body>
</html>