diff --git a/miniprogram/pages/formid/formid.js b/miniprogram/pages/formid/formid.js index b85efa3..94272bf 100755 --- a/miniprogram/pages/formid/formid.js +++ b/miniprogram/pages/formid/formid.js @@ -31,6 +31,7 @@ Page({ shibei: '1', //是否居住在市北 workIndustryText: '', //所属行业其他输入框, couplingCommunity: [], //包联社区 + region:'' }, selectedStatus: false, selectOption: [{ @@ -125,6 +126,44 @@ Page({ label: '其他', value: '11' }], + regionOptions:[ + { + label: '市南区', + value: '0' + }, + { + label: '李沧区', + value: '1' + }, + { + label: '崂山区', + value: '2' + }, + { + label: '西海岸新区', + value: '3' + }, + { + label: '城阳区', + value: '4' + }, + { + label: '即墨区', + value: '5' + }, + { + label: '胶州市', + value: '6' + }, + { + label: '平度市', + value: '7' + }, + { + label: '莱西市', + value: '8' + }, + ], workTypeInput: false, workTypeText: '', //单位类型为其他的输入框值 newArr: [], @@ -158,11 +197,20 @@ Page({ let end = obj.identityNo.slice(15, 18); obj.identityNo = str + temp + end; } + let region = '' + if(obj.villageName != ''){ + if(obj.villageName.indexOf('-') > 1){ + let temp = obj.villageName + region = temp.split('-')[0] + obj.villageName = temp.split('-')[1] + } + } obj.allDeptIds = obj.allDeptIds.split(',') obj.couplingCommunity = obj.couplingCommunity.split(',') this.setData({ form: { - ...obj + ...obj, + region:region }, title: options.title, }) @@ -447,6 +495,11 @@ Page({ 'form.villageName': e.detail.value }) }, + bindRegionVillageName(e) { + this.setData({ + 'form.villageName': e.detail.value + }) + }, //单选框 bindFlagshibeiChange(e) { this.getDeptTree() @@ -485,6 +538,11 @@ Page({ 'form.workType': this.data.selectOption[e.detail.value].label, }) }, + handleChangeRegion(e) { + this.setData({ + 'form.region': this.data.regionOptions[e.detail.value].label, + }) + }, handleChangeServiceType(e) { if (e.detail.value == '7') { @@ -583,7 +641,7 @@ Page({ }else { this.data.form.identityNo = this.idNo; } - if (this.data.form.mobile.length != 11) { + if (this.data.form.mobile.length != 11 || !this.data.form.mobile) { this.showToast('请填写正确的手机号码') return false } @@ -595,10 +653,6 @@ Page({ this.showToast('请填写专业特长') return false } - if (!this.data.form.mobile) { - this.showToast('请填写正确的手机号码') - return false - } if (this.data.form.shibei == '1') { if (this.data.form.allDeptIds.length == 0) { this.showToast('请选择报到常住社区名称') @@ -613,7 +667,10 @@ Page({ // return false // } } else if (this.data.form.shibei == '0') { - this.data.form.villageName = '', + if(this.data.form.region != '' && this.data.form.villageName != ''){ + let temp = this.data.form.region + '-' + this.data.form.villageName; + this.data.form.villageName = temp + } this.data.form.allDeptIds = [] } const para = { @@ -718,6 +775,7 @@ Page({ this.showToast('请填写手机号') return } + if (this.data.form.shibei == '1') { if (this.data.form.allDeptIds.length == 0) { this.showToast('请选择报到常住社区名称') @@ -732,8 +790,11 @@ Page({ // return // } } else if (this.data.form.shibei == '0') { - this.data.form.allDeptIds = [], - this.data.form.villageName = '' + if(!this.data.form.region){ + this.showToast('请选择行政区域') + return + } + this.data.form.allDeptIds = [] } this.setData({ visible: true diff --git a/miniprogram/pages/formid/formid.wxml b/miniprogram/pages/formid/formid.wxml index 767607f..fef5a65 100755 --- a/miniprogram/pages/formid/formid.wxml +++ b/miniprogram/pages/formid/formid.wxml @@ -6,7 +6,7 @@ 姓名 - + @@ -15,7 +15,7 @@ 身份证号 - + @@ -24,7 +24,7 @@ 手机号码 - + @@ -33,7 +33,7 @@ 密码 - + @@ -42,7 +42,7 @@ 确认密码 - + @@ -51,7 +51,7 @@ 工作单位 - + @@ -61,29 +61,28 @@ - {{form.workType?form.workType:'请选择'}} + {{form.workType?form.workType:'请选择单位性质'}} - + - * - 专业特长 + + 单位性质(其他) - + - + - - 单位性质(其他) + * + 专业特长 - + -