|
@@ -10,41 +10,55 @@
|
|
|
<!-- </block>-->
|
|
|
</cu-custom>
|
|
|
<u--form :model="inputForm" labelWidth="100px" class="u-form" labelPosition="left" :rules="rules" ref="inputForm">
|
|
|
- <u-form-item label="姓名" borderBottom prop="name">
|
|
|
+ <u-form-item label="姓名" borderBottom prop="name" :required="true">
|
|
|
<u--input placeholder='请填写姓名' v-model="inputForm.name"></u--input>
|
|
|
</u-form-item>
|
|
|
|
|
|
<!-- <u-form-item label="性别" borderBottom prop="sex">
|
|
|
<jp-picker v-model="inputForm.sex" rangeKey="label" rangeValue="value" :range="$dictUtils.getDictList('sex')"></jp-picker>
|
|
|
</u-form-item> -->
|
|
|
+ <u-form-item label="身份证号码" borderBottom prop="idCard" :required="true">
|
|
|
+ <u--input placeholder='请填写身份证号码' v-model="inputForm.idCard" @blur="idCardOnly(inputForm.idCard)" ></u--input>
|
|
|
+ </u-form-item>
|
|
|
<u-form-item label="性别" borderBottom prop="sex">
|
|
|
- <jp-picker v-model="inputForm.sex" rangeKey="label" rangeValue="value" :range="[
|
|
|
- { label: '男', value: 'male' },
|
|
|
- { label: '女', value: 'female' },
|
|
|
- { label: '其他', value: 'other' }
|
|
|
+ <jp-picker v-model="inputForm.sex" rangeKey="label" :disabled="true" rangeValue="value" :range="[
|
|
|
+ { label: '男', value: '1' },
|
|
|
+ { label: '女', value: '2' }
|
|
|
]"></jp-picker>
|
|
|
</u-form-item>
|
|
|
-
|
|
|
-
|
|
|
<u-form-item label="年龄" borderBottom prop="age">
|
|
|
- <u--input placeholder='请填写年龄' v-model="inputForm.age"></u--input>
|
|
|
+ <u--input placeholder='请填写年龄' :disabled="true" v-model="inputForm.age"></u--input>
|
|
|
</u-form-item>
|
|
|
|
|
|
<u-form-item label="出生日期" borderBottom prop="birthday">
|
|
|
<el-date-picker
|
|
|
v-model="inputForm.birthday"
|
|
|
type="date"
|
|
|
- value-format="YYYY-MM-DD"
|
|
|
placeholder="选择出生日期"
|
|
|
style="width:100%"
|
|
|
size="default"
|
|
|
placement="bottom-start"
|
|
|
+ :disabled="true"
|
|
|
clearable>
|
|
|
</el-date-picker>
|
|
|
</u-form-item>
|
|
|
|
|
|
<u-form-item label="政治面貌" borderBottom prop="politicalOutlook" >
|
|
|
- <u--input placeholder='请填写政治面貌' v-model="inputForm.politicalOutlook"></u--input>
|
|
|
+ <jp-picker v-model="inputForm.politicalOutlook" rangeKey="label" rangeValue="value" :range="[
|
|
|
+ { label: '中共党员', value: '1' },
|
|
|
+ { label: '中共预备党员', value: '2' },
|
|
|
+ { label: '共青团员', value: '3' },
|
|
|
+ { label: '民革党员', value: '4' },
|
|
|
+ { label: '民盟盟员', value: '5' },
|
|
|
+ { label: '民建会员', value: '6' },
|
|
|
+ { label: '民进会员', value: '7' },
|
|
|
+ { label: '农工党党员', value: '8' },
|
|
|
+ { label: '致公党党员', value: '9' },
|
|
|
+ { label: '九三学社社员', value: '10' },
|
|
|
+ { label: '台盟盟员', value: '11' },
|
|
|
+ { label: '无党派人士', value: '12' },
|
|
|
+ { label: '群众', value: '13' },
|
|
|
+ ]"></jp-picker>
|
|
|
</u-form-item>
|
|
|
|
|
|
<u-form-item label="籍贯" borderBottom prop="nativePlace" >
|
|
@@ -56,17 +70,19 @@
|
|
|
</u-form-item>
|
|
|
|
|
|
<u-form-item label="婚姻状况" borderBottom prop="maritalStatus" >
|
|
|
- <u--input placeholder='请填写婚姻状况' v-model="inputForm.maritalStatus"></u--input>
|
|
|
+<!-- <u--input placeholder='请填写婚姻状况' v-model="inputForm.maritalStatus"></u--input>-->
|
|
|
+ <jp-picker v-model="inputForm.maritalStatus" rangeKey="label" rangeValue="value" :range="[
|
|
|
+ { label: '未婚', value: '1' },
|
|
|
+ { label: '已婚', value: '2' },
|
|
|
+ { label: '丧偶', value: '3' },
|
|
|
+ { label: '离婚', value: '4' }
|
|
|
+ ]"></jp-picker>
|
|
|
</u-form-item>
|
|
|
|
|
|
- <u-form-item label="联系电话" borderBottom prop="mobilePhone" >
|
|
|
+ <u-form-item label="联系电话" borderBottom prop="mobilePhone" :required="true">
|
|
|
<u--input placeholder='请填写联系电话' @blur="mobilePhoneOnly(inputForm.mobilePhone)" maxlength="11" v-model="inputForm.mobilePhone"></u--input>
|
|
|
</u-form-item>
|
|
|
|
|
|
- <u-form-item label="身份证号码" borderBottom prop="idCard" >
|
|
|
- <u--input placeholder='请填写身份证号码' @blur="idCardOnly(inputForm.idCard)" v-model="inputForm.idCard"></u--input>
|
|
|
- </u-form-item>
|
|
|
-
|
|
|
<u-form-item label="家庭住址" borderBottom prop="homeAddress" >
|
|
|
<u--input placeholder='请填写家庭住址' v-model="inputForm.homeAddress"></u--input>
|
|
|
</u-form-item>
|
|
@@ -87,7 +103,6 @@
|
|
|
<el-date-picker
|
|
|
v-model="inputForm.startTime"
|
|
|
type="date"
|
|
|
- value-format="YYYY-MM-DD"
|
|
|
placeholder="选择开始时间"
|
|
|
style="width:100%"
|
|
|
size="default"
|
|
@@ -100,7 +115,6 @@
|
|
|
<el-date-picker
|
|
|
v-model="inputForm.endTime"
|
|
|
type="date"
|
|
|
- value-format="YYYY-MM-DD"
|
|
|
placeholder="选择毕业时间"
|
|
|
style="width:100%"
|
|
|
size="default"
|
|
@@ -110,23 +124,49 @@
|
|
|
</u-form-item>
|
|
|
|
|
|
<u-form-item label="学历" borderBottom prop="education" >
|
|
|
- <u--input placeholder='请填写学历' v-model="inputForm.education"></u--input>
|
|
|
+ <jp-picker v-model="inputForm.education" rangeKey="label" rangeValue="value" :range="[
|
|
|
+ { label: '小学', value: '1' },
|
|
|
+ { label: '初中', value: '2' },
|
|
|
+ { label: '高中', value: '3' },
|
|
|
+ { label: '大专', value: '4' },
|
|
|
+ { label: '本科', value: '5' },
|
|
|
+ { label: '研究生', value: '6' },
|
|
|
+ ]"></jp-picker>
|
|
|
</u-form-item>
|
|
|
|
|
|
<u-form-item label="学历性质" borderBottom prop="educationNature" >
|
|
|
- <u--input placeholder='请填写学历性质' v-model="inputForm.educationNature"></u--input>
|
|
|
+ <jp-picker v-model="inputForm.educationNature" rangeKey="label" rangeValue="value" :range="[
|
|
|
+ { label: '统招全日制学历', value: '1' },
|
|
|
+ { label: '国家开放大学', value: '2' },
|
|
|
+ { label: '成人高考学历', value: '3' },
|
|
|
+ { label: '网络远程教育学历', value: '4' },
|
|
|
+ { label: '自考学历', value: '5' },
|
|
|
+ ]"></jp-picker>
|
|
|
</u-form-item>
|
|
|
|
|
|
<u-form-item label="是否毕业" borderBottom prop="graduatedOrNot" >
|
|
|
- <u--input placeholder='请填写是否毕业' v-model="inputForm.graduatedOrNot"></u--input>
|
|
|
+ <jp-picker v-model="inputForm.graduatedOrNot" rangeKey="label" rangeValue="value" :range="[
|
|
|
+ { label: '是', value: '1' },
|
|
|
+ { label: '否', value: '2' },
|
|
|
+ ]"></jp-picker>
|
|
|
</u-form-item>
|
|
|
|
|
|
<u-form-item label="英语等级" borderBottom prop="englishLevel" >
|
|
|
- <u--input placeholder='请填写英语等级' v-model="inputForm.englishLevel"></u--input>
|
|
|
+ <jp-picker v-model="inputForm.englishLevel" rangeKey="label" rangeValue="value" :range="[
|
|
|
+ { label: 'CET-4', value: '1' },
|
|
|
+ { label: 'CET-6', value: '2' },
|
|
|
+ { label: 'TEM-4', value: '3' },
|
|
|
+ { label: 'TEM-8', value: '4' },
|
|
|
+ ]"></jp-picker>
|
|
|
</u-form-item>
|
|
|
|
|
|
<u-form-item label="计算机等级" borderBottom prop="ncre" >
|
|
|
- <u--input placeholder='请填写计算机等级' v-model="inputForm.ncre"></u--input>
|
|
|
+ <jp-picker v-model="inputForm.ncre" rangeKey="label" rangeValue="value" :range="[
|
|
|
+ { label: '一级', value: '1' },
|
|
|
+ { label: '二级', value: '2' },
|
|
|
+ { label: '三级', value: '3' },
|
|
|
+ { label: '四级', value: '4' },
|
|
|
+ ]"></jp-picker>
|
|
|
</u-form-item>
|
|
|
|
|
|
<u-form-item label="个人简介" borderBottom prop="remarks">
|
|
@@ -134,11 +174,11 @@
|
|
|
</u-form-item>
|
|
|
|
|
|
<u-form-item label="社保编号(选填)" borderBottom prop="socialSecurityNumber">
|
|
|
- <u--input placeholder='请填写社保编号' v-model="inputForm.socialSecurityNumber" maxlength="10"></u--input>
|
|
|
+ <u--input placeholder='请填写社保编号' v-model="inputForm.socialSecurityNumber" maxlength="10" @input="validateInput"></u--input>
|
|
|
</u-form-item>
|
|
|
|
|
|
<u-form-item label="社保银行卡号(选填)" borderBottom prop="socialSecurityBankNumber">
|
|
|
- <u--input placeholder='请填写社保银行卡号' v-model="inputForm.socialSecurityBankNumber" maxlength="19"></u--input>
|
|
|
+ <u--input placeholder='请填写社保银行卡号' v-model="inputForm.socialSecurityBankNumber" @change="checkBankNumber(inputForm.socialSecurityBankNumber)" maxlength="19"></u--input>
|
|
|
</u-form-item>
|
|
|
|
|
|
<u-form-item label="社保卡照片正面" borderBottom prop="socialSecurityPictureFront">
|
|
@@ -172,8 +212,10 @@
|
|
|
</el-upload>
|
|
|
|
|
|
</u-form-item>
|
|
|
- <u-form-item>
|
|
|
- <el-button type="primary" @click="saveForm">提交</el-button>
|
|
|
+ <u-form-item style="margin-top: 20px; text-align: center;">
|
|
|
+ <el-button type="primary" @click="saveForm" style="width: 100%;">
|
|
|
+ <span style="margin: 0 auto;">提交</span>
|
|
|
+ </el-button>
|
|
|
</u-form-item>
|
|
|
</u--form>
|
|
|
</view>
|
|
@@ -247,17 +289,22 @@
|
|
|
}
|
|
|
],
|
|
|
'mobilePhone': [
|
|
|
- {
|
|
|
- required: true,
|
|
|
- message: '联系电话不能为空',
|
|
|
- trigger: ['blur', 'change']
|
|
|
- }],
|
|
|
- 'idCard': [
|
|
|
- {
|
|
|
- required: true,
|
|
|
- message: '身份证号码不能为空',
|
|
|
+ {
|
|
|
+ required: true,
|
|
|
+ message: '联系电话不能为空',
|
|
|
+ trigger: ['blur', 'change']
|
|
|
+ },
|
|
|
+ {
|
|
|
+ validator: (rule, value, callback) => this.validatePhone(value, callback),
|
|
|
+ trigger: ['blur', 'change']
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ 'idCard': [
|
|
|
+ {
|
|
|
+ validator: (rule, value, callback) => this.isCardId(value, callback),
|
|
|
trigger: ['blur', 'change']
|
|
|
- }]
|
|
|
+ }
|
|
|
+ ],
|
|
|
}
|
|
|
}
|
|
|
},
|
|
@@ -314,24 +361,51 @@
|
|
|
//定义表单规则
|
|
|
if (this.isNotEmpty(this.inputForm.socialSecurityNumber) && (this.isEmpty(this.inputForm.socialSecurityBankNumber) || isEmpty(this.inputForm.socialSecurityPictureFront))) {
|
|
|
this.loading = false
|
|
|
- this.$message.error('社保银行卡号与社保卡照片不能为空');
|
|
|
- throw new Error('社保银行卡号与社保卡照片不能为空')
|
|
|
+ // this.$message.error('社保银行卡号与社保卡照片不能为空');
|
|
|
+ // throw new Error('社保银行卡号与社保卡照片不能为空')
|
|
|
+ uni.showToast({
|
|
|
+ title: '社保银行卡号与社保卡照片不能为空',
|
|
|
+ icon: "none",
|
|
|
+ duration:2000
|
|
|
+ })
|
|
|
+
|
|
|
}
|
|
|
if (this.isNotEmpty(this.inputForm.socialSecurityBankNumber) && (this.isEmpty(this.inputForm.socialSecurityNumber) || this.isEmpty(this.inputForm.socialSecurityPictureFront))) {
|
|
|
this.loading = false
|
|
|
- this.$message.error('社保编号与社保卡照片不能为空');
|
|
|
- throw new Error('社保编号与社保卡照片不能为空')
|
|
|
+ // this.$message.error('社保编号与社保卡照片不能为空');
|
|
|
+ // throw new Error('社保编号与社保卡照片不能为空')
|
|
|
+ uni.showToast({
|
|
|
+ title: '社保编号与社保卡照片不能为空',
|
|
|
+ icon: "none",
|
|
|
+ duration:2000
|
|
|
+ })
|
|
|
}
|
|
|
if (this.isNotEmpty(this.inputForm.socialSecurityPictureFront) && (this.isEmpty(this.inputForm.socialSecurityNumber) || this.isEmpty(this.inputForm.socialSecurityBankNumber))) {
|
|
|
this.loading = false
|
|
|
- this.$message.error('社保编号与社保银行卡号不能为空');
|
|
|
- throw new Error('社保编号与社保银行卡号不能为空')
|
|
|
+ // this.$message.error('社保编号与社保银行卡号不能为空');
|
|
|
+ // throw new Error('社保编号与社保银行卡号不能为空')
|
|
|
+ uni.showToast({
|
|
|
+ title: '社保编号与社保银行卡号不能为空',
|
|
|
+ icon: "none",
|
|
|
+ duration:2000
|
|
|
+ })
|
|
|
+ }
|
|
|
+ if (this.isNotEmpty(this.inputForm.startTime)) {
|
|
|
+ this.inputForm.startTime = this.formatDate(this.inputForm.startTime);
|
|
|
+ }
|
|
|
+ if (this.isNotEmpty(this.inputForm.endTime)) {
|
|
|
+ this.inputForm.endTime = this.formatDate(this.inputForm.endTime);
|
|
|
}
|
|
|
+
|
|
|
this.$refs.inputForm.validate().then(res => {
|
|
|
uni.showLoading()
|
|
|
this.inputForm.type = '2'
|
|
|
enrollmentRegistrationService.save(this.inputForm).then((data) => {
|
|
|
// callback(data.businessTable, data.businessId)
|
|
|
+ // 接口调用成功,隐藏加载动画
|
|
|
+ uni.hideLoading();
|
|
|
+ //提交成功跳转页面
|
|
|
+ this.$router.push('/pages/human/enrollment/registration/saveOk'); // 替换 '/new-page' 为你想要跳转的页面路径
|
|
|
}).catch((e)=>{
|
|
|
|
|
|
})
|
|
@@ -339,24 +413,48 @@
|
|
|
|
|
|
})
|
|
|
},
|
|
|
+ formatDate(date) {
|
|
|
+ const year = date.getFullYear();
|
|
|
+ const month = (date.getMonth() + 1).toString().padStart(2, '0');
|
|
|
+ const day = date.getDate().toString().padStart(2, '0');
|
|
|
+ return `${year}-${month}-${day}`;
|
|
|
+ },
|
|
|
//身份证号码唯一性判断
|
|
|
idCardOnly(idCard) {
|
|
|
- enrollmentRegistrationService.findIdCardOnly(idCard).then((data) => {
|
|
|
- if (data !== 0) {
|
|
|
- this.$message.error('身份证号码已存在,请重新确认')
|
|
|
- this.inputForm.idCard = ''
|
|
|
- throw new Error('身份证号码已存在,请重新确认')
|
|
|
- }
|
|
|
- })
|
|
|
-
|
|
|
+ if (this.isNotEmpty(idCard)) {
|
|
|
+ enrollmentRegistrationService.findIdCardOnly(idCard).then((data) => {
|
|
|
+ if (data !== 0) {
|
|
|
+ // this.$message.error('身份证号码已存在,请重新确认')
|
|
|
+ // this.inputForm.idCard = ''
|
|
|
+ // throw new Error('身份证号码已存在,请重新确认')
|
|
|
+ uni.showToast({
|
|
|
+ title: '身份证号码已存在,请重新确认',
|
|
|
+ icon: "none",
|
|
|
+ duration:2000
|
|
|
+ })
|
|
|
+ this.inputForm.idCard = ''
|
|
|
+ } else {
|
|
|
+ const info = this.decomposeIdCard(idCard)
|
|
|
+ this.inputForm.sex = info.sex
|
|
|
+ this.inputForm.age = info.age
|
|
|
+ this.inputForm.birthday = info.birth
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
},
|
|
|
//联系电话唯一性判断
|
|
|
mobilePhoneOnly(mobilePhone) {
|
|
|
enrollmentRegistrationService.findMobilePhoneOnly(mobilePhone).then((data) => {
|
|
|
if (data !== 0) {
|
|
|
- this.$message.error('手机码已存在,请重新确认')
|
|
|
+ // this.$message.error('手机码已存在,请重新确认')
|
|
|
+ // this.inputForm.mobilePhone = ''
|
|
|
+ // throw new Error('联系电话已存在,请重新确认')
|
|
|
+ uni.showToast({
|
|
|
+ title: '联系电话已存在,请重新确认',
|
|
|
+ icon: "none",
|
|
|
+ duration:2000
|
|
|
+ })
|
|
|
this.inputForm.mobilePhone = ''
|
|
|
- throw new Error('联系电话已存在,请重新确认')
|
|
|
}
|
|
|
})
|
|
|
|
|
@@ -381,6 +479,184 @@
|
|
|
uni.navigateTo({
|
|
|
url: '/pages/human/enrollment/registration/EnrollmentRegistrationAddForm'
|
|
|
})
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * 从身份证号中获取出生日期、性别、年龄
|
|
|
+ * @param idCard
|
|
|
+ * @returns {{sex: string, birth: null, age: number}}
|
|
|
+ */
|
|
|
+ decomposeIdCard(idCard) {
|
|
|
+ let sex = null
|
|
|
+ let birth = null
|
|
|
+ let myDate = new Date()
|
|
|
+ let month = myDate.getMonth() + 1
|
|
|
+ let day = myDate.getDate()
|
|
|
+ let age = 0
|
|
|
+
|
|
|
+ if (idCard.length === 18) {
|
|
|
+ age = myDate.getFullYear() - idCard.substring(6, 10) - 1
|
|
|
+ sex = idCard.substring(16, 17)
|
|
|
+ birth = idCard.substring(6, 10) + '-' + idCard.substring(10, 12) + '-' + idCard.substring(12, 14)
|
|
|
+ // eslint-disable-next-line no-mixed-operators
|
|
|
+ if (idCard.substring(10, 12) < month || idCard.substring(10, 12) === month && idCard.substring(12, 14) <= day) age++
|
|
|
+
|
|
|
+ }
|
|
|
+ if (idCard.length === 15) {
|
|
|
+ age = myDate.getFullYear() - idCard.substring(6, 8) - 1901
|
|
|
+ sex = idCard.substring(13, 14)
|
|
|
+ birth = '19' + idCard.substring(6, 8) + '-' + idCard.substring(8, 10) + '-' + idCard.substring(10, 12)
|
|
|
+ // eslint-disable-next-line no-mixed-operators
|
|
|
+ if (idCard.substring(8, 10) < month || idCard.substring(8, 10) === month && idCard.substring(10, 12) <= day) age++
|
|
|
+ }
|
|
|
+
|
|
|
+ if (sex % 2 === 0) {
|
|
|
+ sex = '2' // 性别代码 1代表男,2代表女,暂时不涉及其他类型性别
|
|
|
+ } else {
|
|
|
+ sex = '1'
|
|
|
+ }
|
|
|
+ return {age, sex, birth}
|
|
|
+ },
|
|
|
+ validatePhone (str,callback) {
|
|
|
+ const phone = /(^(\d{3,4}-)?\d{6,8}$)|(^(\d{3,4}-)?\d{6,8}(-\d{1,5})?$)|(^(((13[0-9]{1})|(15[0-9]{1})|(16[0-9]{1})|(18[0-9]{1})|(17[0-9]{1})|(19[0-9]{1}))+\d{8})$)/
|
|
|
+ if (str && !phone.test(str)) {
|
|
|
+ callback(new Error('请输入正确的电话号码'))
|
|
|
+ } else {
|
|
|
+ callback()
|
|
|
+ }
|
|
|
+ },
|
|
|
+ isCardId(code,callback) {
|
|
|
+ let msg = "";
|
|
|
+ const city = {
|
|
|
+ 11: "北京",
|
|
|
+ 12: "天津",
|
|
|
+ 13: "河北",
|
|
|
+ 14: "山西",
|
|
|
+ 15: "内蒙古",
|
|
|
+ 21: "辽宁",
|
|
|
+ 22: "吉林",
|
|
|
+ 23: "黑龙江 ",
|
|
|
+ 31: "上海",
|
|
|
+ 32: "江苏",
|
|
|
+ 33: "浙江",
|
|
|
+ 34: "安徽",
|
|
|
+ 35: "福建",
|
|
|
+ 36: "江西",
|
|
|
+ 37: "山东",
|
|
|
+ 41: "河南",
|
|
|
+ 42: "湖北 ",
|
|
|
+ 43: "湖南",
|
|
|
+ 44: "广东",
|
|
|
+ 45: "广西",
|
|
|
+ 46: "海南",
|
|
|
+ 50: "重庆",
|
|
|
+ 51: "四川",
|
|
|
+ 52: "贵州",
|
|
|
+ 53: "云南",
|
|
|
+ 54: "西藏 ",
|
|
|
+ 61: "陕西",
|
|
|
+ 62: "甘肃",
|
|
|
+ 63: "青海",
|
|
|
+ 64: "宁夏",
|
|
|
+ 65: "新疆",
|
|
|
+ 71: "台湾",
|
|
|
+ 81: "香港",
|
|
|
+ 82: "澳门",
|
|
|
+ 91: "国外 ",
|
|
|
+ };
|
|
|
+ if (!this.isNull(code)) {
|
|
|
+ if (code.length === 18) {
|
|
|
+ if (!code || !/(^\d{18}$)|(^\d{17}(\d|X|x)$)/.test(code)) {
|
|
|
+ msg = "证件号码格式错误";
|
|
|
+ this.inputForm.idCard = ''
|
|
|
+ callback(new Error(msg));
|
|
|
+ } else if (!city[code.substr(0, 2)]) {
|
|
|
+ msg = "地址编码错误";
|
|
|
+ this.inputForm.idCard = ''
|
|
|
+ callback(new Error(msg));
|
|
|
+ } else {
|
|
|
+ // 18位身份证需要验证最后一位校验位
|
|
|
+ code = code.split("");
|
|
|
+ // ∑(ai×Wi)(mod 11)
|
|
|
+ // 加权因子
|
|
|
+ let factor = [
|
|
|
+ 7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2,
|
|
|
+ ];
|
|
|
+ // 校验位
|
|
|
+ let parity = [1, 0, "X", 9, 8, 7, 6, 5, 4, 3, 2, "x"];
|
|
|
+ let sum = 0;
|
|
|
+ let ai = 0;
|
|
|
+ let wi = 0;
|
|
|
+ for (let i = 0; i < 17; i++) {
|
|
|
+ ai = code[i];
|
|
|
+ wi = factor[i];
|
|
|
+ sum += ai * wi;
|
|
|
+ }
|
|
|
+ let last = parity[sum % 11];
|
|
|
+ if ("" + last !== "" + code[17]) {
|
|
|
+ msg = "证件号码校验位错误";
|
|
|
+ this.inputForm.idCard = ''
|
|
|
+ callback(new Error(msg));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ msg = "证件号码长度不为18位";
|
|
|
+ this.inputForm.idCard = ''
|
|
|
+ callback(new Error(msg));
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ msg = "证件号码不能为空";
|
|
|
+ this.inputForm.idCard = ''
|
|
|
+ callback(new Error(msg));
|
|
|
+ }
|
|
|
+ if (msg) {
|
|
|
+ callback();
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * 判断是否为空
|
|
|
+ */
|
|
|
+ isNull(val) {
|
|
|
+ if (val instanceof Array) {
|
|
|
+ if (val.length === 0) return true;
|
|
|
+ } else if (val instanceof Object) {
|
|
|
+ if (JSON.stringify(val) === "{}") return true;
|
|
|
+ } else {
|
|
|
+ if (
|
|
|
+ val === "null" ||
|
|
|
+ val == null ||
|
|
|
+ val === "undefined" ||
|
|
|
+ val === undefined ||
|
|
|
+ val === ""
|
|
|
+ )
|
|
|
+ return true;
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ },
|
|
|
+ validateInput() {
|
|
|
+ // 使用正则表达式验证输入内容,禁止中文
|
|
|
+ this.inputForm.socialSecurityNumber = this.inputForm.socialSecurityNumber.replace(/[\u4e00-\u9fa5]/g, '');
|
|
|
+ },
|
|
|
+ checkBankNumber(bankNumber) {
|
|
|
+ this.isBankNum(bankNumber)
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * 银行卡号验证
|
|
|
+ * 银行卡号:12位 16位 17 18 19
|
|
|
+ * @param str
|
|
|
+ * @returns {boolean}
|
|
|
+ */
|
|
|
+ isBankNum (str) {
|
|
|
+ const bankNumber = /^([1-9]{1})(\d{11}|\d{15}|\d{16}|\d{17}|\d{18})$/
|
|
|
+ if (!bankNumber.test(str)) {
|
|
|
+ uni.showToast({
|
|
|
+ title: '银行卡号填写不正确,请重新填写',
|
|
|
+ icon: "none",
|
|
|
+ duration:2000
|
|
|
+ })
|
|
|
+ this.inputForm.socialSecurityBankNumber = ''
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|