修改用户修改信息

This commit is contained in:
18796357645 2025-07-19 15:21:32 +08:00
parent e24a6d941e
commit 2303d3e193

View File

@ -53,13 +53,33 @@ export default {
} }
}; };
}, },
onLoad() { onLoad() {
// Get system info for status bar height // Get system info for status bar height
const systemInfo = wx.getSystemInfoSync(); const systemInfo = wx.getSystemInfoSync();
this.statusBarHeight = systemInfo.statusBarHeight; this.statusBarHeight = systemInfo.statusBarHeight;
this.getUserInfoFromCache(); this.getUserInfoFromCache();
}, },
methods: { 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() { avatarFun() {
if (this.userInfo.avatar) { if (this.userInfo.avatar) {
return this.avatarUrl + this.userInfo.avatar; return this.avatarUrl + this.userInfo.avatar;
@ -128,6 +148,11 @@ export default {
uni.showToast({ uni.showToast({
title: "修改成功" title: "修改成功"
}); });
//
this.userInfoFun()
setTimeout(() => { setTimeout(() => {
uni.reLaunch({ uni.reLaunch({
url: "/pages/mine/index", url: "/pages/mine/index",