diff --git a/src/mods/extra/AppMine/userInfo.vue b/src/mods/extra/AppMine/userInfo.vue
index 0b2f064..5957db2 100644
--- a/src/mods/extra/AppMine/userInfo.vue
+++ b/src/mods/extra/AppMine/userInfo.vue
@@ -5,7 +5,8 @@
头像
@@ -45,18 +46,33 @@ export default {
const {nickName} = this.user
return nickName
}
- }
+ },
},
onLoad() {
this.getUserInfo()
+
},
data() {
return {
- editNickName: false
+ editNickName: false,
+ avatar: '',
}
},
methods: {
...mapActions(['getUserInfo', 'autoLogin']),
+ updateInfo() {
+ this.$instance.post(`/app/appwechatuser/update-nickName`,null,{
+ params: {
+ id: this.user.id,
+ nickName: this.nickName,
+ avatarUrl: this.avatar? this.avatar : this.user.avatarUrl,
+ }
+ }).then(res=> {
+ if(res?.code==0) {
+ this.$u.toast('修改成功')
+ }
+ })
+ },
upLoad(img) {
return new Promise((resolve, reject) => {
uni.uploadFile({
@@ -68,6 +84,8 @@ export default {
Authorization: uni.getStorageSync('token')
},
success: uploadFileRes => {
+ this.avatar = JSON.parse(uploadFileRes.data).data[0].split(';')[0]
+ console.log(JSON.parse(uploadFileRes.data).data[0].split(';')[0])
resolve(uploadFileRes)
},
fail: err => {
@@ -94,8 +112,16 @@ export default {
})
},
handleWeixinSync({detail}) {
- const {value: nickName, avatarUrl} = detail
- this.autoLogin({nickName, avatarUrl})
+ const { value: nickName, avatarUrl } = detail
+ this.autoLogin({ nickName, avatarUrl })
+ if(avatarUrl?.length) {
+ this.upLoad(avatarUrl).then(() => {
+ this.updateInfo()
+ })
+ }
+ if(nickName) {
+ this.updateInfo()
+ }
}
}
}