Files
sundynix-pets/pets-fe/pages/mine/mine.js
T
Blizzard f417962453 chore(prod): 移除全部社区/社交相关前端代码(过审用)
- 删除页面:community(社区)、comments(评论)、user(他人主页)、relations(关注/粉丝)
- app.json 去掉四个页面注册与社区 tab;tabBar 只剩 首页/报告/我的
- bottom-sheet 移除发帖(createPost)与评论(comments)整块 UI 及对应 JS/数据/常量
- profile-head 移除帖子/关注/粉丝社交数与关注按钮
- mine 去掉「我的帖子」「别人眼里的我」及关注/粉丝跳转
- api.js 移除 posts/comments/follow/relations 等社区接口(保留 userCard 供我的页头部)

说明:后端社区接口未动(微信审核只看小程序包,前端已无任何引用);
完整社区代码保留在 feat/dev 分支与 git 历史。

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

72 lines
2.1 KiB
JavaScript

const store = require('../../utils/store.js');
const api = require('../../utils/api.js');
const { toastErr } = require('../../utils/ui.js');
const { syncTabBar } = require('../../utils/tabbar.js');
Page({
data: { user: {}, pets: [], card: null, sheetShow: false, sheetType: '' },
onLoad() {
this._unsub = store.subscribe(() => this.applyUser());
},
onUnload() {
if (this._unsub) this._unsub();
},
onShow() {
syncTabBar(this);
store
.ready()
.then(() => {
this.applyUser();
this.loadCard();
})
.catch((e) => toastErr(e));
},
applyUser() {
this.setData({ pets: store.getPets(), user: store.getUser() || {} });
},
// 头部数据走 /users/:id/profile,和别人看我时是同一个接口——
// 换成 /user/summary 的话两边字段会对不上,装扮效果也预览不到
loadCard() {
const uid = (this.data.user && this.data.user.id) || '';
if (!uid) return;
api
.userCard(uid)
.then((card) => this.setData({ card }))
.catch(() => {});
},
goSettings() {
wx.navigateTo({ url: '/pages/settings/settings' });
},
// 宠物档案:当前这只的编辑页
goPetForm() {
const id = store.currentPetId();
if (!id) return wx.navigateTo({ url: '/pages/petform/petform' });
wx.navigateTo({ url: '/pages/petform/petform?id=' + id });
},
goDecorate() {
wx.navigateTo({ url: '/pages/decorate/decorate' });
},
goPlan() {
wx.navigateTo({ url: '/pages/plan/plan' });
},
// 列表行传 dataset,宠物名片墙传 detail,两边都进这里
onPickPet(e) {
const id = (e.detail && e.detail.id) || e.currentTarget.dataset.id;
if (!id) return;
store.switchPet(id);
wx.switchTab({ url: '/pages/home/home' });
},
openSheet(e) {
this.setData({ sheetType: e.currentTarget.dataset.type, sheetShow: true });
},
closeSheet() {
this.setData({ sheetShow: false });
},
onAddPet() {
wx.navigateTo({ url: '/pages/petform/petform' });
},
onShareAppMessage() {
return { title: '肉垫计划 · 每天照顾好毛孩子', path: '/pages/home/home' };
},
});