diff --git a/platform/frontend/topics.html b/platform/frontend/topics.html
index b11c43c..b77da6c 100644
--- a/platform/frontend/topics.html
+++ b/platform/frontend/topics.html
@@ -444,8 +444,7 @@ const TopicsApp = {
},
currentPreviewBody() {
const html = this.platformContents[this.previewPlatform];
- if (!html) return '';
- if (html.length < 50) return '
📝
该平台内容暂未生成或内容为空
可点击上方「批量创作」重新生成,或在编辑模式下手动添加内容
';
+ if (!html || html.length < 50) return '📝
该平台内容暂未生成或内容为空
可点击上方「批量创作」重新生成,或在编辑模式下手动添加内容
';
try {
const parser = new DOMParser();
const doc = parser.parseFromString(html, 'text/html');
@@ -551,7 +550,7 @@ const TopicsApp = {
platformName(platform) { return { zhihu: '知乎', wechat: '微信公众号', xiaohongshu: '小红书' }[platform] || platform; },
platformShort(platform) { return { zhihu: '知', wechat: '公', xiaohongshu: '红' }[platform] || platform; },
fmtWordCount(wc) { if (!wc) return ''; if (wc >= 1000) return (wc / 1000).toFixed(wc >= 10000 ? 0 : 1) + 'k'; return wc + ''; },
- openTopicArticlePreview(topic, article) {
+ async openTopicArticlePreview(topic, article) {
this.previewTopic = topic;
this.previewPlatform = article.platform;
this.previewVisible = true;
@@ -559,9 +558,13 @@ const TopicsApp = {
this.previewImages = {};
const token = this.getToken();
if (!token) return;
- fetch(`/api/articles/${topic.id}/preview?platform=${article.platform}`, { headers: { 'Authorization': 'Bearer ' + token } })
- .then(r => r.ok ? r.json() : null).then(d => { if (d && d.html) { this.platformContents[article.platform] = d.html; if (d.images) this.previewImages[article.platform] = d.images; } })
- .catch(e => console.error(`加载${article.platform}预览失败:`, e));
+ try {
+ const r = await fetch(`/api/articles/${topic.id}/preview?platform=${article.platform}`, { headers: { 'Authorization': 'Bearer ' + token } });
+ if (r.ok) {
+ const d = await r.json();
+ if (d && d.html) { this.platformContents[article.platform] = d.html; if (d.images) this.previewImages[article.platform] = d.images; }
+ }
+ } catch (e) { console.error(`加载${article.platform}预览失败:`, e); }
},
copyContent(platform) {
const html = this.platformContents[platform];