Files
Mdeical_Sur_Report/过往经验/需求分析-2026-04-16-20-24-11.md

35 lines
1.4 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 需求分析 — 2026-04-16-20-24-11
## 原始需求摘要
`/report-editor` 页面操作后,切换到 `/report-manage` 等其他页面,再次返回 `/report-editor` 时:
- `class="editor-content-wrapper print-wrapper"` 中的内容(报告文本、图片、表格等)全部丢失;
- 视频分析面板中自动摘取的关键帧、手动摘取的关键帧全部丢失。
此前三次修复尝试(同步 stateRef 到更多恢复分支、彻底重构 saveDraftToStorage 依赖 React state未能根治问题。
## 需求拆解
### 功能点
- 修复路由切换后报告编辑器内容丢失的问题;
- 修复路由切换后自动/手动关键帧丢失的问题;
- 修复 `saveDraftToStorage` 中的闭包陷阱问题;
- 修复组件卸载时 `editorRef` 失效导致的 content 丢失问题;
- 确保所有修改编辑器 DOM 的操作后都及时更新 `contentRef`
### 非功能点
- 最小化改动范围,不引入新的状态管理库;
- 保持现有 localStorage 草稿机制不变;
- 保持用户现有的操作习惯(上传视频、自动摘帧、拖拽插入等)。
## 影响范围预估
| 模块 | 影响程度 | 说明 |
|------|---------|------|
| `src/pages/ReportEditor.tsx` | 高 | `saveDraftToStorage` 函数重构 + `contentRef` 遗漏点补齐 |
| 其他文件 | 无 | 不涉及修改 |
## 待确认问题
无。问题现象和分析已明确。