Files
Pre_Seg_Server/工程分析/需求分析-2026-04-29-23-10-27.md

40 lines
1.6 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-29-23-10-27
## 需求来源
- 提出时间: 2026-04-29-23-10-27
- 需求类型: 缺陷修复
## 原始需求描述
0. 项目库中为什么没有 Data_MyVideo_1.mp4 视频?
1. 导入后显示 "已保存至: undefined",项目库无内容
2. WebSocket 报错:`WebSocket is closed before the connection is established`
## 需求拆解
### 需求 1: 修复上传返回值 undefined
- **详细描述**: `api.ts``uploadMedia` 声明返回 `{url, id}`,但后端实际返回 `{object_name, file_url, size, message}`,导致 `result.url` 为 undefined
- **优先级**: P0-阻塞
- **影响范围**: `src/lib/api.ts`, `src/components/ProjectLibrary.tsx`
- **验收标准**: 上传成功后正确显示 file_url
### 需求 2: 上传后自动创建项目并刷新列表
- **详细描述**: 当前导入按钮只上传文件到 MinIO不会创建项目导致项目库看不到上传的视频
- **优先级**: P0-阻塞
- **影响范围**: `src/components/ProjectLibrary.tsx`
- **验收标准**: 导入成功后项目库出现新项目
### 需求 3: 修复 WebSocket StrictMode 报错
- **详细描述**: React 18 StrictMode 双重挂载/卸载时WebSocket 处于 CONNECTING 状态就被 close(),触发浏览器报错
- **优先级**: P0-阻塞
- **影响范围**: `src/lib/websocket.ts`
- **验收标准**: 控制台无 WebSocket 红色报错
## 约束条件
- 保持现有 UI 交互流程
- 最小修改原则
## 风险评估
| 风险点 | 影响 | 缓解措施 |
|--------|------|----------|
| 上传+创建项目合并后逻辑复杂 | 低 | 先上传,成功后创建项目,两步顺序执行 |