fix: 修复前端空白页与API调用错误,统一创作流程
- 前端
- topics.html: 恢复结构并修复Vue初始化问题
- 调整创作按钮逻辑:仅已发布选题禁用
- 修正API端点与payload格式(generate/optimizer/publishing使用topic_ids数组)
- 移除ElementPlus图标模块依赖,使用全局构建
- admin.html: 回退至Options API版本,解决this上下文错误
- 后端
- 注册/api/generate/run路由
- 简化generate逻辑:允许非已发布选题重创作,更新状态为“待审查”
- 统一logs查询接口支持query参数
- 修复admin用户管理字段引用
- 系统概览返回{ stats }结构
- 静态资源整理
- 删除冗余element-plus-icons、重复CSS/JS、图标文件
- 正确放置Vue和ElementPlus全局文件
- 数据库与数据
- 补充30个案例
- 更新选题状态与初始数据
验证:所有页面可访问,API认证与端点正常工作。
This commit is contained in:
@@ -136,7 +136,7 @@
|
||||
<template #default="scope">
|
||||
<div style="display: flex; gap: 4px; flex-wrap: wrap;">
|
||||
<el-button size="small" @click="openPreview(scope.row)" type="primary">预览</el-button>
|
||||
<el-button size="small" type="success" :disabled="!isStatus(scope.row, 'pending')" @click="createTopic(scope.row)">创作</el-button>
|
||||
<el-button size="small" type="success" :disabled="isStatus(scope.row, 'published')" @click="createTopic(scope.row)">创作</el-button>
|
||||
<el-button size="small" type="warning" :disabled="!isStatus(scope.row, 'review')" @click="optimizeTopic(scope.row)">审查</el-button>
|
||||
<el-button v-if="isStatus(scope.row, 'ready')" size="small" type="primary" @click="handlePublish(scope.row)">发布</el-button>
|
||||
<el-button size="small" type="danger" @click="deleteTopic(scope.row.id)">删除</el-button>
|
||||
@@ -162,7 +162,7 @@
|
||||
</div>
|
||||
<div class="topic-card-actions">
|
||||
<el-button size="small" @click="openPreview(topic)" type="primary">预览</el-button>
|
||||
<el-button size="small" type="success" :disabled="!isStatus(topic, 'pending')" @click="createTopic(topic)">创作</el-button>
|
||||
<el-button size="small" type="success" :disabled="isStatus(topic, 'published')" @click="createTopic(topic)">创作</el-button>
|
||||
<el-button size="small" type="warning" :disabled="!isStatus(topic, 'review')" @click="optimizeTopic(topic)">审查</el-button>
|
||||
<el-button v-if="isStatus(topic, 'ready')" size="small" type="primary" @click="handlePublish(topic)">发布</el-button>
|
||||
<el-button size="small" type="danger" @click="deleteTopic(topic.id)">删除</el-button>
|
||||
@@ -312,8 +312,8 @@ const TopicsApp = {
|
||||
});
|
||||
},
|
||||
async createTopic(topic) {
|
||||
if (!this.isStatus(topic, 'pending')) {
|
||||
this.$message.info('仅待处理选题可创作');
|
||||
if (this.isStatus(topic, 'published')) {
|
||||
this.$message.info('已发布选题不可创作');
|
||||
return;
|
||||
}
|
||||
try {
|
||||
@@ -322,13 +322,13 @@ const TopicsApp = {
|
||||
this.$message.error('请先登录');
|
||||
return;
|
||||
}
|
||||
const response = await fetch('/api/system/generate/run', {
|
||||
const response = await fetch('/api/generate/run', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Authorization': 'Bearer ' + token,
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify({ topic_id: topic.id })
|
||||
body: JSON.stringify({ topic_ids: [topic.id] })
|
||||
});
|
||||
if (!response.ok) {
|
||||
const errorData = await response.json().catch(() => ({}));
|
||||
@@ -359,7 +359,7 @@ const TopicsApp = {
|
||||
'Authorization': 'Bearer ' + token,
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify({ topic_id: topic.id })
|
||||
body: JSON.stringify({ topic_ids: [topic.id] })
|
||||
});
|
||||
if (!response.ok) {
|
||||
const errorData = await response.json().catch(() => ({}));
|
||||
@@ -390,7 +390,7 @@ const TopicsApp = {
|
||||
'Authorization': 'Bearer ' + token,
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify({ topic_id: topic.id })
|
||||
body: JSON.stringify({ topic_ids: [topic.id] })
|
||||
});
|
||||
if (!response.ok) {
|
||||
const errorData = await response.json().catch(() => ({}));
|
||||
|
||||
Reference in New Issue
Block a user