diff --git a/src/project/huizhili/AppMine/userInfo.vue b/src/project/huizhili/AppMine/userInfo.vue
index 0b2f064..c053734 100644
--- a/src/project/huizhili/AppMine/userInfo.vue
+++ b/src/project/huizhili/AppMine/userInfo.vue
@@ -5,22 +5,27 @@
@@ -40,11 +45,21 @@ export default {
...mapState(['user', 'token']),
nickName: {
set(v) {
+ this.userName = v
},
get() {
const {nickName} = this.user
return nickName
}
+ },
+ phone: {
+ set(v) {
+ this.userPhone = v
+ },
+ get() {
+ const { phone } = this.user
+ return phone
+ }
}
},
onLoad() {
@@ -52,11 +67,29 @@ export default {
},
data() {
return {
- editNickName: false
+ editNickName: false,
+ editPhone: false,
+ avatar: '',
+ userName: '',
+ userPhone: ''
}
},
methods: {
...mapActions(['getUserInfo', 'autoLogin']),
+ updateInfo() {
+ this.$instance.post(`/app/appwechatuser/update-nickName`, null, {
+ params: {
+ id: this.user.id,
+ nickName: this.userName ? this.userName : this.user.nickName,
+ avatarUrl: this.avatar ? this.avatar : this.user.avatarUrl,
+ phone: this.userPhone ? this.userPhone : this.user.phone,
+ }
+ }).then(res => {
+ if (res?.code == 0) {
+ this.$u.toast('修改成功')
+ }
+ })
+ },
upLoad(img) {
return new Promise((resolve, reject) => {
uni.uploadFile({
@@ -68,6 +101,7 @@ export default {
Authorization: uni.getStorageSync('token')
},
success: uploadFileRes => {
+ this.avatar = JSON.parse(uploadFileRes.data).data[0].split(';')[0]
resolve(uploadFileRes)
},
fail: err => {
@@ -93,9 +127,23 @@ export default {
}
})
},
+ handleWeixin({ detail }) {
+ if (detail.value) {
+ this.phone = detail.value
+ this.updateInfo()
+ }
+ },
handleWeixinSync({detail}) {
const {value: nickName, avatarUrl} = detail
this.autoLogin({nickName, avatarUrl})
+ if (avatarUrl?.length) {
+ this.upLoad(avatarUrl).then(() => {
+ this.updateInfo()
+ })
+ }
+ if (nickName) {
+ this.updateInfo()
+ }
}
}
}
@@ -108,11 +156,14 @@ export default {
background-color: #F5F5F5;
.info-list {
- margin: 0 0 16px 0;
+ padding: 50px 32px 0 32px;
+ box-sizing: border-box;
.item-content {
padding: 0 32px;
+ box-sizing: border-box;
background-color: #fff;
+ border-radius: 32px;
}
.item {
@@ -121,11 +172,11 @@ export default {
width: 100%;
box-sizing: content-box;
display: flex;
- justify-content: space-between;
p {
color: #333;
font-weight: 400;
+ width: 200px;
}
div {
@@ -133,11 +184,19 @@ export default {
font-size: 28px;
}
+ .item-right {
+ width: calc(100% - 200px);
+ text-align: right;
+ font-size: 28px;
+ p {
+ width: 100%;
+ }
+ }
+
.user-img-div {
- width: 104px;
- height: 104px;
- border-radius: 50%;
- overflow: hidden;
+ width: calc(100% - 200px);
+ text-align: right;
+ display: inline-block;
}
.user-img {