修改用户修改信息
This commit is contained in:
parent
e24a6d941e
commit
2303d3e193
@ -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",
|
||||||
|
Loading…
Reference in New Issue
Block a user