From 571b877853d880d9675b89cd7e3131734af757c3 Mon Sep 17 00:00:00 2001 From: shijingjing <1789544664@qq.com> Date: Tue, 14 Mar 2023 10:36:59 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B2=E9=9D=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/project/qujing/AppMine/AppMine.vue | 3 +- src/project/qujing/AppMine/userInfo.vue | 103 +++++++++++++++++++----- 2 files changed, 83 insertions(+), 23 deletions(-) diff --git a/src/project/qujing/AppMine/AppMine.vue b/src/project/qujing/AppMine/AppMine.vue index e26131a..d46ffb8 100644 --- a/src/project/qujing/AppMine/AppMine.vue +++ b/src/project/qujing/AppMine/AppMine.vue @@ -5,7 +5,7 @@
- +
@@ -16,7 +16,6 @@
diff --git a/src/project/qujing/AppMine/userInfo.vue b/src/project/qujing/AppMine/userInfo.vue index 9c9d9dc..c5f8bc0 100644 --- a/src/project/qujing/AppMine/userInfo.vue +++ b/src/project/qujing/AppMine/userInfo.vue @@ -5,35 +5,39 @@

头像

用户昵称

-
-
+
+
{{ user.nickName }}
- +

手机号

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

{{ user.phone || '' }}

+
+

姓名

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

身份证号

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

地区

-
{{ user.areaName || '' }}
+
{{ user.areaName || '' }}
@@ -54,11 +58,21 @@ export default { ...mapState(['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() { @@ -74,11 +88,29 @@ export default { data() { return { editNickName: false, - user: {} + user: {}, + editPhone: false, + avatar: '', + userName: '', + userPhone: '' } }, methods: { ...mapActions(['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({ @@ -90,6 +122,7 @@ export default { Authorization: uni.getStorageSync('token') }, success: uploadFileRes => { + this.avatar = JSON.parse(uploadFileRes.data).data[0].split(';')[0] resolve(uploadFileRes) }, fail: err => { @@ -115,9 +148,29 @@ export default { } }) }, + handleWeixin({ detail }) { + if (detail.value) { + this.phone = detail.value + this.updateInfo() + } + setTimeout(() => { + this.getUserInfo() + }, 500) + }, handleWeixinSync({detail}) { const {value: nickName, avatarUrl} = detail this.autoLogin({nickName, avatarUrl}) + if (avatarUrl?.length) { + this.upLoad(avatarUrl).then(() => { + this.updateInfo() + }) + } + if (nickName) { + this.updateInfo() + } + setTimeout(()=> { + this.getUserInfo() + }, 500) }, getUserInfo() { this.$instance.post(`/app/appwechatuserqujing/check`).then(res=> { @@ -137,10 +190,12 @@ export default { background-color: #F4F5FA; .info-list { - padding: 50px 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; } @@ -151,25 +206,31 @@ export default { width: 100%; box-sizing: content-box; display: flex; - justify-content: space-between; - font-size: 30px; p { - font-family: PingFangSC-Regular; - color: #666; + color: #333; + font-weight: 400; + width: 200px; } div { - font-family: PingFangSC-Medium; - font-weight: 500; - color: #333; + color: #666; + 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 {