fix(fe): 补齐无宠物状态 + 用户操作失败不再静默

自查发现的四处,都属于「不报错但用户懵」:

1. record/plan/report 三页在 currentPetId 为空时直接 return,留下一堆
   空卡片却不解释——用户以为坏了。加统一的 .no-pet 引导块,说清建档后
   会有什么,并给一个建档按钮。

2. 首页门面卡在没建档时点击会打开「编辑宠物」的空表单。改成没档案就走
   「添加」,文案也跟着变成「点这里建一份档案」。

3. 没建档时在快速记录弹层点「保存」,createAndClose 因为拿不到 petID
   直接 close 掉——用户以为存上了,其实什么都没发生。改成明确提示。

4. 用户主动触发的操作失败不再静默:勾任务、全部完成、勾计划节点、点赞
   四处的 .catch(() => {}) 换成 toast。后台加载类的静默保持不变——
   那些失败了重进页面会自愈,弹 toast 反而是噪音。

事件绑定做了一次全量扫描:18 个 wxml 里所有 bind/catch 绑的方法在对应
js 里都有实现,没有「点了没反应」的死按钮。

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Blizzard
2026-07-29 14:23:58 +08:00
parent 7acdf916d5
commit e446019546
9 changed files with 53 additions and 7 deletions
+2 -2
View File
@@ -16,7 +16,7 @@
<pet-switch bind:add="onAddPet"></pet-switch>
<!-- 门面:完成度环 + 当下状态。点进去编辑档案 -->
<view class="card hero-card" bindtap="onEditPet">
<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>
@@ -24,7 +24,7 @@
</stat-ring>
<view class="hero-main">
<view class="hero-title">{{pet.name || '还没有毛孩子'}}</view>
<view class="hero-sub">{{undoneText}}</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}}