cecc7f4cbb
## 日期条 → 可展开日历 首页那条七天日期带下面加了「展开整月」。展开后是整月网格(有安排的 日子带绿点),点任意一天,任务卡跟着切到那天。收起来还是七天,默认 不拉日历接口。 这块原来是计划页的「日历」tab,现在从计划页整个摘掉了——「哪天要做 什么」和「今天要做什么」本来就是一件事,分在两个 tab 里只是让人多点 两下。日历样式(.cal-* / .day-detail / .dd-*)跟着从 plan.wxss 搬到 home.wxss,plan.wxss 里没留死规则。 ## 任务卡下面挂当天的计划节点和提醒 day-plan 接口本来就返回 plan_nodes / reminders / tasks 三份。这里只取 前两份,任务列表仍然走 /tasks——因为 /tasks 会补生成当天任务而 day-plan 不会,拿它的 tasks 覆盖列表会让今天的任务凭空少掉。 ## 「接下来」卡 30 天计划里最近 3 个还没做的节点,日期显示成「今天/明天/3 天后」而不是 7月31日。带完成度进度条,右上角「完整计划」进计划页。 计划页降级成二级页之后,这张卡是它在首页的唯一露出;没有它,计划这个 功能对用户来说就等于消失了。 ## AI 计划入口 AI 页快捷区加了「生成养护计划」,直达 /pages/plan/plan?tab=aiPlan。 没有把这个表单搬进 AI 聊天页:它要渲染 extracted 四宫格和可勾选的任务 节点,塞进聊天流意味着同一个页面维护两套完全不同的渲染,收益只是少跳 一次。原本要解决的是「计划页降级后 AI 计划找不到了」,一个入口就够了。 顺带:iconfont 补了 up / down 两个 chevron(展开收起用)。 联调验证(本地 9090,新建幼犬档案): day-plan 今天 → plan_nodes=['确认免疫与驱虫计划'] plan → completion_pct=0,4 个节点,date 字段齐全 接下来筛出 → 07-29 确认免疫与驱虫计划 / 08-01 观察饮水与排便 / 08-05 体重趋势检查 calendar → 2026-7,today=29,tasked_days=[29] day-plan 未来日 → 08-01、08-05 各自返回对应节点 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
145 lines
7.3 KiB
Plaintext
145 lines
7.3 KiB
Plaintext
<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>
|
||
|
||
<!-- 日期带:默认一周,展开成整月。原来这是计划页的「日历」tab,
|
||
但「哪天要做什么」和「今天要做什么」本来就是一件事,分两个 tab 只是让人多点两下 -->
|
||
<view class="date-band">
|
||
<view wx:if="{{!calOpen}}" 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 wx:else class="card cal-card">
|
||
<view class="cal-head"><text>{{calLabel}}</text></view>
|
||
<view class="cal-grid">
|
||
<text class="cal-w">一</text><text class="cal-w">二</text><text class="cal-w">三</text><text class="cal-w">四</text><text class="cal-w">五</text><text class="cal-w">六</text><text class="cal-w">日</text>
|
||
<view wx:for="{{calCells}}" wx:key="index"
|
||
class="cal-cell {{item.today ? 'today' : ''}} {{item.tasked ? 'tasked' : ''}} {{item.day === 0 ? 'blank' : ''}} {{item.date && item.date === selectedDate ? 'sel' : ''}}"
|
||
data-date="{{item.date}}" data-active="{{item.date === todayDate}}" bindtap="onTapDay">{{item.day || ''}}</view>
|
||
</view>
|
||
</view>
|
||
<view class="cal-toggle" bindtap="toggleCal">
|
||
{{calOpen ? '收起' : '展开整月'}}<pt-icon name="{{calOpen ? 'up' : 'down'}}" size="{{24}}"></pt-icon>
|
||
</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 wx:if="{{dayNodes.length || dayReminders.length}}" class="day-detail">
|
||
<view wx:for="{{dayNodes}}" wx:key="title" class="dd-item">
|
||
<text class="dd-tag plan">计划</text><text class="dd-b {{item.done ? 'done' : ''}}">{{item.title}}</text>
|
||
</view>
|
||
<view wx:for="{{dayReminders}}" wx:key="title" class="dd-item" data-type="reminders" bindtap="openSheet">
|
||
<text class="dd-tag rem">提醒</text><text class="dd-b">{{item.title}}</text>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
|
||
<!-- 接下来:30 天计划里最近几个还没做的节点。计划页降级成二级页后,
|
||
这张卡是它在首页的唯一露出,没有它计划就等于消失了 -->
|
||
<view wx:if="{{upcoming.length}}" class="card">
|
||
<view class="section-head">
|
||
<view class="sh-title">接下来</view>
|
||
<view class="link" bindtap="goPlan">完整计划</view>
|
||
</view>
|
||
<view wx:if="{{planPct >= 0}}" class="progress-row"><text>30 天计划完成度</text><text>{{planPct}}%</text></view>
|
||
<view wx:if="{{planPct >= 0}}" class="bar"><view class="bar-fill" style="width:{{planPct}}%"></view></view>
|
||
<view class="up-list">
|
||
<view wx:for="{{upcoming}}" wx:key="id" class="up-item" data-id="{{item.id}}" bindtap="goPlan">
|
||
<view class="up-when">{{item.whenLabel}}</view>
|
||
<view class="up-body"><text class="tt-b">{{item.title}}</text><view wx:if="{{item.description}}" class="tt-p">{{item.description}}</view></view>
|
||
</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>
|