Files
sundynix-pets/pets-fe/components/profile-head/index.js
T
Blizzard b49bf0f0f9 feat(fe): 隐藏社区 tab(只留首页/报告/我的)+ 别人主页关注粉丝不可再点开
- custom-tab-bar 去掉社区入口(页面与 app.json 注册保留,加回一行即可恢复)
- profile-head 新增 relationsClickable,别人主页传 false:从关注/粉丝列表进对方
  主页后,对方的关注/粉丝数字只展示不可点开,避免无限套娃;「我的」页不受影响

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-04 09:51:09 +08:00

42 lines
1.6 KiB
JavaScript

// 个人主页头部。「我的」和「宠友主页」共用同一份渲染——自己看和别人看
// 长得不一样的话,两边会慢慢长歪,装扮功能也就失去意义了。
// 差别只有一处:自己看是「装扮主页」,别人看是「关注 TA」。
Component({
options: { addGlobalClass: true },
properties: {
card: { type: Object, value: null },
// 装扮页的实时预览:只看效果,不要底部那排按钮
preview: { type: Boolean, value: false },
hideWall: { type: Boolean, value: false }, // 「我的」页藏掉社交宠物墙,避免和「我的毛孩子」卡重复
// 关注/粉丝数字是否可点开列表。别人主页设 false:从关注/粉丝列表点进对方主页后,
// 不再允许打开对方的关注/粉丝,否则会无限套娃
relationsClickable: { type: Boolean, value: true },
},
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) {
if (!this.data.relationsClickable) return; // 别人主页:只看数字,不给点开列表
this.triggerEvent('relations', { kind: e.currentTarget.dataset.kind });
},
onPet(e) {
this.triggerEvent('pet', { id: e.currentTarget.dataset.id });
},
},
});