Commit 2c516a5a authored by 吴春's avatar 吴春

1

parent f1bf7e10
...@@ -1536,22 +1536,24 @@ ...@@ -1536,22 +1536,24 @@
//中国护照验证逻辑 //中国护照验证逻辑
isValidPassport: function () { isValidPassport: function () {
var isCheck = true; var isCheck = true;
if (this.addMsg.PassportNo.length !== 9) { if(this.addMsg.Nationality===this.NationalityId){
this.$message.error("请输入9位护照号") if (this.addMsg.PassportNo.length !== 9) {
isCheck = false; this.$message.error("请输入9位护照号")
return;
}
if (this.addMsg.Nationality === 2) {
// 单个字母开头(E或G)后跟8位数字
const pattern1 = /^[EGH][0-9]{8}$/;
// 两个字母开头(E开头,第二个字母不能是I或O)后跟7位数字
const pattern2 = /^E[A-HJ-NP-Z][0-9]{7}$/;
this.PassportNoSure = pattern1.test(this.addMsg.PassportNo) || pattern2.test(this.addMsg.PassportNo);
if (!this.PassportNoSure) {
this.$message.error("护照格式不正确")
isCheck = false; isCheck = false;
return; return;
} }
if (this.addMsg.Nationality === 2) {
// 单个字母开头(E或G)后跟8位数字
const pattern1 = /^[EGH][0-9]{8}$/;
// 两个字母开头(E开头,第二个字母不能是I或O)后跟7位数字
const pattern2 = /^E[A-HJ-NP-Z][0-9]{7}$/;
this.PassportNoSure = pattern1.test(this.addMsg.PassportNo) || pattern2.test(this.addMsg.PassportNo);
if (!this.PassportNoSure) {
this.$message.error("护照格式不正确")
isCheck = false;
return;
}
}
} }
return isCheck; return isCheck;
}, },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment