hookehuyr

docs(changelog): add code refactoring entry for useCollectOperation

Document the extraction of duplicate collection logic into a reusable composable.

- Created useCollectOperation composable with optimistic UI updates
- Refactored index and material-list pages (removed 89 lines of duplicate code)
- Fixed runtime module resolution issue
- Net reduction: 82 lines of code
......@@ -5,6 +5,33 @@
---
## [2026-02-05] - 代码重构:收藏操作逻辑抽取
### 重构
- **收藏操作 Composable** (`src/composables/useCollectOperation.js`)
- 提取重复的收藏/取消收藏逻辑为可复用的 Composable
- 实现乐观更新模式,UI 立即响应,API 失败时自动回滚
- 统一错误处理和用户反馈 (Toast 提示)
- 支持 `meta_id``id` 两种字段格式
- 完整的 JSDoc 注释和使用示例
- 修复运行时模块解析问题 (使用相对路径导入)
### 代码质量提升
- **首页** (`src/pages/index/index.vue`)
- 移除 44 行重复的收藏操作代码
- 使用 `useCollectOperation` Composable 替代
- **资料列表页** (`src/pages/material-list/index.vue`)
- 移除 45 行重复的收藏操作代码
- 使用 `useCollectOperation` Composable 替代
### 影响
- **代码量**: 净减少 82 行代码 (91 行删除, 7 行新增, 1 个新文件)
- **可维护性**: 遵循 DRY 原则,消除代码重复
- **可复用性**: 统一的收藏逻辑可在多页面复用
- **一致性**: 所有收藏操作使用相同的错误处理和用户反馈
---
## [2026-02-05] - 文档模块接口联调完成
### 新增
......