修改用户修改信息

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

View File

@ -60,6 +60,26 @@ export default {
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",