diff --git a/platform/frontend/logs.html b/platform/frontend/logs.html index 552acfa..fbd5d93 100644 --- a/platform/frontend/logs.html +++ b/platform/frontend/logs.html @@ -24,6 +24,12 @@ aside button:hover { background-color: #f3f4f6; } @media (max-width: 768px) { main { padding-bottom: 70px; } } .nav-title { text-align: center; } + .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; }
@@ -50,9 +56,111 @@{{ logContent }}{ loadingText }
+{{ loadingText }}
页面内容加载中...
' + // 相关数据 + status: {}, + topics: [], + filterStatus: "", + selectedTopicIds: [], + generating: false, + optimizing: false, + loadingAll: false, + loadingTable: false, + loadingLogs: false, + loadingUsers: false, + loadingOverlay: false, + loadingText: "", + + // 日志相关 + logType: "creator", + logDate: "", + logContent: "", + + // 用户相关 + users: [], + + // 模态框相关 + createTopicModalVisible: false, + newUserForm: {}, + publishModalVisible: false, + publishForm: { + platform: "zhihu", + url: "", + description: "" + }, + publishTopicId: "", + + // 预览相关 + previewVisible: false, + previewTopic: null, + previewPlatform: "", + previewHtml: "", + fullScreenPreview: false + } + }, + computed: { + filteredTopics() { + if (!this.topics.length) return [] + if (!this.filterStatus) return this.topics + return this.topics.filter(t => t.status === this.filterStatus) + }, + countByStatus() { + return (status) => this.topics.filter(t => t.status === status).length + } + }, + methods: { + // 数据获取 + async fetchTopics() { + this.loadingTable = true + try { + // 模拟API调用 + await new Promise(resolve => setTimeout(resolve, 500)) + this.topics = [ + { + id: "A01", + title: "可持续发展趋势分析", + field: "环保", + status: "pending", + compliance_score: 85, + created_at: "2026-04-27 10:30", + generated_at: "-", + published_at: "-", + updated_at: "2026-04-27 10:30", + priority_score: "高" + }, + { + id: "B02", + title: "AI在内容创作中的应用", + field: "科技", + status: "review", + compliance_score: 92, + created_at: "2026-04-27 11:15", + generated_at: "2026-04-27 11:45", + published_at: "-", + updated_at: "2026-04-27 11:45", + priority_score: "中" + }, + { + id: "C03", + title: "数字化转型案例研究", + field: "商业", + status: "ready", + compliance_score: 78, + created_at: "2026-04-27 12:00", + generated_at: "2026-04-27 12:30", + published_at: "2026-04-27 13:00", + updated_at: "2026-04-27 13:00", + priority_score: "高" + } + ] + } catch (error) { + console.error("获取选题失败:", error) + } finally { + this.loadingTable = false } }, - generateTopicsContent(container) { - container.innerHTML = ` -| - | ID | -标题 | -领域 | -状态 | -操作 | -
|---|---|---|---|---|---|
| - | A01 | -可持续发展趋势分析 | -环保 | -待处理 | -- - - - | -
| - | B02 | -AI在内容创作中的应用 | -科技 | -待审查 | -- - - - | -
这里是选题的详细内容和格式预览...
" + this.loadingOverlay = false + }, 1000) + }, + + copyPreviewHtml() { + this.$message.success("HTML 已复制到剪贴板") + }, + expandPreview() { + this.fullScreenPreview = !this.fullScreenPreview + }, + + async createTopic(topic) { + if (topic && topic.status === "待处理") { + await this.triggerGenerate([topic.id]) + await this.fetchTopics() + } else { + this.$message.info("仅待处理选题可创作") + } + }, + + async optimizeTopic(topic) { + if (topic && topic.status === "待审查") { + await this.triggerOptimize([topic.id]) + await this.fetchTopics() + } else { + this.$message.info("仅待审查选题可优化") + } + }, + + handlePublish(topic) { + this.publishTopicId = topic.id + this.publishModalVisible = true + }, + + confirmPublish() { + this.$message.success("发布成功") + this.publishModalVisible = false + this.fetchTopics() + }, + + deleteTopic(id) { + this.$confirm("确定删除该选题?删除后无法恢复。", "提示", { + confirmButtonText: "确定", + cancelButtonText: "取消", + type: "warning" + }).then(async () => { + try { + await this.deleteTopicApi(id) + this.$message.success("删除成功") + await this.fetchTopics() + } catch (e) { + this.$message.error("删除失败:" + e.message) + } + }).catch(() => {}) + }, + + openCreateUserModal() { + this.createTopicModalVisible = true + }, + + deleteUser(id) { + if (id === "admin") { + this.$message.warning("不能删除管理员用户") + return + } + this.$confirm("确定删除该用户?", "提示", { + confirmButtonText: "确定", + cancelButtonText: "取消", + type: "warning" + }).then(() => { + this.$message.success("删除用户成功") + this.fetchUsers() + }).catch(() => {}) + }, + + // API 模拟方法 + async triggerGenerate(ids) { + await new Promise(resolve => setTimeout(resolve, 1000)) + console.log("生成选题:", ids) + }, + + async triggerOptimize(ids) { + await new Promise(resolve => setTimeout(resolve, 1000)) + console.log("优化选题:", ids) + }, + + async deleteTopicApi(id) { + await new Promise(resolve => setTimeout(resolve, 500)) + console.log("删除选题:", id) + }, + + // 工具方法 + getPriorityType(score) { + const types = { "高": "danger", "中": "warning", "低": "info" } + return types[score] || "info" + }, + + getStatusClass(status) { + const classes = { + "待处理": "status-dot pending", + "待审查": "status-dot review", + "待发布": "status-dot ready", + "已发布": "status-dot published" + } + return classes[status] || "" + }, + + formatDate(dateStr) { + if (!dateStr || dateStr === "-" || dateStr.trim() === "") return "-" + const date = new Date(dateStr.replace(" ", "T")) + return date.toLocaleString("zh-CN", { + year: "numeric", month: "2-digit", day: "2-digit", + hour: "2-digit", minute: "2-digit" }) - }, - - generateLogsContent(container) { - container.innerHTML = ` -| ID | -用户名 | -角色 | -操作 | -
|---|---|---|---|
| admin | -管理员 | -管理员 | -- |
| editor1 | -编辑小王 | -编辑 | -- |