diff --git a/platform/frontend/topics.html b/platform/frontend/topics.html index 9c9455f..5ae4394 100644 --- a/platform/frontend/topics.html +++ b/platform/frontend/topics.html @@ -198,58 +198,14 @@ const data = await response.json(); this.topics = data || []; } catch (error) { - console.log('使用模拟数据'); - this.topics = [ - { id: 'A01', title: '可持续发展趋势分析', field: '环保', status: '待处理', compliance_score: 85, created_at: '2026-04-27 10:30', generated_at: null, published_at: null }, - { id: 'B02', title: 'AI 在内容创作中的应用', field: '科技', status: '待审查', compliance_score: 92, created_at: '2026-04-27 11:15', generated_at: '2026-04-27 11:45', published_at: null }, - { id: 'C03', title: '数字化转型案例研究', field: '商业', status: '待发布', compliance_score: 78, created_at: '2026-04-27 12:00', generated_at: '2026-04-27 12:30', published_at: '2026-04-27 13:00' } - ]; - } finally { this.loadingTable = false; } - }, - refreshAll() { this.$message.info('执行批量刷新'); }, - async triggerGenerateSelected() { - if (!this.selectedTopicIds.length) return; - this.$message.success('批量创作已启动'); - this.selectedTopicIds = []; - await this.fetchTopics(); - }, - async triggerOptimizeSelected() { - if (!this.selectedTopicIds.length) return; - this.$message.success('批量优化已启动'); - this.selectedTopicIds = []; - await this.fetchTopics(); - }, - openPreview(topic) { this.$message.info('预览:' + topic.title); }, - async createTopic(topic) { - if (topic.status === '待处理') { - this.$message.success('开始创作:' + topic.title); - await this.fetchTopics(); - } else { this.$message.info('仅待处理选题可创作'); } - }, - async optimizeTopic(topic) { - if (topic.status === '待审查') { - this.$message.success('开始优化:' + topic.title); - await this.fetchTopics(); - } else { this.$message.info('仅待审查选题可优化'); } - }, - async handlePublish(topic) { this.$message.success('发布:' + topic.title); await this.fetchTopics(); }, - deleteTopic(id) { - this.$confirm('确定删除?', '提示', { confirmButtonText: '确定', cancelButtonText: '取消', type: 'warning' }) - .then(async () => { this.$message.success('删除成功'); await this.fetchTopics(); }).catch(() => {}); - }, - handleLogout() { localStorage.removeItem('authToken'); window.location.href = '/'; }, - redirectToPage(page) { window.location.href = '/' + page; }, - formatDate(dateStr) { if (!dateStr) return '-'; return new Date(dateStr.replace(' ', 'T')).toLocaleString('zh-CN', { year: 'numeric', month: '2-digit', day: '2-digit', hour: '2-digit', minute: '2-digit' }); } - }, - mounted() { - const token = localStorage.getItem('authToken'); - if (!token) { window.location.href = '/'; return; } - fetch('/api/auth/me', { headers: { 'Authorization': 'Bearer ' + token } }) - .then(response => response.ok ? response.json() : Promise.reject()) - .then(data => { this.currentUser = data.user; this.isAdmin = data.user.role === 'admin'; this.isLoggedIn = true; this.fetchTopics(); }) - .catch(() => { localStorage.removeItem('authToken'); window.location.href = '/'; }); - } - }; + console.log('获取选题失败:', error); + this.$message.error('获取选题失败,使用模拟数据'); + this.topics = [ + { id: 'A01', title: '可持续发展趋势分析', field: '环保', status: '待处理', compliance_score: 85, created_at: '2026-04-27 10:30', generated_at: null, published_at: null }, + { id: 'B02', title: 'AI 在内容创作中的应用', field: '科技', status: '待审查', compliance_score: 92, created_at: '2026-04-27 11:15', generated_at: '2026-04-27 11:45', published_at: null }, + { id: 'C03', title: '数字化转型案例研究', field: '商业', status: '待发布', compliance_score: 78, created_at: '2026-04-27 12:00', generated_at: '2026-04-27 12:30', published_at: '2026-04-27 13:00' } + ]; + } const app = Vue.createApp(TopicsApp); app.use(ElementPlus); app.mount('#app');