2026-06-19-homepage-risk-fix.md 3.5 KB

小程序首页功能修复计划

For agentic workers: 使用 superpowers:subagent-driven-development 或 superpowers:executing-plans 来执行此计划。

目标: 修复小程序首页(parent-index / child-index)的实现问题

已由远程 c1ade35 修复(无需操作): Task 2/3/4/5/6/7/8/9/10 ✅

待处理(仅 Task 1): 🔴


Task 1: 修复 FamilyEnergyBar 硬编码未注册页面路径(A1)

优先级: 🔴 高(运行时 404)

文件: cfc-frontend/components/FamilyEnergyBar.vue

问题定位

L134-139:

var detailPages = {
  body:   '/pages/body/member-body-detail',
  mind:   '/pages/mind/member-mind-detail',
  wisdom: '/pages/mind/member-mind-detail',   // ⚠️ wisdom 和 mind 共用同一页
  action: '/pages/action/member-action-detail'
}

member-body-detail、member-mind-detail、member-action-detail 这 3 个页面未在 pages.json 中注册,点击成员行直接 404。

修复方案

选项 A(推荐): 在 pages.json 中注册这 3 个成员详情页面(需要评估是否有对应的 Vue 文件存在)。

选项 B(保守): 将 onMemberClick 方法中的跳转改为 uni.showToast({ title: '功能即将上线', icon: 'none' }),阻止 404。

  • [ ] Step 1: 确认目标页面文件是否存在于 pages/ 目录

    ls /root/cfc/cfc-frontend/pages/body/member-body-detail* 2>/dev/null || echo "NOT FOUND"
    ls /root/cfc/cfc-frontend/pages/mind/member-mind-detail* 2>/dev/null || echo "NOT FOUND"
    ls /root/cfc/cfc-frontend/pages/action/member-action-detail* 2>/dev/null || echo "NOT FOUND"
    
  • [ ] Step 2: 根据 Step 1 结果选择修复路径

若文件存在但未注册(选项 A): 在 pages.json 中补充注册:

{
  "path": "pages/body/member-body-detail/index",
  "style": { "navigationBarTitleText": "身体详情" }
},
{
  "path": "pages/mind/member-mind-detail/index",
  "style": { "navigationBarTitleText": "心智详情" }
},
{
  "path": "pages/action/member-action-detail/index",
  "style": { "navigationBarTitleText": "行动详情" }
}

然后检查对应组件是否完整实现,若不完整则标记后续任务。

若文件不存在(选项 B): 将 L133-145 替换为:

onMemberClick: function(member) {
  // TODO: 注册 member-xxx-detail 页面后替换为真实跳转
  uni.showToast({
    title: '家庭成员详情功能即将上线',
    icon: 'none',
    duration: 2000
  })
},
  • [ ] Step 3: 验证 pages.json 中无重复注册

    grep -n "member-body-detail\|member-mind-detail\|member-action-detail" /root/cfc/cfc-frontend/pages.json
    

执行验证

Step 1: 确认目标页面文件是否存在

ls /root/cfc/cfc-frontend/pages/body/member-body-detail* 2>/dev/null || echo "NOT FOUND"
ls /root/cfc/cfc-frontend/pages/mind/member-mind-detail* 2>/dev/null || echo "NOT FOUND"
ls /root/cfc/cfc-frontend/pages/action/member-action-detail* 2>/dev/null || echo "NOT FOUND"

Step 2: 根据结果选择修复路径(见 Task 1 描述)

编译验证

cd /root/cfc/cfc-backend && mvn clean compile -q

前端语法检查

cd /root/cfc/cfc-frontend && npm run build:mp-weixin 2>&1 | grep -E "ERROR|error" | head -20

微信开发者工具验证

  • 家长账号 → 首页 → 点击能量横条成员行 → 不再 404

回退方案

git checkout cfc-frontend/components/FamilyEnergyBar.vue