个人认证
This commit is contained in:
@@ -46,6 +46,9 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="logout">
|
||||||
|
<b class="login-out" @click="onLogout">退出登录</b>
|
||||||
|
</div>
|
||||||
<AiLogin ref="login" @success="getAuth()"/>
|
<AiLogin ref="login" @success="getAuth()"/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@@ -157,7 +160,22 @@ export default {
|
|||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.token && this.getUserInfo()
|
this.token && this.getUserInfo()
|
||||||
})
|
})
|
||||||
}
|
},
|
||||||
|
onLogout() {
|
||||||
|
uni.showModal({
|
||||||
|
title: '提示',
|
||||||
|
content: "是否要退出登录",
|
||||||
|
success: res => {
|
||||||
|
if (res.confirm) {
|
||||||
|
this.$store.commit('logout')
|
||||||
|
this.$toast('退出成功');
|
||||||
|
setTimeout(() => {
|
||||||
|
this.getAuth();
|
||||||
|
}, 500)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
},
|
},
|
||||||
onShow() {
|
onShow() {
|
||||||
this.getAuth();
|
this.getAuth();
|
||||||
@@ -354,6 +372,20 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.logout {
|
||||||
|
width: 100%;
|
||||||
|
height: 96px;
|
||||||
|
padding: 0 32px;
|
||||||
|
box-sizing: border-box;
|
||||||
|
line-height: 96px;
|
||||||
|
text-align: center;
|
||||||
|
.login-out {
|
||||||
|
background: #FFF;
|
||||||
|
border-radius: 16px;
|
||||||
|
font-size: 34px;
|
||||||
|
font-weight: 500;
|
||||||
|
color: #4181FF;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -1,35 +1,70 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="page">
|
<div class="page">
|
||||||
|
<u-navbar :is-back="false" title="个人认证" title-color="#000" title-width="300" title-size="32"
|
||||||
|
:background="{background: '#FFF'}" :title-bold="true"></u-navbar>
|
||||||
<div class="info-list">
|
<div class="info-list">
|
||||||
<div class="item-content mar-b8">
|
<div class="item-content mar-b8">
|
||||||
<div class="item solid">
|
<div class="item solid">
|
||||||
<p class="mar-t22">头像</p>
|
<p class="mar-t22">头像</p>
|
||||||
<button class="user-img-div" open-type="chooseAvatar" @chooseavatar="handleWeixinSync">
|
<button class="user-img-div" v-if="editAvatarUrl" open-type="chooseAvatar" @chooseavatar="handleWeixinSync">
|
||||||
<img v-if="user.avatarUrl" :src="user.avatarUrl" class="user-img">
|
<img v-if="user.avatarUrl && !avatar" :src="user.avatarUrl" class="user-img">
|
||||||
<img v-else src="https://cdn.cunwuyun.cn/dvcp/myFamily/tx.png" alt="" class="user-img">
|
<img v-if="avatar" :src="avatar" alt="" class="user-img">
|
||||||
|
<img v-if="!user.avatarUrl && !avatar" src="https://cdn.cunwuyun.cn/dvcp/myFamily/tx.png" alt="" class="user-img">
|
||||||
</button>
|
</button>
|
||||||
|
<div class="user-img-div" v-else>
|
||||||
|
<img v-if="user.avatarUrl && !avatar" :src="user.avatarUrl" class="user-img">
|
||||||
|
<img v-else src="https://cdn.cunwuyun.cn/dvcp/myFamily/tx.png" alt="" class="user-img">
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="item">
|
<div class="item">
|
||||||
<p>用户昵称</p>
|
<p>用户昵称</p>
|
||||||
<div class="item-right" v-if="!editNickName" @click="editNickName=true, userName= user.nickName">
|
<div class="item-right" v-if="!editNickName">
|
||||||
<p class="name">{{ user.nickName }}</p>
|
<p class="name">{{ user.nickName }}</p>
|
||||||
</div>
|
</div>
|
||||||
<input class="item-right" v-else type="text" v-model="userName" @blur="handleWeixinSync">
|
<input class="item-right" v-else type="text" v-model="userName">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="item-content mar-b8">
|
<div class="item-content mar-b8">
|
||||||
<div class="item">
|
<div class="item">
|
||||||
<p>手机号</p>
|
<p>手机号</p>
|
||||||
<div class="item-right" v-if="!!!editPhone" @click="editPhone=true, userPhone= user.phone">
|
<div class="item-right" v-if="!!!editPhone">
|
||||||
<p class="name">{{ user.phone || ''}}</p>
|
<p class="name">{{ user.phone || ''}}</p>
|
||||||
</div>
|
</div>
|
||||||
<input class="item-right" v-else type="number" v-model="userPhone" @blur="handleWeixin" maxlength="11">
|
<input class="item-right" v-else type="number" v-model="userPhone" maxlength="11">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="item-content" @click="onLogout">
|
|
||||||
<div class="item">
|
<div class="item-content mar-b8">
|
||||||
<b class="login-out">退出登录</b>
|
<div class="item solid">
|
||||||
|
<p>真实姓名</p>
|
||||||
|
<div class="item-right" v-if="!editRealName">
|
||||||
|
<p class="name">{{ user.realName || '' }}</p>
|
||||||
|
</div>
|
||||||
|
<input class="item-right" v-else type="text" v-model="userRealName">
|
||||||
</div>
|
</div>
|
||||||
|
<div class="item solid">
|
||||||
|
<p>身份证号</p>
|
||||||
|
<div class="item-right" v-if="!editIdNumber">
|
||||||
|
<p class="name">{{ user.idNumber || '' }}</p>
|
||||||
|
</div>
|
||||||
|
<input class="item-right" v-else type="idNumber" v-model="userIdNumber" maxlength="18">
|
||||||
|
</div>
|
||||||
|
<div class="item">
|
||||||
|
<p>所属地区</p>
|
||||||
|
<div class="item-right" v-if="!editArea">
|
||||||
|
<p class="name">{{ user.areaName || '' }}</p>
|
||||||
|
</div>
|
||||||
|
<AiAreaPicker v-else class="item-right" :areaId="$areaId" v-model="userAreaId" :fullName.sync="userAreaName">
|
||||||
|
<div class="ai-area__wrapper">
|
||||||
|
<span class="label" v-if="userAreaName">{{ userAreaName }}</span>
|
||||||
|
<i v-else>请选择</i>
|
||||||
|
<u-icon name="arrow-right" color="#ddd"/>
|
||||||
|
</div>
|
||||||
|
</AiAreaPicker>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="btn-wrapper btn-edit">
|
||||||
|
<b class="btn" @click="btnText? submit(): editBtn()">{{ btnText? '提交': '修改' }}</b>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -40,53 +75,85 @@ import {mapActions, mapState} from 'vuex'
|
|||||||
export default {
|
export default {
|
||||||
name: "userInfo",
|
name: "userInfo",
|
||||||
appName: "个人中心",
|
appName: "个人中心",
|
||||||
|
customNavigation: true,
|
||||||
computed: {
|
computed: {
|
||||||
...mapState(['user', 'token']),
|
...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() {
|
onLoad() {
|
||||||
this.getUserInfo()
|
this.getUserInfo('qujing')
|
||||||
|
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
editAvatarUrl: false,
|
||||||
editNickName: false,
|
editNickName: false,
|
||||||
editPhone: false,
|
editPhone: false,
|
||||||
|
editRealName: false,
|
||||||
|
editIdNumber: false,
|
||||||
|
editArea: false,
|
||||||
avatar: '',
|
avatar: '',
|
||||||
userName: '',
|
userName: '',
|
||||||
userPhone: ''
|
userPhone: '',
|
||||||
|
userRealName: '',
|
||||||
|
userIdNumber: '',
|
||||||
|
userAreaId: '',
|
||||||
|
userAreaName: '',
|
||||||
|
btnText: false,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions(['getUserInfo', 'autoLogin']),
|
...mapActions(['getUserInfo', 'autoLogin']),
|
||||||
updateInfo() {
|
editBtn() {
|
||||||
this.$instance.post(`/app/appwechatuser/update-nickName`,null,{
|
this.btnText = true
|
||||||
params: {
|
this.editAvatarUrl = true;
|
||||||
id: this.user.id,
|
this.avatar = this.user.avatarUrl
|
||||||
nickName: this.userName? this.userName : this.user.nickName,
|
this.editNickName = true;
|
||||||
avatarUrl: this.avatar? this.avatar : this.user.avatarUrl,
|
this.userName = this.user.nickName
|
||||||
phone: this.userPhone ? this.userPhone : this.user.phone,
|
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=> {
|
}).then(res=> {
|
||||||
if(res?.code==0) {
|
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}) {
|
handleWeixinSync({detail}) {
|
||||||
const { value: nickName, avatarUrl } = detail
|
const { avatarUrl } = detail
|
||||||
this.autoLogin({ nickName, avatarUrl })
|
|
||||||
if(avatarUrl?.length) {
|
if(avatarUrl?.length) {
|
||||||
this.upLoad(avatarUrl).then(() => {
|
this.upLoad(avatarUrl)
|
||||||
this.updateInfo()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
if(nickName) {
|
|
||||||
this.updateInfo()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -191,6 +229,31 @@ export default {
|
|||||||
p {
|
p {
|
||||||
width: 100%;
|
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 {
|
.user-img-div {
|
||||||
@@ -274,9 +337,8 @@ export default {
|
|||||||
color: #197DF0;
|
color: #197DF0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// .editNickName {
|
.btn-edit {
|
||||||
// text-align: right;
|
background: #FFF;
|
||||||
// font-size: 28px;
|
}
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -100,14 +100,16 @@ export default {
|
|||||||
updateInfo() {
|
updateInfo() {
|
||||||
this.$instance.post(`/app/appwechatuser/update-nickName`, null, {
|
this.$instance.post(`/app/appwechatuser/update-nickName`, null, {
|
||||||
params: {
|
params: {
|
||||||
id: this.user.id,
|
// id: this.user.id,
|
||||||
nickName: this.userName ? this.userName : this.user.nickName,
|
nickName: this.userName ? this.userName : this.user.nickName,
|
||||||
avatarUrl: this.avatar ? this.avatar : this.user.avatarUrl,
|
avatarUrl: this.avatar ? this.avatar : this.user.avatarUrl,
|
||||||
phone: this.userPhone ? this.userPhone : this.user.phone,
|
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 => {
|
}).then(res => {
|
||||||
if (res?.code == 0) {
|
if (res?.code == 0) {
|
||||||
this.$u.toast('修改成功')
|
this.$u.toast('提交成功')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user