diff --git a/platform/frontend/topics.html b/platform/frontend/topics.html
index 2810101..623fd87 100644
--- a/platform/frontend/topics.html
+++ b/platform/frontend/topics.html
@@ -159,8 +159,8 @@
@@ -196,6 +196,7 @@ const TopicsApp = {
publishDialogVisible: false, publishTopic: null,
publishPlatforms: { zhihu: true, wechat: true, xiaohongshu: true },
publishing: false,
+ savingContent: false,
currentPage: 1, pageSize: 20
}
},
@@ -240,7 +241,7 @@ const TopicsApp = {
const doc = parser.parseFromString(html, 'text/html');
const body = doc.body;
if (!body) return html;
- body.querySelectorAll('script, nav, .header, footer, .interaction').forEach(el => el.remove());
+ body.querySelectorAll('script, nav, .header, .tags, footer, .interaction').forEach(el => el.remove());
return body.innerHTML;
} catch (e) { console.error('解析 HTML 失败:', e); return html; }
},
@@ -392,6 +393,29 @@ const TopicsApp = {
await this.fetchTodayCount();
} catch (e) { if (e !== 'cancel') this.$message.error('删除失败'); }
},
+ startEdit() {
+ this.editContent = this.currentPreviewBody;
+ this.editing = true;
+ this.$nextTick(() => { if (this.$refs.editor) this.$refs.editor.innerHTML = this.editContent; });
+ },
+ cancelEdit() {
+ this.editing = false;
+ this.editContent = '';
+ },
+ async saveContent() {
+ if (!this.previewTopic || !this.editContent) { this.$message.warning('没有内容可保存'); return; }
+ this.savingContent = true;
+ try {
+ await this.api(`/api/articles/${this.previewTopic.id}/content`, {
+ method: 'PUT',
+ body: JSON.stringify({ platform: this.previewPlatform, html_content: this.editContent })
+ });
+ this.$message.success('保存成功');
+ this.platformContents[this.previewPlatform] = this.editContent;
+ this.editing = false;
+ } catch (e) { this.$message.error('保存失败: ' + e.message); }
+ finally { this.savingContent = false; }
+ },
handleLogout() { localStorage.removeItem('authToken'); localStorage.removeItem('userRole'); localStorage.removeItem('currentUser'); window.location.href = '/login.html'; },
redirectToPage(page) { window.location.href = page.startsWith('/') ? page : '/' + page; },
getStatusLabel(status) { return { 'pending': '待处理', 'review': '待审查', 'ready': '待发布', 'published': '已发布' }[status] || status; },