Files
ele-HeiXiu/TODO.md
YoungestSongMo 4237dcbaf6 feat: 数据获取架构重构 + Mac指纹采集 + Token刷新容错 + 账单页面 (0.0.19)
## 架构重构
  - useAsyncData 集成 AbortController:cleanup 时真正中断 HTTP 请求,
    不再仅丢弃响应(解决 StrictMode 双重请求问题)
  - API 模块统一 signal?: AbortSignal 参数,透传 axios config
  - use-api.ts 成为数据 Hook 集中管理中心,新增 useAccountInfo、
    useBillingBalance、useBillingLedger
  - 页面组件改为纯渲染:const {data,loading,error,refetch} = useXxx()

  ## 新功能
  - Mac 硬件指纹采集(electron/preload/device.ts):
    ioreg(UUID) + sysctl(CPU) + system_profiler(HDD三级回退)
  - 账单页面 BillingInfo(余额卡片 + 账单表格 + 分页)
  - PageDispatcher 注册 /billing 页面(FloatingPanel 960×680)
  - 共享工具函数 centToYuan / formatDate(src/utils/display.ts)

  ## Bug 修复
  - Token 刷新容错:网络错误时保留 refresh_token,等网络恢复后重试;
    仅 RefreshError(token 过期)时清除(auth-token.ts)
  - AppProvider 自动登录时 nullable 字段默认值(email→''、admin_permissions→[])
  - AccountInfo 重构消除 ~40 行手写状态管理代码

  ## 代码质量
  - AccountInfo 消除 centToYuan/formatDate 重复定义
  - BillingInfo 标题层级精简(移除冗余页面/Card标题)
  - antd Table align 字面量类型修正('left' as const)
  - billing.ts signal 参数位置修复(params→config)
  - modelFirstFetchDone 模块级变量移除(StrictMode 不安全)
2026-06-11 20:08:44 +08:00

85 lines
3.8 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.
# TODO — 船长·HeiXiu 待办与优化清单
> 最后更新2026-06-09
---
[//]: # (警告:(48, 14) ESLint: Fast refresh only works when a file only exports components. Move your React context(s) to a separate file. (react-refresh/only-export-components))
[//]: # (警告:(52, 17) ESLint: Fast refresh only works when a file only exports components. Use a new file to share constants or functions between components. (react-refresh/only-export-components))
## 🟡 功能待完善(优先级中)
### 设置页面
- [ ] 设置数据通过 IPC 同步到主进程(当前仅渲染进程 localStorage
- [ ] 存储路径有效性校验(检查路径是否存在)
- [ ] "恢复默认设置"按钮
### 路由与页面
- [x] 账户信息页面(`/account``AccountInfo.tsx`AuthAPI.getUserInfo() 驱动
- [ ] 合规素材库页面(`/compliance-assets`
- [ ] 项目管理页面(`/projects`,企业版)
- [ ] 会员/充值/消费记录/订单明细页面
### 导航栏
- [ ] 导航配置中的 `action: 'external'` 统一管理(白名单校验)
- [ ] 未登录点击需登录项 → 登录成功后自动跳转到目标页
### 公告
- [ ] 公告已读/未读状态
- [ ] 公告红点/角标提醒(有新公告时导航栏图标变化)
- [ ] 公告缓存(减少重复请求)
---
## 🟢 工程优化(优先级低)
### 构建与开发
- [ ] CI/CD 流水线GitHub Actions / 自建)
- [ ] 代码签名自动化Windows Authenticode / macOS notarization
- [ ] E2E 测试用例编写Playwright
- [ ] 单元测试覆盖Vitest
- [ ] Bundle 体积分析优化rollup-plugin-visualizer 已有,定期检查)
### 代码质量
- [ ] 移除未使用的 `shared/` 类型和常量
- [ ] 统一 IPC 通道注册/注销模式(避免重复监听)
- [ ] React 组件 lazy loadingReact.lazy + Suspense
- [ ] 错误边界组件ErrorBoundary
- [ ] 审计其余 useEffect 缺少清理函数的位置StrictMode 双重挂载可能导致重复请求,参考 AppProvider 的 aborted 模式)
### 文档
- [ ] API 接口文档Swagger / 手动维护)
- [ ] 组件文档Storybook
- [ ] 用户操作手册
---
## ⚠️ 已知技术债务
| 问题 | 说明 | 影响 |
|-----------------|---------------------------------------|----------------|
| localStorage 依赖 | 所有持久化数据依赖 localStorage | 清理浏览器数据会丢失所有配置 |
| IPC 监听器 | useUpdater 已改为单例,其他 IPC hook 可能也有类似问题 | 长期运行可能内存泄漏 |
| `test.py` | 仓库根目录残留测试文件 | 无实际作用,应清理 |
| `null` 文件 | 仓库根目录名为 null 的文件 | 构建产物或误操作残留 |
---
## 📋 下次开发计划
1. **合规素材库页面**(功能待完善 — 按 QT 原版设计,以 Modal/Drawer 叠加而非路由跳转实现)
2. **各页面 nav 导航补齐**(后续页面优先使用叠加模式,遵循 QT 多窗口模型 → 见 WORKLOG 2026-06-07
3. **leftWidth / rightWidth / taskPage 加 localStorage 持久化**UX 优化:刷新页面后保持用户偏好;已通过路由去路由化解决组件卸载问题,但
localStorage 持久层仍未实现)
4. **轮播图关闭按钮 localStorage 持久化**关闭按钮已实现待做localStorage 记录关闭时间戳,超过 N 天再显示)
5. **短信发送接入人机验证**(后期优化,需后端配合:`sendSms` 接口增加 `captcha_token` 参数 + 前端滑块/图形验证组件。当前仅靠
60s 冷却按钮 + 后端限流,桌面端 ASAR 可解包 + DevTools 网络面板 + 代理抓包均能直接暴露 API纯前端限制对脚本攻击无效