基本重构完成

This commit is contained in:
lik
2026-10-07 14:55:06 +08:00
parent f655c906f5
commit f0adf77a41
23 changed files with 1284 additions and 685 deletions
+5 -2
View File
@@ -130,8 +130,11 @@ Page({
API.user.update(updateData)
.then((data) => {
if (data.code === 0) {
// 回写全局对象:「我的」页 onShow 依赖它刷新头像行与资料
app.globalData.user = data.data.user
// 回写全局对象:「我的」页 onShow 依赖它刷新头像行与资料。
// 不能整替——/user/update 的响应是脱敏用户(security.token 已被删掉),
// 整替会把本机 token 抹掉,之后所有接口都变成未登录。security 保留本地那份
const prev = app.globalData.user || {}
app.globalData.user = { ...prev, ...data.data.user, security: prev.security || {} }
wx.showToast({ title: '保存成功', icon: 'success' })
// 返回上一页(「我的」),由它的 onShow 重新读取全局对象
wx.navigateBack()