fix(fe): 海报预览卡(wxml)也显示真实头像 + 统计周期

之前只改了导出用的 canvas,但弹层里看到的预览卡是 wxml 渲染的,
头像写死 emoji、也没周期。现在预览卡:有照片用照片(poster.pet_avatar_url
兜底 pet.avatar_url)、加「近 7 天 · 日期」周期行,和导出图一致。

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Blizzard
2026-07-31 16:10:42 +08:00
parent 72c5308214
commit 931fb69ef2
2 changed files with 8 additions and 2 deletions
+3 -1
View File
@@ -342,8 +342,10 @@ textarea{display:block;padding:var(--sp-4);line-height:1.6}
.poster-avatar{
width:152rpx;height:152rpx;margin:var(--sp-3) auto var(--sp-3);border-radius:var(--r-lg);
background:linear-gradient(135deg,#FFE5B7,#FFC06B);display:flex;align-items:center;justify-content:center;
font-size:80rpx;box-shadow:var(--sd-1);
font-size:80rpx;box-shadow:var(--sd-1);overflow:hidden;
}
.poster-avatar-img{width:100%;height:100%;display:block}
.poster-period{margin-top:8rpx;font-size:var(--fs-cap);color:var(--primary-ink);font-weight:var(--fw-b)}
.poster-list{
background:rgba(255,255,255,.78);border-radius:var(--r-md);padding:var(--sp-4);margin:var(--sp-4) 0;text-align:left;line-height:1.8;font-size:var(--fs-md);
}
@@ -155,8 +155,12 @@ module.exports.sel = function (map, key, index, def) {
<block wx:elif="{{innerType === 'poster'}}">
<view class="poster">
<view class="poster-h3">{{pet.name}} 的成长报告</view>
<view class="poster-avatar">{{pet.emoji}}</view>
<view class="poster-avatar">
<image wx:if="{{poster.pet_avatar_url || pet.avatar_url}}" class="poster-avatar-img" src="{{poster.pet_avatar_url || pet.avatar_url}}" mode="aspectFill"></image>
<block wx:else>{{pet.emoji}}</block>
</view>
<view class="muted">{{pet.age}}{{pet.weight}}{{pet.stage}}</view>
<view wx:if="{{poster.period}}" class="poster-period">近 7 天 · {{poster.period}}</view>
<view class="poster-list pre">✓ 完成任务 {{poster ? poster.tasks_completed : 0}} 项
✓ 体重记录 {{poster ? poster.weight_records : 0}} 次
✓ 疫苗记录 {{poster ? poster.vaccine_records : 0}} 次