From 60bdd5f2682b5689458956131fef672c235fa8e7 Mon Sep 17 00:00:00 2001 From: zwt13703 Date: Wed, 1 Jul 2026 20:48:02 +0800 Subject: [PATCH] feat: wire template stores and linkage --- .../AI文档模板系统-像素级任务清单-20260701.md | 14 +- docs/tasks/task_detail_2026_07_01.md | 15 ++ .../components/TemplateEdit/ConfigPanel.vue | 46 ++++-- .../components/TemplateEdit/StructureTree.vue | 35 ++--- .../components/TemplateEdit/TopToolbar.vue | 23 ++- .../components/TemplateEdit/WordPreview.vue | 85 +++++------- frontend/src/stores/selectionStore.ts | 12 ++ frontend/src/stores/templateStore.ts | 131 ++++++++++++++++++ frontend/src/stores/uiStore.ts | 26 ++++ frontend/src/views/TemplateEdit.vue | 27 +++- 10 files changed, 304 insertions(+), 110 deletions(-) create mode 100644 frontend/src/stores/selectionStore.ts create mode 100644 frontend/src/stores/templateStore.ts create mode 100644 frontend/src/stores/uiStore.ts diff --git a/docs/AI文档模板系统-像素级任务清单-20260701.md b/docs/AI文档模板系统-像素级任务清单-20260701.md index adbacc2..10dcf5e 100644 --- a/docs/AI文档模板系统-像素级任务清单-20260701.md +++ b/docs/AI文档模板系统-像素级任务清单-20260701.md @@ -89,14 +89,14 @@ | 065 | 保存按钮 + loading 状态 + 成功/失败提示 | 前端 | 0.25d | ✅ 已完成 | | 066 | 未选中区域时的空状态占位提示 | 前端 | 0.25d | ✅ 已完成 | | | **Pinia Store** | | | | -| 067 | templateStore | 前端 | 0.5d | ⏳ 未完成 | -| 068 | selectionStore | 前端 | 0.25d | ⏳ 未完成 | -| 069 | uiStore | 前端 | 0.25d | ⏳ 未完成 | +| 067 | templateStore | 前端 | 0.5d | ✅ 已完成 | +| 068 | selectionStore | 前端 | 0.25d | ✅ 已完成 | +| 069 | uiStore | 前端 | 0.25d | ✅ 已完成 | | | **三区联动** | | | | -| 070 | watch selectedBlockId → 配置面板加载 | 前端 | 0.5d | ⏳ 未完成 | -| 071 | watch selectedBlockId → 结构树节点高亮 | 前端 | 0.25d | ⏳ 未完成 | -| 072 | 页面初始化 loading(全页遮罩 + a-spin) | 前端 | 0.25d | ⏳ 未完成 | -| 073 | 加载失败错误页 + 重新加载按钮 | 前端 | 0.25d | ⏳ 未完成 | +| 070 | watch selectedBlockId → 配置面板加载 | 前端 | 0.5d | ✅ 已完成 | +| 071 | watch selectedBlockId → 结构树节点高亮 | 前端 | 0.25d | ✅ 已完成 | +| 072 | 页面初始化 loading(全页遮罩 + a-spin) | 前端 | 0.25d | ✅ 已完成 | +| 073 | 加载失败错误页 + 重新加载按钮 | 前端 | 0.25d | ✅ 已完成 | | | **总计** | | **~18.25d** | | --- diff --git a/docs/tasks/task_detail_2026_07_01.md b/docs/tasks/task_detail_2026_07_01.md index 6fa84f9..a41d485 100644 --- a/docs/tasks/task_detail_2026_07_01.md +++ b/docs/tasks/task_detail_2026_07_01.md @@ -137,3 +137,18 @@ 9. 增加未选中区域时的空状态占位。 10. 执行前端构建验证。 - **执行结果**: 完成任务 058-066,配置面板具备完整基础表单能力。 + +## 会话 ID: 20260701-stores-linkage +- [2026-07-01 20:47:36] +- **执行原因**: 按任务清单继续完成 Pinia Store 和三区联动 067-073。 +- **执行过程**: + 1. 新增 `templateStore`,集中管理模板信息、预览 HTML、blocks、tree、configs、loading 和 error。 + 2. 新增 `selectionStore`,集中管理当前选中的 `selectedBlockId`。 + 3. 新增 `uiStore`,集中管理标签显示、缩放比例和保存状态。 + 4. `TemplateEdit.vue` 接入初始化 loading、加载失败错误页和重新加载按钮。 + 5. `WordPreview.vue` 接入 store,点击预览块会更新全局选中区域。 + 6. `StructureTree.vue` 接入 store,选中节点会同步高亮并定位预览区。 + 7. `ConfigPanel.vue` watch `selectedBlockId`,切换区域时自动加载对应配置。 + 8. `TopToolbar.vue` 接入模板信息和保存状态。 + 9. 执行前端构建验证。 +- **执行结果**: 完成任务 067-073,基础 MVP 任务清单 001-073 已全部标注完成。 diff --git a/frontend/src/components/TemplateEdit/ConfigPanel.vue b/frontend/src/components/TemplateEdit/ConfigPanel.vue index 21a6835..43edbbd 100644 --- a/frontend/src/components/TemplateEdit/ConfigPanel.vue +++ b/frontend/src/components/TemplateEdit/ConfigPanel.vue @@ -1,14 +1,15 @@