Files
sundynix-pets/pets-fe/pages/home/home.wxml
T
Blizzard 60baff8a2b refactor(fe): Phase A —— tab 换成「我的」,计划降级,设置拆出来
## tab 结构
首页 / 记录 / 报告 / 社区 / 我的。计划从 tab 移出变二级页(导航栏补了
返回键),从「我的 → 养护计划」进。

## 消灭 5 处硬编码
tabBar 高亮原来靠每个 tab 页在 onShow 里写死 selected: 0/1/2/3/4,
调一次顺序就得同时改五个文件,漏一个就高亮错位——这次把计划换成我的
正好会踩到。改成 tabBar 组件在 pageLifetimes.show 里按当前 route 自己
匹配,五处硬编码全删。

## profile 拆成两页
原来的 profile 混了两类东西:「我是谁」和「怎么设置」。拆开:

pages/mine(tab)  个人名片(头像/昵称/签名/关注粉丝记录三个数)
                   + 我的毛孩子列表 + 常用入口 + 齿轮进设置
pages/settings     提醒设置、会员权益、数据导出、意见反馈、关于我们

「我的」上放了个「看看别人眼里的我」,点进去就是 pages/user 那个公开
主页——自己看和别人看必须是同一个页面同一套渲染,否则两边会慢慢长歪。
这也是 Phase D 装扮功能的落点。

首页齿轮从「进 profile」改成「进设置」(个人页已经在 tab 上了)。
旧的 pages/profile 整个删掉,没留兼容层。

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-07-29 17:33:32 +08:00

102 lines
4.6 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<nav-bar title="肉垫计划"></nav-bar>
<view class="top-bar"><pet-switch bind:add="onAddPet"></pet-switch></view>
<scroll-view class="page-scroll" scroll-y="{{true}}" enhanced="{{true}}" show-scrollbar="{{false}}">
<view class="page-body">
<view class="top-row">
<view class="greeting">
<view class="greet-h2">{{summary.greeting || '你好'}}</view>
<view class="greet-p">今天也要照顾好 {{pet.name}}</view>
</view>
<view class="icon-stack">
<view class="icon-btn" data-type="reminders" bindtap="openSheet"><pt-icon name="bell" size="{{36}}"></pt-icon></view>
<view class="icon-btn" bindtap="goSettings"><pt-icon name="settings" size="{{36}}"></pt-icon></view>
</view>
</view>
<!-- 门面:完成度环 + 当下状态。点进去编辑档案 -->
<view class="card hero-card" bindtap="onHeroTap">
<view class="hero-row">
<stat-ring percent="{{summary.health_pct}}" size="{{168}}">
<view class="ring-num">{{summary.health_pct}}<text class="ring-unit">%</text></view>
<view class="ring-cap">完成度</view>
</stat-ring>
<view class="hero-main">
<view class="hero-title">{{pet.name || '还没有毛孩子'}}</view>
<view class="hero-sub">{{pet.id ? undoneText : '点这里建一份档案,任务和提醒会自动排好'}}</view>
<view class="chip-row">
<view wx:for="{{heroChips}}" wx:key="text" class="chip {{item.tone}}">
<pt-icon name="{{item.icon}}" size="{{22}}"></pt-icon>{{item.text}}
</view>
</view>
</view>
</view>
<view class="hero-meta">{{pet.age}}{{pet.weight}}{{pet.stage}}</view>
</view>
<view class="date-strip">
<view wx:for="{{summary.week}}" wx:key="date"
class="day {{item.active ? 'active' : ''}} {{item.date === selectedDate ? 'sel' : ''}} {{item.has_dot ? 'has-dot' : ''}}"
data-date="{{item.date}}" data-active="{{item.active}}" bindtap="onTapDay">
<text>{{item.weekday}}</text><text class="day-b">{{item.day}}</text>
</view>
</view>
<view class="card">
<view class="section-head">
<view class="sh-title">{{taskLabel}}</view>
<view class="head-links">
<view class="link" data-type="manageTasks" bindtap="openSheet">管理</view>
<view wx:if="{{selectedDate && selectedDate !== todayDate}}" class="link" bindtap="backToToday">回今天</view>
<view wx:else class="link" bindtap="completeTasks">全部完成</view>
</view>
</view>
<view class="task-list">
<view wx:for="{{tasks}}" wx:key="title" class="task {{item.done ? 'done' : ''}}" data-index="{{index}}" bindtap="onTapTask">
<view class="circle"><pt-icon wx:if="{{item.done}}" name="check" size="{{22}}"></pt-icon></view>
<view class="task-text"><text class="tt-b">{{item.title}}</text><view wx:if="{{item.sub}}" class="tt-p">{{item.sub}}</view></view>
<view wx:if="{{item.priority}}" class="priority">{{item.priority}}</view>
</view>
<view wx:if="{{tasks.length === 0}}" class="empty">这天没有任务记录</view>
</view>
</view>
<view class="card">
<view class="section-head">
<view class="sh-title">快速记录</view>
<view class="link" bindtap="goRecord">更多</view>
</view>
<view class="quick-grid">
<view wx:for="{{quickItems}}" wx:key="type" class="quick {{item.tone}}" data-type="{{item.type}}" bindtap="openSheet">
<pt-icon name="{{item.icon}}" size="{{44}}"></pt-icon>{{item.label}}
</view>
</view>
</view>
<view class="card">
<view class="section-head">
<view class="sh-title">AI 今日建议</view>
</view>
<view class="ai-text">{{summary.advice || '正在生成今日建议…'}}</view>
<view class="btn btn-dark btn-block ai-cta" bindtap="onFab">
<pt-icon name="ai" size="{{32}}"></pt-icon>问问 AI 养宠助手
</view>
</view>
<view class="card">
<view class="section-head">
<view class="sh-title">新手内容</view>
<view class="link" bindtap="goLearn">查看</view>
</view>
<view wx:if="{{firstArticle}}" class="article-card no-shadow" style="margin-bottom:0" bindtap="openFirstArticle">
<view class="article-icon"><pt-icon name="{{firstArticle.icon}}" size="{{48}}" fallback="book"></pt-icon></view>
<view><text class="ac-b">{{firstArticle.title}}</text><view class="ac-p">{{firstArticle.desc}}</view></view>
</view>
</view>
</view>
</scroll-view>
<fab bind:tap="onFab"></fab>
<bottom-sheet show="{{sheetShow}}" type="{{sheetType}}" bind:close="closeSheet" bind:saved="onSheetSave"></bottom-sheet>