# 代码 vs 设计差异修复计划 > **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:** 修复小程序代码与设计文档(v2.0 + 五维页面重设计)之间的所有差异,使实现完全对齐设计 **架构:** 前端修复为主,涉及 7 个页面/组件和 1 个配置文件。后端补充 Activity 可见性三字段和 Product 游客价格逻辑。分批并行修改:先改 TabBar 和路由等基础设施,再改每个 Tab 页的逻辑 **Tech Stack:** uni-app Vue 2, Spring Boot 2.7 **优先级:** P0(阻塞) > P1(重要) > P2(一般) > P3(优化) --- ## 文件改动清单 | 文件 | 操作 | 职责 | |------|------|------| | `cfc-frontend/pages.json` | 修改 | TabBar 第5个 Tab 改名为"富沛",路径改为 `pages/wealth/index` | | `cfc-frontend/pages/index/index.vue` | 修改 | 移除 teacher-index 路由分支;移除 TeacherIndex import;未登录态商品/活动/文章统一改为 `/api/product/list`;隐藏价格;弹登录提示 | | `cfc-frontend/pages/index/parent-index.vue` | 修改 | 移除五行沙盘;改为服务商入口+代办;增加家庭能量横条(顶部);增加维度商品/活动区块 | | `cfc-frontend/pages/index/child-index.vue` | 修改 | 增加家庭能量横条(顶部);增加维度商品/活动区块;`reLaunch` 改 `switchTab` | | `cfc-frontend/pages/teacher/index.vue` | 废弃 | 整个页面废弃,但保留文件做软删除(用注释标记废弃 + 路由不直达) | | `cfc-frontend/pages/body/index.vue` | 修改 | 游客可见商品/活动(无价格);`BASE_URL` 硬编码改 config | | `cfc-frontend/pages/mind/index.vue` | 修改 | FamilyEnergyBar 传 `dualDimension` 双维度参数实现堆叠图;游客可见商品/活动(无价格) | | `cfc-frontend/pages/action/index.vue` | 修改 | 游客可见商品/活动(无价格);funcList 商城路径修复 | | `cfc-frontend/components/FamilyEnergyBar.vue` | 修改 | 支持 `dualDimension` 属性,当传入时渲染堆叠柱(心+智叠加) | | `cfc-frontend/utils/api.js` | 修改 | 首页/发现页商品接口从 `DANSHOP_BASE` 改为 `/api/product/list` | | `cfc-backend/.../controller/product/ProductController.java` | 修改 | 游客模式:无 token 请求时 price/memberPrice 返回 null | | `cfc-backend/.../entity/Activity.java` | 修改 | 增加 visibility/visibleScope/visibleTo 三字段 | --- ### Task 1: TabBar 第5个 Tab 改为「富沛」 **Files:** - Modify: `cfc-frontend/pages.json:589-626` - [ ] **Step 1: 修改 pages.json TabBar 配置** ```json // 在 pages.json 中找到 tabBar.list 第5项,改为: { "pagePath": "pages/wealth/index", "text": "富沛", "iconPath": "static/tab-wealth.png", "selectedIconPath": "static/tab-wealth-active.png" } ``` 同时确认 `pages/wealth/index` 已在 subPackages 中正确注册(第 560-581 行已存在 `pages/wealth` 子包)。 - [ ] **Step 2: 验证** 确认 `pages.json` wealth 子包已包含 `pages/wealth/index` 页面,确认 `static/tab-wealth.png` 和 `static/tab-wealth-active.png` 图标文件存在。如果不存在,创建 48x48px 的占位图标。 - [ ] **Step 3: 清理旧 Tab 图片引用** 从 `static/` 目录检查是否有 `tab-profile.png` / `tab-profile-active.png`,确认不再被引用。 --- ### Task 2: 首页 index.vue — 移除教师路由 + 未登录态商品接口改造 **Files:** - Modify: `cfc-frontend/pages/index/index.vue` - [ ] **Step 1: 移除 TeacherIndex 引入(第 108 行)** 修改前: ```javascript import TeacherIndex from '../teacher/index.vue' ``` 修改后: ```javascript // TeacherIndex 已废弃,教师功能折入 parent-index ``` 同时从 `components` 对象中移除 `TeacherIndex`。 - [ ] **Step 2: 移除 teacher 路由分支(第 97 行)** 修改前: ```html ``` 修改后: ```html ``` - [ ] **Step 3: 未登录态商品列表改用 /api/product/list** 修改前(第 200 行): ```javascript productList(params).then(res => { ... }) ``` 修改后: ```javascript // 调用 getProductsByDomain 或其他 api.js 中已封装的 /api/product/list ``` - [ ] **Step 4: 未登录态商品隐藏价格(第 44-48 行)** 修改前: ```html ¥{{ item.price }} 会员¥{{ item.memberPrice }} ``` 修改后: ```html ``` - [ ] **Step 5: 未登录态商品点击弹登录提示(第 40 行)** 修改前: ```html @click="goDetail(item.id)" ``` 修改后: ```html @click="handleLogin()" ``` 并在 `handleLogin` 中: ```javascript handleLogin() { uni.showModal({ title: '提示', content: '请先登录后查看详情', success: function(res) { if (res.confirm) uni.navigateTo({ url: '/pages/login/login?redirect=' + encodeURIComponent('/pages/index/index') }) } }) } ``` - [ ] **Step 6: 确保 onShow 中调用 loadProducts()** 确认在 `onShow` 的未登录分支中调用 `this.loadProducts()`,使游客首次进入能看到商品列表。 ```javascript onShow() { if (!this.isLoggedIn()) { this.currentRole = '' this.loadProducts() // 游客加载商品 return } this.syncRoleAndTabBar() } ``` --- ### Task 3: parent-index.vue — 移除沙盘 + 增加服务商入口 + 家庭能量横条 **Files:** - Modify: `cfc-frontend/pages/index/parent-index.vue` - [ ] **Step 1: 移除五行沙盘(第 74-84 行)** 删除整个 `wuxing-sandbox` 组件的实例化和 import。 修改前: ```html ``` 修改后:删除。 - [ ] **Step 2: 顶部增加家庭能量横条 FamilyEnergyBar** 在 Banner 下方增加: ```html ``` 添加对应 import: ```javascript import FamilyEnergyBar from '@/components/FamilyEnergyBar.vue' ``` - [ ] **Step 3: 增加服务商快捷入口(替代废弃的 teacher-index)** 在「待处理事项」区域增加服务商快捷卡片,当用户角色为 `teacher` 或 `role` 包含 `teacher` 时显示: ```html 🔧 服务商工具 👨‍👩‍👧 {{ serviceFamilyCount }} 服务家庭 📝 {{ pendingTaskCount }} 待办任务 💰 ¥{{ todayIncome }} 今日收入 👥 {{ teamCount }} 团队 ``` data 中增加字段:`isTeacher: false`, `serviceFamilyCount: 0`, `pendingTaskCount: 0`, `todayIncome: 0`, `teamCount: 0` - [ ] **Step 4: 增加维度商品/活动推荐区块** 在「成长建议」后面增加: ```html ``` 添加 import:`import DimensionActivities from '@/components/DimensionActivities.vue'` 和 `import DimensionProducts from '@/components/DimensionProducts.vue'` --- ### Task 4: child-index.vue — 增加家庭能量横条 + 维度商品/活动 **Files:** - Modify: `cfc-frontend/pages/index/child-index.vue` - [ ] **Step 1: 在 Banner 下方增加 FamilyEnergyBar** ```html ``` 添加 import:`import FamilyEnergyBar from '@/components/FamilyEnergyBar.vue'` - [ ] **Step 2: 增加维度商品/活动区块** 在「最近能量变动」下方增加: ```html ``` 添加对应 import,data 中增加 `dimensionActivities: [], dimensionProducts: []`,loadData 中调用对应加载方法。 - [ ] **Step 3: reLaunch 改 switchTab(第 432 行)** 修改前: ```javascript uni.reLaunch({ url: '/pages/index/parent-index' }) ``` 修改后: ```javascript uni.switchTab({ url: '/pages/index/index' }) ``` --- ### Task 5: teacher/index.vue — 软废弃 **Files:** - Modify: `cfc-frontend/pages/teacher/index.vue` - [ ] **Step 1: 文件首部添加废弃标记** 在 `