diff --git a/docs/superpowers/plans/2026-06-02-data-dashboard-frontend.md b/docs/superpowers/plans/2026-06-02-data-dashboard-frontend.md index 21fb430..19dc46c 100644 --- a/docs/superpowers/plans/2026-06-02-data-dashboard-frontend.md +++ b/docs/superpowers/plans/2026-06-02-data-dashboard-frontend.md @@ -326,7 +326,21 @@ export const dashboardApi = { } ``` -- [ ] **Step 3: 手动验证 mock 触发** +- [ ] **Step 3: 打开 `USE_MOCK_API` 开关(关键前置步骤)** + +> **重要**:项目 `frontend/utils/api.js` 第 9 行 `USE_MOCK_API` 默认是 `false`,会直接请求真实后端。后端尚未实现,必须先翻成 `true` 才能用 mock 验证。 + +修改 `frontend/utils/api.js`: +```javascript +// 第 9 行: +// 原始: const USE_MOCK_API = false +// 改为: +const USE_MOCK_API = true +``` + +> **切回真实接口**:后端 `/api/v1/dashboard/*` 7 个接口联调通过后,把这里改回 `false` 即可。 + +- [ ] **Step 4: 手动验证 mock 触发** 在 H5 dev console 跑: ```js @@ -335,11 +349,11 @@ const today = await dashboardApi.getTodayOverview(1) console.log(today) // 预期: { crystal_balance: 2713, today_income: 213, week_rank: 12 } ``` -- [ ] **Step 4: Commit** +- [ ] **Step 5: Commit** ```bash git add frontend/utils/mock/dashboard.js frontend/utils/api.js -git commit -m "feat(dashboard): 追加 mock 数据工厂 + dashboardApi 命名空间" +git commit -m "feat(dashboard): 追加 mock 数据工厂 + dashboardApi 命名空间 + 打开 USE_MOCK_API" ``` --- @@ -1164,9 +1178,7 @@ git commit -m "feat(dashboard): CrystalOverview 双卡(水晶余额+今日收 @@ -2045,7 +2060,7 @@ export default { backdrop-filter: blur(10px); border-radius: 22rpx; padding: 24rpx; - margin: 24r 0; + margin: 24rpx 0; box-shadow: 0px 4px 4px rgba(0, 0, 0, 0.15); } @@ -2631,26 +2646,16 @@ git commit -m "feat(dashboard): UpcomingUpgrades + RecentUpgrades 双列布局" --- + ## Task 13: onShow 刷新 + Tab 缓存 + 下拉刷新 **Files:** -- Modify: `frontend/pages/dashboard/dashboard.vue` -- Modify: `frontend/pages.json`(启用下拉刷新) +- Modify: `frontend/pages/dashboard/dashboard.vue`(整文件重写为完整版) +- Modify: `frontend/pages.json`(**不**启用 `enablePullDownRefresh`;下拉刷新由 scroll-view 的 `:refresher-enabled` 接管,避免双触发冲突) -- [ ] **Step 1: 在 `uni.scss` 中追加 page-bg CSS 类** +- [ ] **Step 1: 整文件替换 `frontend/pages/dashboard/dashboard.vue`** -在 `uni.scss` 末尾 dashboard token 段后追加: -```scss -/* dashboard 页面背景(CSS 类,组件用 class 引用,避免 inline 重复) */ -.dashboard-page-bg { - background: linear-gradient(153deg, #FF9597 0%, #80DFFF 33%, #B8B8B8 74%, #D9D9D9 100%); - min-height: 100vh; -} -``` - -- [ ] **Step 2: 重写 `frontend/pages/dashboard/dashboard.vue`(含 onShow + scroll-view + class 引用)** - -完整文件内容: +**直接用以下完整内容覆盖整个文件**(删除 Task 4 写入的占位版本、Task 6/8/9/10/12 追加挂载的中间版本): ```vue -``` - -**关于 onShow 的关键说明**:uni-app 的 `onShow` 是 Options API 生命周期钩子,**必须在 `export default` 顶层声明**(不在 `setup` 内)。完整 onShow 实现: - -在 ` -- [ ] **Step 3: 在 ` ``` -> **删掉** `dashboard.vue` 现有的 `.dashboard-container`、`.dashboard-content`、`.placeholder-*`、`.season-placeholder` 旧样式(被 `