不生效的校验

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