Files
sundynix-pets/pets-fe/pages/plan/plan.wxml
T
Blizzard 535ef08da7 fix: 评论配图整条链路补全 + 宠物切换条吸顶
## 评论图片传了等于没传

上次只做了一半:model 加了 Images 字段、前端做了上传 UI,但
handler 的 commentReq 没有 images、service 的 CreateComment 连
参数都没有,图片上传完就丢了;评论列表也从没渲染过图片。

补齐:请求体 → service 落库(JSON 数组) → 列表回显 → 点击大图预览。
实测带两张图的评论和纯文字评论各存各的,互不影响。

## 宠物切换条吸顶

首页/计划/记录/报告四页的 pet-switch 原本在 scroll-view 里,滚下去
就找不到了。而切宠物是随时要用的动作——多宠用户看着 A 的数据想切到
B,还得先滚回顶部。

移出滚动区,放在导航栏下方做成固定的一条,带毛玻璃和分隔线。首页的
问候语留在滚动区里,滚走就滚走,反正它只在刚进页面时有意义。

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

101 lines
5.7 KiB
Plaintext

<nav-bar title="养宠计划"></nav-bar>
<view class="pet-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 wx:if="{{!pet.id}}" class="no-pet">
<view class="no-pet-ic"><pt-icon name="community" size="{{52}}"></pt-icon></view>
<view class="no-pet-b">还没有毛孩子的档案</view>
<view class="no-pet-p">建好档会按它的年龄阶段自动排好 30 天计划和疫苗驱虫提醒。</view>
<view class="btn btn-dark" bindtap="onAddPet"><pt-icon name="plus" size="{{30}}"></pt-icon>建一份档案</view>
</view>
<seg-tabs variant="solid" items="{{planTabs}}" current="{{planView}}" bind:change="switchPlanView"></seg-tabs>
<!-- 路线图 -->
<view wx:if="{{planView === 'timeline'}}">
<view class="card">
<view class="section-head">
<view class="sh-title">{{pet.name}}的 30 天计划</view>
<view class="tag warn">{{plan.completion_pct || 0}}%</view>
</view>
<view class="progress-row"><text>完成度</text><text>{{plan.completion_pct || 0}}%</text></view>
<view class="bar"><view class="bar-fill" style="width:{{plan.completion_pct || 0}}%"></view></view>
</view>
<view class="timeline">
<view wx:for="{{plan.tasks}}" wx:key="id" class="time-block">
<view class="time-label">{{item.day_label}}<text wx:if="{{item.dateLabel}}" class="time-date">{{item.dateLabel}}</text></view>
<view class="plan-task {{item.done ? 'done' : ''}}">
<view class="pk-check" catchtap="toggleTimelineTask" data-id="{{item.id}}"><pt-icon wx:if="{{item.done}}" name="check" size="{{22}}"></pt-icon></view>
<view class="pk-body" data-type="{{item.sheet_type}}" bindtap="openSheet">
<text class="pk-b">{{item.title}}</text><view class="pk-p">{{item.description}}</view>
</view>
</view>
</view>
<view wx:if="{{!plan}}" class="empty">暂无计划</view>
</view>
</view>
<!-- 日历 -->
<view wx:elif="{{planView === 'calendar'}}">
<view class="calendar">
<view class="cal-head"><text>{{calLabel}}</text><view class="link" data-type="reminders" bindtap="openSheet">提醒</view></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 === selectedCalDate ? 'sel' : ''}}"
data-date="{{item.date}}" bindtap="onTapCalDay">{{item.day || ''}}</view>
</view>
</view>
<view wx:if="{{dayDetail}}" class="day-detail">
<view class="dd-title">{{dayDetail.date}} 的安排</view>
<block wx:if="{{!dayDetail.empty}}">
<view wx:for="{{dayDetail.nodes}}" 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="{{dayDetail.tasks}}" wx:key="title" class="dd-item">
<text class="dd-tag task">任务</text><text class="dd-b {{item.done ? 'done' : ''}}">{{item.title}}</text>
</view>
<view wx:for="{{dayDetail.reminders}}" wx:key="title" class="dd-item">
<text class="dd-tag rem">提醒</text><text class="dd-b">{{item.title}}</text>
</view>
</block>
<view wx:else class="empty">这天没有安排</view>
</view>
</view>
<!-- AI 计划 -->
<view wx:elif="{{planView === 'aiPlan'}}">
<view class="card">
<view class="section-head"><view class="sh-title">AI 计划模式</view><view class="tag purple">Plan</view></view>
<view class="ai-plan-tip">描述 {{pet.name}} 的近况(阶段、近期变化、担心的问题),AI 会提取关键信息并生成可执行计划。</view>
<textarea class="textarea" placeholder="例如:4 个月,刚换粮有点软便,也快打第二针疫苗" placeholder-class="placeholder" value="{{aiInput}}" bindinput="onAiInput"></textarea>
<button class="btn btn-primary btn-block" style="margin-top:16rpx" bindtap="genAIPlan" disabled="{{aiBusy}}">{{aiBusy ? '生成中…' : '生成计划'}}</button>
</view>
<view wx:if="{{aiPlan}}" class="card">
<view class="section-head"><view class="sh-title">已提取信息</view></view>
<view class="extracted">
<view class="extract"><text class="ex-b">阶段</text>{{aiPlan.extracted.stage}}</view>
<view class="extract"><text class="ex-b">风险</text>{{aiPlan.extracted.risk}}</view>
<view class="extract"><text class="ex-b">重点</text>{{aiPlan.extracted.priority}}</view>
<view class="extract"><text class="ex-b">提醒</text>{{aiPlan.extracted.reminder}}</view>
</view>
<view class="section-head" style="margin-top:20rpx"><view class="sh-title">生成的计划</view></view>
<view class="task-list">
<view wx:for="{{aiPlan.tasks}}" wx:key="id" class="task">
<view class="circle"></view>
<view class="task-text"><text class="tt-b">{{item.day_label}}· {{item.title}}</text><view class="tt-p">{{item.description}}</view></view>
</view>
</view>
<button class="btn btn-primary btn-block" style="margin-top:16rpx" bindtap="applyAIPlan">加入我的计划</button>
</view>
</view>
</view>
</scroll-view>
<fab bind:tap="onFab"></fab>
<bottom-sheet show="{{sheetShow}}" type="{{sheetType}}" bind:close="closeSheet"></bottom-sheet>