From ca0563e4700f3ace49f3d8bc7af00d2af8fcfb48 Mon Sep 17 00:00:00 2001 From: shijingjing <1789544664@qq.com> Date: Mon, 13 Mar 2023 16:18:17 +0800 Subject: [PATCH] =?UTF-8?q?=E6=85=A7=E6=B2=BB=E7=90=86=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E4=B8=AA=E4=BA=BA=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/mods/extra/AppMine/userInfo.vue | 7 +- src/project/huizhili/AppMine/AppMine.vue | 2 +- src/project/huizhili/AppMine/userInfo.vue | 83 +++++++++++++++++++---- 3 files changed, 75 insertions(+), 17 deletions(-) diff --git a/src/mods/extra/AppMine/userInfo.vue b/src/mods/extra/AppMine/userInfo.vue index c812404..ff50951 100644 --- a/src/mods/extra/AppMine/userInfo.vue +++ b/src/mods/extra/AppMine/userInfo.vue @@ -6,12 +6,13 @@

头像

用户昵称

-

{{ user.nickName }}

+

{{ user.nickName || '' }}

@@ -20,7 +21,7 @@

手机号

-

{{ user.phone }}

+

{{ user.phone || ''}}

@@ -101,7 +102,6 @@ export default { }, 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 => { @@ -172,7 +172,6 @@ export default { width: 100%; box-sizing: content-box; display: flex; - justify-content: space-between; p { color: #333; diff --git a/src/project/huizhili/AppMine/AppMine.vue b/src/project/huizhili/AppMine/AppMine.vue index 71039b0..ad72328 100644 --- a/src/project/huizhili/AppMine/AppMine.vue +++ b/src/project/huizhili/AppMine/AppMine.vue @@ -5,7 +5,7 @@
- +
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 @@

头像

用户昵称

-
-

+

+

{{ user.nickName || ''}}

- +

手机号

-
{{ user.phone || '' }}
+
+

{{ user.phone || '' }}

+
+
+
@@ -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 {