-
-
-
退出登录
+
+
+
+
真实姓名
+
+
{{ user.realName || '' }}
+
+
+
+
身份证号
+
+
{{ user.idNumber || '' }}
+
+
+
+
+
所属地区
+
+
{{ user.areaName || '' }}
+
+
+
+ {{ userAreaName }}
+ 请选择
+
+
+
+
+
+
+ {{ btnText? '提交': '修改' }}
@@ -40,53 +75,85 @@ import {mapActions, mapState} from 'vuex'
export default {
name: "userInfo",
appName: "个人中心",
+ customNavigation: true,
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() {
- this.getUserInfo()
-
+ this.getUserInfo('qujing')
},
data() {
return {
+ editAvatarUrl: false,
editNickName: false,
editPhone: false,
+ editRealName: false,
+ editIdNumber: false,
+ editArea: false,
avatar: '',
userName: '',
- userPhone: ''
+ userPhone: '',
+ userRealName: '',
+ userIdNumber: '',
+ userAreaId: '',
+ userAreaName: '',
+ btnText: false,
}
},
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,
- }
+ 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.userPhone) {
+ return this.$u.toast('请输入手机号')
+ }
+ if (!this.userRealName) {
+ return this.$u.toast('请输入真实姓名')
+ }
+ if (!this.userIdNumber) {
+ return this.$u.toast('请输入身份证号')
+ }
+ if (!this.userAreaId) {
+ return this.$u.toast('请选择所属地区')
+ }
+ this.flag = true
+ this.$instance.post(`/app/appwechatuserqujing/idNumberAttestation`, {
+ avatarUrl: this.avatar,
+ nickName: this.userName,
+ phone: this.userPhone,
+ name: this.userRealName,
+ idNumber: this.userIdNumber,
+ areaId: this.userAreaId,
+ areaName: this.userAreaName
}).then(res=> {
if(res?.code==0) {
- this.$u.toast('修改成功')
+ this.$u.toast('提交成功')
+ this.autoLogin()
+ setTimeout(() => {
+ uni.navigateBack()
+ }, 500);
}
})
},
@@ -110,39 +177,10 @@ export default {
})
})
},
- 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()
- }
- },
handleWeixinSync({detail}) {
- const { value: nickName, avatarUrl } = detail
- this.autoLogin({ nickName, avatarUrl })
+ const { avatarUrl } = detail
if(avatarUrl?.length) {
- this.upLoad(avatarUrl).then(() => {
- this.updateInfo()
- })
- }
- if(nickName) {
- this.updateInfo()
+ this.upLoad(avatarUrl)
}
}
}
@@ -191,6 +229,31 @@ 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 {
@@ -274,9 +337,8 @@ export default {
color: #197DF0;
}
- // .editNickName {
- // text-align: right;
- // font-size: 28px;
- // }
+ .btn-edit {
+ background: #FFF;
+ }
}
diff --git a/src/project/qujing/AppMine/userInfo.vue b/src/project/qujing/AppMine/userInfo.vue
index c5f8bc0..486a3ce 100644
--- a/src/project/qujing/AppMine/userInfo.vue
+++ b/src/project/qujing/AppMine/userInfo.vue
@@ -100,14 +100,16 @@ export default {
updateInfo() {
this.$instance.post(`/app/appwechatuser/update-nickName`, null, {
params: {
- id: this.user.id,
+ // 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,
+ areaId: this.userAreaId? this.userAreaId : this.user.areaId,
+ areaName: this.userAreaName ? this.userAreaName : this.user.areaName,
}
}).then(res => {
if (res?.code == 0) {
- this.$u.toast('修改成功')
+ this.$u.toast('提交成功')
}
})
},