feat(fe): 宠物照片替代默认头像,身份卡移到首页门面卡

- 首页/我的/切换条:上传过照片就用照片,没有才退回 emoji
- 报告页分享海报:先异步加载头像再开画,画成圆形头像
- 一起生活的天数改成从到家日期算,没填就显示「-」并可点去补
- 身份卡入口从「我的」页移到首页门面卡右上角

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Blizzard
2026-07-30 17:08:32 +08:00
parent cbfcaada55
commit 11c4d490e6
10 changed files with 79 additions and 22 deletions
+10
View File
@@ -199,6 +199,16 @@ Page({
},
// 去建档页改阶段。改完回来 onShow 会重新拉一次漂移状态,提示自然消失。
// 不在首页直接改:改阶段之后要不要套新方案是同一件事,放在一起做才连贯
// 点「一起生活的天数」空态,去建档页补到家日期
onDaysTap() {
const id = this.data.pet && this.data.pet.id;
if (!this.data.daysTogether && id) wx.navigateTo({ url: '/pages/petform/petform?id=' + id });
},
// 身份卡:门面卡右上角进,用当前宠物
goIDCard() {
const id = this.data.pet && this.data.pet.id;
if (id) wx.navigateTo({ url: '/pages/idcard/idcard?id=' + id });
},
goStageUpdate() {
const id = this.data.pet && this.data.pet.id;
if (id) wx.navigateTo({ url: '/pages/petform/petform?id=' + id });
+8 -2
View File
@@ -21,9 +21,15 @@
<text wx:if="{{zodiac}}">{{zodiac}}</text>
</view>
</view>
<view class="hero-arrow"><pt-icon name="next" size="{{28}}"></pt-icon></view>
<view wx:if="{{pet.id}}" class="hero-idcard" catchtap="goIDCard">
<pt-icon name="user" size="{{30}}"></pt-icon>身份卡
</view>
</view>
<!-- 一起生活的天数从到家日算。没填到家日就显示「-」,点一下去补 -->
<view wx:if="{{pet.id}}" class="hero-days {{daysTogether ? '' : 'hero-days-empty'}}" catchtap="onDaysTap">
<block wx:if="{{daysTogether}}">我们一起生活的第 <text class="hd-n">{{daysTogether}}</text> 天</block>
<block wx:else>还没填到家日期,一起生活的天数显示 <text class="hd-n">-</text></block>
</view>
<view wx:if="{{daysTogether}}" class="hero-days">我们一起生活的第 <text class="hd-n">{{daysTogether}}</text> 天</view>
</view>
<!-- 阶段漂移。系统只负责发现,换不换由用户点 —— 偷偷换会让他莫名发现
+13
View File
@@ -87,3 +87,16 @@
.drift-focus{font-size:var(--fs-sm);color:var(--primary-ink);line-height:1.6;margin-top:6rpx}
.drift-size{font-size:var(--fs-cap);color:var(--primary-dark);opacity:.8;margin-top:6rpx}
.drift-cta{margin-top:var(--sp-4)}
/* 没填到家日期时的天数空态:压成灰、可点去补 */
.hero-days-empty{background:var(--surface-2);color:var(--muted)}
.hero-days-empty .hd-n{color:var(--muted)}
/* 门面卡右上角的身份卡入口。原来那里是个 next 箭头(点整卡进编辑),
身份卡做成小胶囊,和整卡点击分开 */
.hero-idcard{
flex:none;align-self:flex-start;display:flex;align-items:center;gap:4rpx;
padding:8rpx var(--sp-3);border-radius:var(--r-full);
background:var(--primary-soft);color:var(--primary-dark);
font-size:var(--fs-cap);font-weight:var(--fw-b);
}
-6
View File
@@ -56,12 +56,6 @@ Page({
goDecorate() {
wx.navigateTo({ url: '/pages/decorate/decorate' });
},
// 身份卡:当前这只的
goIDCard() {
const id = store.currentPetId();
if (!id) return wx.showToast({ title: '先选一只毛孩子', icon: 'none' });
wx.navigateTo({ url: '/pages/idcard/idcard?id=' + id });
},
goPlan() {
wx.navigateTo({ url: '/pages/plan/plan' });
},
+4 -5
View File
@@ -17,7 +17,10 @@
<view class="link" bindtap="onAddPet"> 添加</view>
</view>
<view wx:for="{{pets}}" wx:key="id" class="pet-row" data-id="{{item.id}}" bindtap="onPickPet">
<view class="pet-emoji">{{item.emoji}}</view>
<view class="pet-emoji">
<image wx:if="{{item.avatar_url}}" class="pet-emoji-img" src="{{item.avatar_url}}" mode="aspectFill"></image>
<block wx:else>{{item.emoji}}</block>
</view>
<view class="pet-info">
<view class="tt-b">{{item.name}}</view>
<view class="tt-p">{{item.age}}{{item.weight}}{{item.stage}}</view>
@@ -33,10 +36,6 @@
<view class="pr-ic"><pt-icon name="user" size="{{34}}"></pt-icon></view>
<text class="pr-label">宠物档案</text><view class="pr-arrow"><pt-icon name="next" size="{{28}}"></pt-icon></view>
</view>
<view class="profile-row" bindtap="goIDCard">
<view class="pr-ic"><pt-icon name="user" size="{{34}}"></pt-icon></view>
<text class="pr-label">身份卡</text><text class="pr-val">可保存、分享</text><view class="pr-arrow"><pt-icon name="next" size="{{28}}"></pt-icon></view>
</view>
<view class="profile-row" bindtap="goPlan">
<view class="pr-ic"><pt-icon name="plan" size="{{34}}"></pt-icon></view>
<text class="pr-label">养护计划</text><view class="pr-arrow"><pt-icon name="next" size="{{28}}"></pt-icon></view>
+2 -1
View File
@@ -1,7 +1,7 @@
.pet-row{display:flex;align-items:center;gap:var(--sp-3);padding:var(--sp-3) 0;border-bottom:1rpx solid var(--line)}
.pet-row:last-child{border-bottom:0}
.pet-emoji{
.pet-emoji{overflow:hidden;
width:76rpx;height:76rpx;border-radius:var(--r-sm);flex:none;
display:flex;align-items:center;justify-content:center;
background:var(--primary-soft);font-size:40rpx;
@@ -9,3 +9,4 @@
.pet-info{flex:1;min-width:0}
.me-preview{margin-bottom:var(--sp-5)}
.pet-emoji-img{width:100%;height:100%;display:block}