身份证校验

This commit is contained in:
liuye
2022-11-25 16:12:00 +08:00
parent da5041030b
commit 7cf13ed4df

View File

@@ -202,7 +202,9 @@ export default {
if (!this.form.idNumber && this.fromType != 1) {
return this.$u.toast('请输入身份证号')
}
if (!/(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/.test(this.form.idNumber) && this.fromType != 1) {
let reg = /^[1-9]\d{5}(18|19|20)\d{2}((0[1-9])|(1[0-2]))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/;
if (this.form.idNumber.length == 18 && !reg.test(this.form.idNumber) && this.fromType != 1) {
return this.$u.toast('请输入正确的身份证账号')
}
if (!this.form.phone && this.fromType != 1) {