|
@@ -31,9 +31,11 @@
|
|
|
|
|
|
<view class="form-label-input">
|
|
|
<view class="phone-form-label"><text class="form-label-require">*</text>籍贯</view>
|
|
|
- <uni-data-picker v-model="formData.hometown" placeholder="请选择籍贯" :localdata="hometownData">
|
|
|
- {{formData.hometown}}
|
|
|
- </uni-data-picker>
|
|
|
+ <picker mode="multiSelector" :range="pickerData" :range-key="'label'" @change="onPickerChange">
|
|
|
+ <view class="picker">
|
|
|
+ 当前选择:{{ selectedProvince }} - {{ selectedCity }}
|
|
|
+ </view>
|
|
|
+ </picker>
|
|
|
</view>
|
|
|
<view class="form-label-input">
|
|
|
<view class="phone-form-label"><text class="form-label-require">*</text>身份证地址</view>
|
|
@@ -63,17 +65,17 @@
|
|
|
<dataChecked :list="xueliList" mode="single" :showAdd="false" @change="selectChangeXueliList" />
|
|
|
</view>
|
|
|
<view class="form-label-radio flex-start-row">
|
|
|
- <view class="phone-form-label"><text class="form-label-require"></text>婚姻 </view>
|
|
|
+ <view class="phone-form-label"><text></text>婚姻 </view>
|
|
|
<dataChecked :list="hunyinList" mode="single" :showAdd="false" @change="selectChangeHunyinList" />
|
|
|
</view>
|
|
|
|
|
|
<view class="form-label-input form-top-margin flex-start-row">
|
|
|
- <view class="phone-form-label"><text class="form-label-require">*</text>通讯地址</view>
|
|
|
+ <view class="phone-form-label"><text></text>通讯地址</view>
|
|
|
<textarea v-model="formData.juzhuDizhi" placeholder="请输入通讯地址" class="form-textarea-box" />
|
|
|
</view>
|
|
|
|
|
|
<view class="form-label-select">
|
|
|
- <view class="phone-form-label"><text class="form-label-require"></text>星座</view>
|
|
|
+ <view class="phone-form-label"><text></text>星座</view>
|
|
|
<picker :range="xingzuoList" mode='selector' :value="formData.xingzuoIndex" range-key="name"
|
|
|
@change="xingzuoChange" @cancel="xingzuoCancel">
|
|
|
<view class="form-radio-select">
|
|
@@ -83,7 +85,7 @@
|
|
|
</picker>
|
|
|
</view>
|
|
|
<view class="form-label-select">
|
|
|
- <view class="phone-form-label"><text class="form-label-require"></text>属相</view>
|
|
|
+ <view class="phone-form-label"><text></text>属相</view>
|
|
|
<picker :range="shuxiangList" mode='selector' :value="formData.shuxiangIndex" range-key="name"
|
|
|
@change="shuxiangChange" @cancel="shuxiangCancel">
|
|
|
<view class="form-radio-select">
|
|
@@ -96,7 +98,8 @@
|
|
|
<view class="form-label-switch">
|
|
|
<view class="phone-form-label"> <text class="form-label-require"></text>星座属相展示到简历 </view>
|
|
|
<view>展示
|
|
|
- <switch @change="switchXingzuoChange" :checked="formData.xingzuoFlag" color="#3fd2a1" style="transform:scale(0.7)" />
|
|
|
+ <switch @change="switchXingzuoChange" :checked="formData.xingzuoFlag" color="#3fd2a1"
|
|
|
+ style="transform:scale(0.7)" />
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="agree-section-box form-top-margin">
|
|
@@ -119,7 +122,8 @@
|
|
|
getJiazhengHunyin,
|
|
|
getJiazhengMinzu,
|
|
|
getJiazhengShuxiang,
|
|
|
- getJiazhengXingzuo
|
|
|
+ getJiazhengXingzuo,
|
|
|
+ getJiazhengJiguan
|
|
|
} from "@/api/jiazheng.js";
|
|
|
export default {
|
|
|
components: {
|
|
@@ -146,7 +150,7 @@
|
|
|
xingzuoIndex: 0,
|
|
|
minzuIndex: 0,
|
|
|
shuxiangIndex: 0,
|
|
|
- xingzuoFlag:false
|
|
|
+ xingzuoFlag: false
|
|
|
|
|
|
},
|
|
|
xueliList: [],
|
|
@@ -154,24 +158,10 @@
|
|
|
shuxiangList: [],
|
|
|
xingzuoList: [],
|
|
|
minzuList: [],
|
|
|
-
|
|
|
-
|
|
|
- hometownData: [{
|
|
|
- text: '辽宁省',
|
|
|
- value: '210000',
|
|
|
- children: [{
|
|
|
- text: '大连市',
|
|
|
- value: '210200',
|
|
|
- children: [{
|
|
|
- text: '西岗区',
|
|
|
- value: '210203'
|
|
|
- },
|
|
|
- // 其他区县...
|
|
|
- ]
|
|
|
- }]
|
|
|
- }
|
|
|
- // 其他省份...
|
|
|
- ],
|
|
|
+ // areaTree: [],
|
|
|
+ pickerData: [],
|
|
|
+ selectedProvince: '',
|
|
|
+ selectedCity: ''
|
|
|
|
|
|
}
|
|
|
},
|
|
@@ -181,25 +171,133 @@
|
|
|
this.getMinzu()
|
|
|
this.getXingzuo()
|
|
|
this.getShuxiang()
|
|
|
+ this.getJiguan()
|
|
|
|
|
|
},
|
|
|
methods: {
|
|
|
- validate() {
|
|
|
- return new Promise((resolve) => {
|
|
|
- // 实际验证逻辑
|
|
|
- const isValid = this.formData.realName
|
|
|
- if (!isValid) {
|
|
|
- this.showError = true
|
|
|
- resolve(false)
|
|
|
- } else {
|
|
|
- resolve(true)
|
|
|
- }
|
|
|
- })
|
|
|
- },
|
|
|
+
|
|
|
+ formatData(data) {
|
|
|
+ const provinces = data.map(province => {
|
|
|
+ return {
|
|
|
+ label: province.lable,
|
|
|
+ value: province.id,
|
|
|
+ children: province.children.map(city => {
|
|
|
+ return {
|
|
|
+ label: city.lable,
|
|
|
+ value: city.id
|
|
|
+ };
|
|
|
+ })
|
|
|
+ };
|
|
|
+ });
|
|
|
+
|
|
|
+ return provinces;
|
|
|
+ },
|
|
|
+ onPickerChange(e) {
|
|
|
+ const [provinceIndex, cityIndex] = e.detail.value;
|
|
|
+ const selectedProvince = this.pickerData[provinceIndex];
|
|
|
+ const selectedCity = selectedProvince.children[cityIndex];
|
|
|
+
|
|
|
+ this.selectedProvince = selectedProvince.label;
|
|
|
+ this.selectedCity = selectedCity.label;
|
|
|
+ },
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ checkAllFields() {
|
|
|
+ const requiredFields = [{
|
|
|
+ key: 'userName',
|
|
|
+ name: '手机号'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ key: 'realName',
|
|
|
+ name: '姓名'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ key: 'idCard',
|
|
|
+ name: '身份证号'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ key: 'birthday',
|
|
|
+ name: '生日'
|
|
|
+ },
|
|
|
+ // {
|
|
|
+ // key: 'hometown',
|
|
|
+ // name: '家乡',
|
|
|
+ // type: 'array'
|
|
|
+ // },
|
|
|
+ {
|
|
|
+ key: 'hujiDizhi',
|
|
|
+ name: '身份证地址'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ key: 'gender',
|
|
|
+ name: '性别'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ key: 'juzhuDizhi',
|
|
|
+ name: '通讯地址'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ key: 'minzu',
|
|
|
+ name: '民族',
|
|
|
+ type: 'object'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ key: 'shuxiang',
|
|
|
+ name: '属相',
|
|
|
+ type: 'object'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ key: 'xingzuo',
|
|
|
+ name: '星座',
|
|
|
+ type: 'object'
|
|
|
+ },
|
|
|
+ ]
|
|
|
+
|
|
|
+ for (const field of requiredFields) {
|
|
|
+ const value = this.formData[field.key]
|
|
|
+
|
|
|
+ // 根据不同类型进行存在验证
|
|
|
+ if (field.type === 'array' && !value?.length) {
|
|
|
+ this.showAlert(field.name)
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ if (field.type === 'object' && !Object.keys(value).length) {
|
|
|
+ this.showAlert(field.name)
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ if (field.type === 'boolean' && value !== true) {
|
|
|
+ this.showAlert(field.name)
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ if (!field.type && !value?.toString().trim()) {
|
|
|
+ this.showAlert(field.name)
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return true
|
|
|
+ },
|
|
|
+ showAlert(fieldName) {
|
|
|
+ uni.showToast({
|
|
|
+ title: `${fieldName}不能为空`,
|
|
|
+ icon: 'none',
|
|
|
+ duration: 2000
|
|
|
+ })
|
|
|
+ },
|
|
|
+ getJiguan() {
|
|
|
+ getJiazhengJiguan({}).then(res => {
|
|
|
+ // this.areaTree = res.data
|
|
|
+ this.pickerData = this.formatData(res.data);
|
|
|
+
|
|
|
+ console.log('this.pickerData',this.pickerData);
|
|
|
+ }).catch(error => {
|
|
|
+ console.error('获取技能类型失败:', error);
|
|
|
+ });
|
|
|
+ },
|
|
|
getXueli() {
|
|
|
getJiazhengXueli({}).then(res => {
|
|
|
this.xueliList = res.data
|
|
|
- // console.log('xueliList', this.xueliList);
|
|
|
+ // console.log('xueliList', this.xueliList);
|
|
|
}).catch(error => {
|
|
|
console.error('获取技能类型失败:', error);
|
|
|
});
|
|
@@ -207,7 +305,7 @@
|
|
|
getXingzuo() {
|
|
|
getJiazhengXingzuo({}).then(res => {
|
|
|
this.xingzuoList = res.data
|
|
|
- // console.log('xingzuoList', this.xingzuoList);
|
|
|
+ // console.log('xingzuoList', this.xingzuoList);
|
|
|
}).catch(error => {
|
|
|
console.error('获取技能类型失败:', error);
|
|
|
});
|
|
@@ -215,7 +313,7 @@
|
|
|
getShuxiang() {
|
|
|
getJiazhengShuxiang({}).then(res => {
|
|
|
this.shuxiangList = res.data
|
|
|
- // console.log('shuxiangList', this.shuxiangList);
|
|
|
+ // console.log('shuxiangList', this.shuxiangList);
|
|
|
}).catch(error => {
|
|
|
console.error('获取技能类型失败:', error);
|
|
|
});
|
|
@@ -223,7 +321,7 @@
|
|
|
getHunyin() {
|
|
|
getJiazhengHunyin({}).then(res => {
|
|
|
this.hunyinList = res.data
|
|
|
- // console.log('hunyinList', this.hunyinList);
|
|
|
+ // console.log('hunyinList', this.hunyinList);
|
|
|
}).catch(error => {
|
|
|
console.error('获取技能类型失败:', error);
|
|
|
});
|
|
@@ -231,7 +329,7 @@
|
|
|
getMinzu() {
|
|
|
getJiazhengMinzu({}).then(res => {
|
|
|
this.minzuList = res.data
|
|
|
- // console.log('minzuList', this.minzuList);
|
|
|
+ // console.log('minzuList', this.minzuList);
|
|
|
}).catch(error => {
|
|
|
console.error('获取技能类型失败:', error);
|
|
|
});
|
|
@@ -252,7 +350,7 @@
|
|
|
xingzuoChange(e) {
|
|
|
const index = e.detail.value
|
|
|
this.formData.xingzuo = this.xingzuoList[index]
|
|
|
- // console.log('this.formData.xingzuo', this.formData.xingzuo);
|
|
|
+ // console.log('this.formData.xingzuo', this.formData.xingzuo);
|
|
|
|
|
|
},
|
|
|
xingzuoCancel() {
|
|
@@ -277,11 +375,12 @@
|
|
|
this.formData.hunyin = data
|
|
|
},
|
|
|
switchXingzuoChange(e) {
|
|
|
- this.formData.xingzuoFlag = e.detail.value
|
|
|
+ this.formData.xingzuoFlag = e.detail.value
|
|
|
},
|
|
|
goNext() {
|
|
|
console.log('formData', this.formData);
|
|
|
- //this.$emit('goNext',0);
|
|
|
+ if (!this.checkAllFields()) return
|
|
|
+ this.$emit('goNext', 0);
|
|
|
},
|
|
|
|
|
|
handleAgree(e) {
|