diff --git a/pages/mine/update.vue b/pages/mine/update.vue index 7b97713..57880b3 100644 --- a/pages/mine/update.vue +++ b/pages/mine/update.vue @@ -53,13 +53,33 @@ export default { } }; }, - onLoad() { + onLoad() { // Get system info for status bar height const systemInfo = wx.getSystemInfoSync(); this.statusBarHeight = systemInfo.statusBarHeight; this.getUserInfoFromCache(); }, methods: { + async userInfoFun(){ //获取用户详情 + try { + const res = await uni.request({ + url: BASE_API_URL + '/api/front/user/info', + method: "GET", + header: { + "Content-Type": "application/x-www-form-urlencoded", // 关键配置 + "Authorization": uni.getStorageSync("userInfo")?.token || "" + } + }); + const userInfo = uni.getStorageSync("userInfo"); + userInfo.avatar = res.data.avatar + userInfo.nikeName = res.data.nikeName + uni.setStorageSync("userInfo",userInfo); + console.log("修改信息",userInfo) + } catch (error) { + console.error("查询用户详情失败:", error); + + } + }, avatarFun() { if (this.userInfo.avatar) { return this.avatarUrl + this.userInfo.avatar; @@ -128,6 +148,11 @@ export default { uni.showToast({ title: "修改成功" }); + + //登录 + this.userInfoFun() + + setTimeout(() => { uni.reLaunch({ url: "/pages/mine/index",