diff --git a/docs/superpowers/plans/2026-08-27-mine-records-plan.md b/docs/superpowers/plans/2026-08-27-mine-records-plan.md new file mode 100644 index 0000000..97ba723 --- /dev/null +++ b/docs/superpowers/plans/2026-08-27-mine-records-plan.md @@ -0,0 +1,291 @@ +# 我的出行记录合并 Implementation Plan + +> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking. + +**Goal:** 在 MiniAPP「我的」页面中,把固定的“用车需求”入口和本地“最近浏览”列表收敛到一个“我的出行记录”模块。 + +**Architecture:** 保留 `RecentlyViewedItem` 和本地存储结构不变,在现有 `MineRecentViews.vue` 内把“用车需求”作为第一条固定操作项,再渲染最近浏览项或空态。通过 `MineMember.vue` 透传一个 `open-vehicle` 事件,由 `mine/index.vue` 调用现有 `goVehicleDemand()`,不新增 API、后端查询或数据库字段。 + +**Tech Stack:** Vue 3 ` +``` + +- [ ] **Step 2: Run the focused test to verify the component contract passes** + +Run: + +```powershell +yarn test tests/mine-records.test.ts +``` + +Expected: the first test passes; the parent wiring test remains red until Task 3. + +### Task 3: Wire the vehicle action through the existing navigation guard + +**Files:** +- Modify: `WonderQ-MiniAPP/src/pages/mine/components/MineMember.vue` +- Modify: `WonderQ-MiniAPP/src/pages/mine/index.vue` +- Read: `WonderQ-MiniAPP/src/lib/navigation.ts` + +- [ ] **Step 1: Expose the event from MineMember** + +In `MineMember.vue`, add the listener to the existing `MineRecentViews` instance: + +```vue + +``` + +Add the matching event to `defineEmits`: + +```ts +const emit = defineEmits<{ + "request-avatar": []; + "open-concierge": []; + "open-play": []; + "open-vehicle": []; + "select-recent": [item: RecentlyViewedItem]; + logout: []; +}>(); +``` + +- [ ] **Step 2: Bind the event to goVehicleDemand in the page** + +In `mine/index.vue`, add `@open-vehicle="goVehicleDemand"` to `MineMember`: + +```vue + @open-concierge="goConcierge" + @open-play="goPlay" + @open-vehicle="goVehicleDemand" + @select-recent="openRecent" + @logout="logout" /> +``` + +Add the existing navigation function to the import list without changing its implementation: + +```ts +import { + goConcierge, + goPlay, + goVehicleDemand, + goTeamBuildingDetail, + goWanfaRouteDetail, + goWildArchiveDetail, +} from "@/lib/navigation"; +``` + +This preserves `goVehicleDemand()`'s current `requireLogin()` behavior and `/pages/vehicle-demand` target. + +- [ ] **Step 3: Run the focused integration test** + +Run: + +```powershell +yarn test tests/mine-records.test.ts +``` + +Expected: PASS with both tests passing. + +### Task 4: Verify the MiniAPP change and review the diff + +**Files:** +- Verify: `WonderQ-MiniAPP/src/pages/mine/components/MineRecentViews.vue` +- Verify: `WonderQ-MiniAPP/src/pages/mine/components/MineMember.vue` +- Verify: `WonderQ-MiniAPP/src/pages/mine/index.vue` +- Verify: `WonderQ-MiniAPP/tests/mine-records.test.ts` + +- [ ] **Step 1: Run all MiniAPP unit tests** + +Run from `D:\www\znkj\WonderQ-Project\WonderQ-MiniAPP`: + +```powershell +yarn test +``` + +Expected: all existing tests and `mine-records.test.ts` pass. + +- [ ] **Step 2: Run the MiniAPP typecheck and H5 build** + +```powershell +yarn build:h5 +``` + +Expected: `vue-tsc --noEmit` and the H5 build complete successfully. + +- [ ] **Step 3: Run the WeChat Mini Program build** + +```powershell +yarn build:mp-weixin +``` + +Expected: the Mini Program build completes and emits `dist/build/mp-weixin`. + +- [ ] **Step 4: Inspect the final diff and confirm scope** + +Run from `D:\www\znkj\WonderQ-Project`: + +```powershell +git diff -- WonderQ-MiniAPP/src/pages/mine/components/MineRecentViews.vue WonderQ-MiniAPP/src/pages/mine/components/MineMember.vue WonderQ-MiniAPP/src/pages/mine/index.vue WonderQ-MiniAPP/tests/mine-records.test.ts +git status --short +``` + +Expected: only the three Mine-related source files and the new focused test are part of this implementation; existing unrelated backend and home-page changes remain untouched. Confirm no new SFC `