修改回显头像和昵称

This commit is contained in:
张凯 2025-06-13 10:52:06 +08:00
parent f795dd9798
commit dc2e5cb84a

View File

@ -235,14 +235,15 @@
this.phoneNumber = userInfo.mobile
this.niName = userInfo.nickname
this.realname = userInfo.username
this.avatar = uni.getStorageSync('userInfo').avatar
this.avatar = userInfo.avatar
this.$refs.datetimePicker.setFormatter(this.formatter)
// this.handelData()
this.getDetail()
// this.getDetail()
},
onShow() {
this.getSfInfo();
this.getBankList();
this.getDetail();
},
methods: {
getBankList() {
@ -301,7 +302,7 @@
if (res.code == 1) {
uni.setStorageSync('userInfo', {
...uni.getStorageSync('userInfo'),
avatar: avatar
avatar: this.avatar
});
this.getDetail()
this.$refs.uToast.show({
@ -309,9 +310,9 @@
message: '保存成功',
duration: '1000',
complete: function() {
setTimeout(function() {
uni.navigateBack(1)
}, 1000);
// setTimeout(function() {
// uni.navigateBack(1)
// }, 1000);
}
})
} else if (res.code == 0) {
@ -329,29 +330,29 @@
const userinfo = res.data.user_info
uni.setStorageSync('userInfo', res.data.user_info)
uni.setStorageSync("niName", res.data.user_info.nickname)
if (userinfo.birthday !== null) {
this.birthday = userinfo.birthday
}
if (userinfo.work !== null) {
this.zhiYe = userinfo.work
}
if (userinfo.diqu !== null) {
this.area = userinfo.diqu
}
// if (userinfo.birthday !== null) {
// this.birthday = userinfo.birthday
// }
// if (userinfo.work !== null) {
// this.zhiYe = userinfo.work
// }
// if (userinfo.diqu !== null) {
// this.area = userinfo.diqu
// }
if (userinfo.avatar !== null) {
this.avatar = userinfo.avatar
uni.setStorageSync('avatar', this.avatar)
}
if (userinfo.nickname !== null) {
this.nickname = userinfo.nickname
uni.setStorageSync('niName', this.nickname)
}
if (userinfo.gender !== null) {
this.gender = userinfo.gender == '1' ? '男' : '女'
}
if (userinfo.realname !== null) {
this.realname = userinfo.realname
this.niName = userinfo.nickname
uni.setStorageSync('niName', this.niName)
}
// if (userinfo.gender !== null) {
// this.gender = userinfo.gender == '1' ? '' : ''
// }
// if (userinfo.realname !== null) {
// this.realname = userinfo.realname
// }
}
})
},