diff --git a/docs/superpowers/plans/2026-07-28-novel-message-actions-restore.md b/docs/superpowers/plans/2026-07-28-novel-message-actions-restore.md new file mode 100644 index 0000000..25bc748 --- /dev/null +++ b/docs/superpowers/plans/2026-07-28-novel-message-actions-restore.md @@ -0,0 +1,605 @@ +# 小说消息操作按钮恢复实施计划 + +> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking. + +**Goal:** 恢复小程序小说生成页和详情页丢失的"复制、播放、折叠/展开"功能,每条 novel 消息下方添加 3 个操作按钮。 + +**Architecture:** 在 ScriptView.vue 和 ScriptDetailView.vue 中为 `kind === 'novel'` 的消息添加按钮组 UI(折叠/展开、复制、播放)。ScriptView 复用已有函数,ScriptDetailView 新增相同逻辑。按钮组样式统一,参考 MessageCard 的 result-actions 样式。 + +**Tech Stack:** Vue 3 Composition API / UniApp / Pinia / uni.setClipboardData / useTtsPlayer composable / H5 端到端验收 + +## Global Constraints + +- 所有注释必须使用中文 +- 样式单位必须使用 rpx(小程序移动端) +- 禁止任何形式的 mock、兜底、默认值掩盖错误 +- 每个按钮必须有真实实现,不能有任何占位或 mock 功能 +- 修改后必须通过 H5 端到端验收(Console 0 新增错误) +- 部署使用 `python deploy.py backend`(后端)或热加载(前端) +- 埋点必须完整触发:`script_message_collapse_toggle`、`script_message_copy_click`、`script_message_tts_click` + +--- + +## Task 1: ScriptView 恢复按钮组 UI + +**Files:** +- Modify: `mini-program/src/pages/main/ScriptView.vue:180-187`(novel 消息渲染部分) +- Modify: `mini-program/src/pages/main/ScriptView.vue:3500+`(样式部分) + +**Interfaces:** +- Consumes: 已有函数 `getMessageDisplayContent(msg)`、`toggleMessageCollapse(msg)`、`copyMessageContent(msg)`、`playMessageTts(msg)`、`isMessageCollapsed(msg)` +- Produces: novel 消息下方显示 3 个按钮(折叠/展开、复制、播放),功能正常 + +### 背景 + +ScriptView.vue 中所有相关函数已存在(行 399-447),但模板中按钮组 UI 在 commit 2c778fa 中被删除。本任务恢复按钮组 UI。 + +### 步骤 + +- [ ] **Step 1: 定位 novel 消息渲染部分** + +打开 `mini-program/src/pages/main/ScriptView.vue`,找到 `kind === 'novel'` 的消息渲染部分(约行 180-187): + +```vue + + + +``` + +- [ ] **Step 2: 修改 Markdown 渲染,使用折叠内容** + +将 `` 改为: + +```vue + +``` + +这样折叠时只显示前 200 字符。 + +- [ ] **Step 3: 添加折叠/展开按钮** + +在 `` 下方添加折叠/展开按钮: + +```vue + + {{ isMessageCollapsed(msg) ? '展开全文' : '收起全文' }} + + + + + +``` + +- [ ] **Step 4: 添加操作按钮组** + +在折叠/展开按钮下方添加操作按钮组(复制、播放): + +```vue + + + + +``` + +注意:只有 2 个按钮(复制、播放),折叠/展开按钮已在上方独立显示。 + +- [ ] **Step 5: 添加按钮组样式** + +在 `