This commit is contained in:
liuye
2024-07-05 09:14:53 +08:00
parent 4e07b5c13e
commit b777d3ee4d
9 changed files with 649 additions and 253 deletions

View File

@@ -4,11 +4,14 @@
<div class="item-content mar-b8">
<div class="item solid">
<p class="mar-t22">头像</p>
<button class="user-img-div" v-if="editAvatarUrl" open-type="chooseAvatar" @chooseavatar="handleWeixinSync">
<!-- <button class="user-img-div" v-if="editAvatarUrl" open-type="chooseAvatar" @chooseavatar="handleWeixinSync">
<img v-if="user.avatarUrl && !avatar" :src="user.avatarUrl" 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-if="editAvatarUrl">
<AiUploader v-model="avatarUrlList" multiple placeholder="上传头像" :limit="1"></AiUploader>
</div>
<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">
@@ -33,8 +36,8 @@
</div>
<div class="item-content mar-b8">
<div class="item solid">
<p>姓名</p>
<!-- <div class="item solid">
<p>真实姓名</p>
<div class="item-right" v-if="!editRealName">
<p class="name">{{ user.realName || '' }}</p>
</div>
@@ -46,19 +49,15 @@
<p class="name">{{ user.idNumber || '' }}</p>
</div>
<input class="item-right" v-else type="idNumber" v-model="userIdNumber" maxlength="18" @input="idNumberInput">
</div>
</div> -->
<div class="item">
<p>地区</p>
<div class="item-right" v-if="!editArea">
<p class="name">{{ user.areaName || '' }}</p>
<p>所属网格</p>
<div class="item-right" v-if="!editGird">
<p class="name">{{ user.girdName || '' }}</p>
</div>
<AiAreaPicker class="item-right" :areaId="$areaId" v-model="userAreaId" :fullName.sync="userAreaName" v-else>
<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>
<AiPagePicker type="gird" class="item-right" v-model="userGirdId" :params="{formType:2}" @select="handleSelectGrid" nodeKey="id" v-else>
<AiMore v-model="userGirdName" />
</AiPagePicker>
</div>
</div>
@@ -91,17 +90,18 @@ export default {
editPhone: false,
editRealName: false,
editIdNumber: false,
editArea: false,
editGird: false,
avatar: '',
userName: '',
userPhone: '',
userRealName: '',
userIdNumber: '',
userAreaId: '',
userAreaName: '',
userGirdId: '',
userGirdName: '',
btnText: false,
isFromTabbar: '',
path: '',
avatarUrlList: []
}
},
methods: {
@@ -118,46 +118,53 @@ export default {
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
this.editGird = true
this.userGirdId = this.user.girdId
this.userGirdName = this.user.girdName
this.avatarUrlList = [{'url': this.user.avatarUrl}]
},
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.avatarUrlList.length) {
return this.$u.toast('请上传头像')
}
if (!this.userIdNumber) {
return this.$u.toast('请输入身份证号')
if (!this.userName) {
return this.$u.toast('请输入用户昵称')
}
if (!this.$idCardNoUtil.checkIdCardNo(this.userIdNumber)) {
return this.$u.toast('请输入正确的身份证号码')
if (this.userName == '微信用户') {
return this.$u.toast('请修改用户昵称')
}
if (!this.userAreaId) {
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.userGirdId) {
return this.$u.toast('请选择所属网格')
}
// if (!this.userAreaId) {
// return this.$u.toast('请选择所属地区')
// }
// if (!/[^0]0{0,2}$/.test(this.userAreaId)) {
// return this.$u.toast('所属地区必须选到村级')
// }
this.flag = true
this.$instance.post(`/app/appwechatuserqujing/idNumberEdit`, {
avatarUrl: this.avatar,
this.$instance.post(`/app/appwechatuserqujing/idNumberAttestation`, {
// avatarUrl: this.avatar,
avatarUrl: this.avatarUrlList[0].url,
nickName: this.userName,
phone: this.userPhone,
name: this.userRealName,
name: this.userName,
idNumber: this.userIdNumber,
areaId: this.userAreaId,
areaName: this.userAreaName
girdId: this.userGirdId,
girdName: this.userGirdName
}).then(res=> {
if(res?.code==0) {
this.$u.toast('提交成功')
@@ -201,20 +208,20 @@ export default {
this.upLoad(avatarUrl)
}
},
handleSelectArea(v) {
this.userAreaName = v.areaName
this.userAreaId = v.id
handleSelectGrid(v) {
this.userGirdName = v.girdName
this.userGirdId = v.id
},
idNumberInput() {
if(this.userIdNumber.length == 18 && this.userRealName) {
if(!this.userAreaId) {
if(!this.userGirdId) {
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
this.userGirdId = res.data.id
this.userGirdName = res.data.girdName
}
})
}
@@ -377,5 +384,15 @@ export default {
.btn-edit {
background: #FFF;
}
::v-deep.ai-uploader {
text-align: right;
display: inline-block;
.imgList {
width: 228px;
height: 200px;
display: inline-block!important;
}
}
}
</style>