优化代码

This commit is contained in:
wuxw 2024-09-12 23:11:36 +08:00
parent 9f21277e3f
commit f7cf50c8ea
3 changed files with 26 additions and 34 deletions

View File

@ -118,12 +118,10 @@
}, },
loadOwenrInfo: function() { loadOwenrInfo: function() {
let _that = this; let _that = this;
context.getOwner(function(_ownerInfo) { hasAuthOwner(this).then(_owner => {
if (_ownerInfo) { _that.ownerFlag = true;
_that.ownerFlag = true; },()=>{
} else { _that.ownerFlag = false;
_that.ownerFlag = false;
}
}); });
}, },
/** /**
@ -137,8 +135,8 @@
communityId:getCommunityId() communityId:getCommunityId()
}).then(_data=>{ }).then(_data=>{
//console.log(_data); //console.log(_data);
if(_data.url){ if(_data.faceUrl){
_that.headerImg = _data.url; _that.headerImg = _data.faceUrl;
}else{ }else{
_that.headerImg =conf.imgUrl+'/h5/images/serve/head.png'; _that.headerImg =conf.imgUrl+'/h5/images/serve/head.png';
} }

View File

@ -18,11 +18,7 @@
</picker> </picker>
</view> </view>
<view class="cu-form-group"> <view class="cu-form-group">
<view class="title">年龄</view> <view class="title">人员角色</view>
<input type="number" v-model="age" placeholder="请输入年龄"></input>
</view>
<view class="cu-form-group">
<view class="title">人员类型</view>
<picker :value="typeCdIndex" :range="typeCds" range-key="name" @change="_changeTypeCd"> <picker :value="typeCdIndex" :range="typeCds" range-key="name" @change="_changeTypeCd">
<view class="picker"> <view class="picker">
{{typeCds[typeCdIndex].name}} {{typeCds[typeCdIndex].name}}
@ -30,8 +26,8 @@
</picker> </picker>
</view> </view>
<view class="cu-form-group"> <view class="cu-form-group">
<view class="title">家庭住</view> <view class="title"></view>
<input type="text" v-model="address" placeholder="选填,请输入家庭住址"></input> <input type="text" v-model="address" placeholder="选填,请输入址"></input>
</view> </view>
<view class="block__title">联系信息</view> <view class="block__title">联系信息</view>
@ -39,11 +35,6 @@
<view class="title">手机号</view> <view class="title">手机号</view>
<input v-model="link" placeholder="请输入手机号(没有手机号随便写一个)"></input> <input v-model="link" placeholder="请输入手机号(没有手机号随便写一个)"></input>
</view> </view>
<!-- <view class="cu-form-group">
<view class="title">验证码</view>
<input v-model="msgCode" placeholder="请输入短信验证码" name="input"></input>
<button class='cu-btn bg-green shadow' :disabled="btnDisabled" @click="_sendMsgCode()">{{btnValue}}</button>
</view> -->
<view class="block__title">相关图片</view> <view class="block__title">相关图片</view>
<uploadImageAsync ref="vcUploadRef" :communityId="communityId" :maxPhotoNum="uploadImage.maxPhotoNum" :canEdit="uploadImage.canEdit" :title="uploadImage.imgTitle" @sendImagesData="sendImagesData"></uploadImageAsync> <uploadImageAsync ref="vcUploadRef" :communityId="communityId" :maxPhotoNum="uploadImage.maxPhotoNum" :canEdit="uploadImage.canEdit" :title="uploadImage.imgTitle" @sendImagesData="sendImagesData"></uploadImageAsync>
@ -81,22 +72,26 @@
"userId": "", "userId": "",
"typeCds": [ "typeCds": [
{ {
value: '1002', value: '3',
name: '家庭成员' name: '家庭成员'
}, },
{ {
value: '1003', value: '2',
name: '租客' name: '租客'
}, },
{ {
value: '1005', value: '4',
name: '公司员工'
},
{
value: '99',
name: '其他' name: '其他'
} }
], ],
"typeCdIndex": 0, "typeCdIndex": 0,
"personRole":'3',
"ownerTypeCd": "1002", "ownerTypeCd": "1002",
"idCard": "", "idCard": "",
"age": "",
"memberId": "-1", "memberId": "-1",
"communityId": "", "communityId": "",
"second": 60, "second": 60,
@ -104,7 +99,7 @@
"btnValue": "验证码", "btnValue": "验证码",
"msgCode":'', "msgCode":'',
"address": "", "address": "",
photos:[], photos:'',
uploadImage: { uploadImage: {
maxPhotoNum: 1, maxPhotoNum: 1,
imgTitle: '图片上传', imgTitle: '图片上传',
@ -134,7 +129,7 @@
onPullDownRefresh: function() {}, onPullDownRefresh: function() {},
methods: { methods: {
sendImagesData: function(e){ sendImagesData: function(e){
this.photos = e[0].fileId this.photos = e[0].url;
}, },
submitOwnerMember: function(e) { submitOwnerMember: function(e) {
let obj = { let obj = {
@ -149,9 +144,10 @@
"memberId": this.memberId, "memberId": this.memberId,
"communityId": this.communityId, "communityId": this.communityId,
"idCard": this.idCard, "idCard": this.idCard,
//"msgCode":this.msgCode, "personRole":this.personRole,
"personType":'P',
"address": this.address, "address": this.address,
"ownerPhoto": this.photos "ownerPhotoUrl": this.photos
} }
let msg = ""; let msg = "";
@ -159,8 +155,6 @@
msg = "请填写业主"; msg = "请填写业主";
} else if (obj.name == "") { } else if (obj.name == "") {
msg = "请填写姓名"; msg = "请填写姓名";
}else if (obj.age == "") {
msg = "请填写年龄";
} else if (obj.link == "") { } else if (obj.link == "") {
msg = "请填写手机号"; msg = "请填写手机号";
} else if (!checkPhoneNumber(obj.link)){ } else if (!checkPhoneNumber(obj.link)){
@ -212,7 +206,7 @@
}, },
_changeTypeCd: function(e){ _changeTypeCd: function(e){
this.typeCdIndex = e.detail.value; this.typeCdIndex = e.detail.value;
this.ownerTypeCd = this.typeCds[this.typeCdIndex].value; this.personRole = this.typeCds[this.typeCdIndex].value;
}, },
idCardChange: function(){ idCardChange: function(){
let idCard = this.idCard; let idCard = this.idCard;

View File

@ -118,9 +118,9 @@
method: "GET", method: "GET",
data: _paramIn, data: _paramIn,
success: function(res) { success: function(res) {
if (res.statusCode == 200) { let _json = res.data;
let _owners = res.data.owners; if (_json.code == 0) {
that.owners = _owners; that.owners = _json.data;
that.loading = false; that.loading = false;
} }
}, },