不生效的校验

This commit is contained in:
shijingjing
2022-11-25 16:42:28 +08:00
parent 78ae2fedcc
commit 75af293c60

View File

@@ -349,7 +349,7 @@ export default {
watch: {
startAreaId: {
handler(v) {
if(v.length) {
if(v?.length) {
this.getRiskLevel(v)
}
}
@@ -460,14 +460,20 @@ export default {
},
submit() {
if (!this.form.idNumber) {
if(!this.form.idNumber) {
return this.$toast('请输入身份证号')
}
if (!/(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/.test(this.form.idNumber)) {
return this.$toast('请输入正确的身份证账号')
if(this.form.idNumber) {
let reg = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/
if (!reg.test(this.form.idNumber)) {
return this.$toast('请输入正确的身份证账号')
}
else {
console.log('没有生效');
}
}
if (!this.form.name) {
return this.$toast('请输入姓名')
}