From 7bd8c1f2d4dbb65982fd50cae7a3341ab9f6c2f1 Mon Sep 17 00:00:00 2001 From: liuye Date: Thu, 11 May 2023 09:01:00 +0800 Subject: [PATCH] =?UTF-8?q?Revert=20"=E4=B8=AA=E4=BA=BA=E4=B8=AD=E5=BF=83"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 2f37357bf1d6093f33fb522f2ac3fb3a2ef2e10c. --- src/project/wuxi/AppMine/AppMine.vue | 171 +++++++----------- src/project/wuxi/AppMine/myFamily.vue | 180 ++++++++++++++++++ src/project/wuxi/AppMine/userInfo.vue | 251 ++++++++------------------ 3 files changed, 320 insertions(+), 282 deletions(-) create mode 100644 src/project/wuxi/AppMine/myFamily.vue diff --git a/src/project/wuxi/AppMine/AppMine.vue b/src/project/wuxi/AppMine/AppMine.vue index 4270917..1f09fb2 100644 --- a/src/project/wuxi/AppMine/AppMine.vue +++ b/src/project/wuxi/AppMine/AppMine.vue @@ -9,113 +9,111 @@
- + diff --git a/src/project/wuxi/AppMine/userInfo.vue b/src/project/wuxi/AppMine/userInfo.vue index 6f3e219..79ebe2a 100644 --- a/src/project/wuxi/AppMine/userInfo.vue +++ b/src/project/wuxi/AppMine/userInfo.vue @@ -4,66 +4,32 @@

头像

- -
- +
+

用户昵称

-
+

{{ user.nickName }}

- +

手机号

-
+

{{ user.phone || ''}}

- +
- -
-
-

姓名

-
-

{{ user.realName || '' }}

-
- -
-
-

身份证号

-
-

{{ user.idNumber || '' }}

-
- -
+
-

地区

-
-

{{ user.areaName || '' }}

-
- -
- {{ userAreaName }} - 请选择 - -
-
+
- -
-
- {{ btnText? '提交': '修改' }}
@@ -73,106 +39,55 @@ import {mapActions, mapState} from 'vuex' export default { name: "userInfo", + appName: "个人中心", computed: { ...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(o) { - this.isFromTabbar = o.isFromTabbar - this.path = o.path - this.getUserInfo('qujing') - uni.setNavigationBarTitle({ - title: '个人中心' - }) + onLoad() { + this.getUserInfo() + }, data() { return { - editAvatarUrl: false, editNickName: false, editPhone: false, - editRealName: false, - editIdNumber: false, - editArea: false, avatar: '', userName: '', - userPhone: '', - userRealName: '', - userIdNumber: '', - userAreaId: '', - userAreaName: '', - btnText: false, - isFromTabbar: '', - path: '', + userPhone: '' } }, methods: { ...mapActions(['getUserInfo', 'autoLogin']), - editBtn() { - this.btnText = true - this.editAvatarUrl = true; - this.avatar = this.user.avatarUrl - this.editNickName = true; - this.userName = this.user.nickName - this.editPhone = true; - this.userPhone = this.user.phone - this.editRealName = true; - this.userRealName = this.user.realName - this.editIdNumber = true; - this.userIdNumber = this.user.idNumber - this.editArea = true - this.userAreaId = this.user.areaId - this.userAreaName = this.user.areaName - }, - submit() { - if(this.flag) return - // if(!this.avatar) { - // return this.$u.toast('请上传头像') - // } - // if (!this.userName) { - // return this.$u.toast('请输入用户昵称') - // } - // if (this.userName == '微信用户') { - // return this.$u.toast('请修改用户昵称') - // } - // if (!this.userPhone) { - // return this.$u.toast('请输入手机号') - // } - if (!this.userRealName) { - return this.$u.toast('请输入姓名') - } - if (!this.userIdNumber) { - return this.$u.toast('请输入身份证号') - } - if (!this.$idCardNoUtil.checkIdCardNo(this.userIdNumber)) { - return this.$u.toast('请输入正确的身份证号码') - } - if (!this.userAreaId) { - return this.$u.toast('请选择地区') - } - - this.flag = true - this.$instance.post(`/app/appwechatuserqujing/idNumberEdit`, { - avatarUrl: this.avatar, - nickName: this.userName, - phone: this.userPhone, - name: this.userRealName, - idNumber: this.userIdNumber, - areaId: this.userAreaId, - areaName: this.userAreaName + 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('提交成功') - this.autoLogin({ loginWay:'qujing'}) - uni.$emit('auth') - setTimeout(() => { - if (this.isFromTabbar == 1) { - uni.switchTab({ url: this.path }) - } else { - uni.navigateBack() - } - }, 600); + this.$u.toast('修改成功') } - }).catch(err=> { - this.$u.toast(err.msg) }) }, upLoad(img) { @@ -195,29 +110,39 @@ export default { }) }) }, - handleWeixinSync({detail}) { - const { avatarUrl } = detail - if(avatarUrl?.length) { - this.upLoad(avatarUrl) + onLogout() { + uni.showModal({ + title: '提示', + content: "是否要退出登录", + success: res => { + if (res.confirm) { + this.$store.commit('logout') + this.$toast('退出成功'); + setTimeout(() => { + uni.switchTab({ + url: '/pages/AppMine/AppMine' + }) + }, 500) + } + } + }) + }, + handleWeixin({ detail }) { + if(detail.value) { + this.phone = detail.value + this.updateInfo() } }, - handleSelectArea(v) { - this.userAreaName = v.areaName - this.userAreaId = v.id - }, - idNumberInput() { - if(this.userIdNumber.length == 18 && this.userRealName) { - if(!this.userAreaId) { - this.$instance.post(`/app/appresidentapplet/queryDetailByIdNumberAndName`,{ - name: this.userRealName, - idNumber: this.userIdNumber - }).then(res=> { - if(res.data && res.data.id) { - this.userAreaId = res.data.id - this.userAreaName = res.data.areaName - } - }) - } + handleWeixinSync({detail}) { + const { value: nickName, avatarUrl } = detail + this.autoLogin({ nickName, avatarUrl }) + if(avatarUrl?.length) { + this.upLoad(avatarUrl).then(() => { + this.updateInfo() + }) + } + if(nickName) { + this.updateInfo() } } } @@ -266,31 +191,6 @@ export default { p { width: 100%; } - - .ai-area__wrapper { - display: flex; - align-items: center; - padding-left: 100px; - - span { - color: #333; - font-size: 30px; - } - - i { - color: #999; - font-size: 30px; - } - - image { - width: 16px; - height: 8px; - } - } - } - - ::v-deep .AiAreaPicker { - float: right; } .user-img-div { @@ -374,8 +274,9 @@ export default { color: #197DF0; } - .btn-edit { - background: #FFF; - } + // .editNickName { + // text-align: right; + // font-size: 28px; + // } }