Files
sundynix-pets/pets-fe/components/profile-head/index.js
T
Blizzard 4c9fbc4a88 fix(fe+be): 我的页去重宠物墙 + 养宠天数按到家日算
- 养宠天数原来按建档日算,重新建档会被重置成 1(和首页「第869天」矛盾);
  改成按最早那只的到家日算(无到家日退建档日),和首页口径一致
- 「我的」页 profile-head 传 hideWall,藏掉社交宠物墙(下面「我的毛孩子」
  卡更详细,重复了);宠物墙只在别人访问/预览时出现,受「展示我的毛孩子」
  开关控制,语义更对(那开关本来就是给别人看的)

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-07-31 15:11:59 +08:00

38 lines
1.2 KiB
JavaScript

// 个人主页头部。「我的」和「宠友主页」共用同一份渲染——自己看和别人看
// 长得不一样的话,两边会慢慢长歪,装扮功能也就失去意义了。
// 差别只有一处:自己看是「装扮主页」,别人看是「关注 TA」。
Component({
options: { addGlobalClass: true },
properties: {
card: { type: Object, value: null },
// 装扮页的实时预览:只看效果,不要底部那排按钮
preview: { type: Boolean, value: false },
hideWall: { type: Boolean, value: false }, // 「我的」页藏掉社交宠物墙,避免和「我的毛孩子」卡重复
},
data: { initial: '', theme: 'warm' },
observers: {
card(c) {
if (!c) return;
this.setData({
// WXML 取不了字符串下标,首字得在 JS 里算
initial: (c.nickname || '?').slice(0, 1),
theme: c.theme || 'warm',
});
},
},
methods: {
onFollow() {
this.triggerEvent('follow');
},
onDecorate() {
this.triggerEvent('decorate');
},
onRelations(e) {
this.triggerEvent('relations', { kind: e.currentTarget.dataset.kind });
},
onPet(e) {
this.triggerEvent('pet', { id: e.currentTarget.dataset.id });
},
},
});