外国人永久居住证证件号码长度为15位的时候去掉生日和性别校验

This commit is contained in:
liu.xiaofeng@ebiz-digits.com
2024-02-23 09:31:25 +08:00
parent 04f6a287eb
commit 77ebee1efe

View File

@@ -52,16 +52,16 @@ function getBirthById(idNo) {
}
function getSexById(idNo) {
if(idNo.length == 15){
// 获取性别
if (idNo.charAt(13) >= '0' && idNo.charAt(13) <= '9') {
if (parseInt(idNo.charAt(13)) % 2 == 0) {
return '1'
} else {
return '0'
}
}
}
// if(idNo.length == 15){
// // 获取性别
// if (idNo.charAt(13) >= '0' && idNo.charAt(13) <= '9') {
// if (parseInt(idNo.charAt(13)) % 2 == 0) {
// return '1'
// } else {
// return '0'
// }
// }
// }
if(idNo.length == 18) {
// 获取性别
if (idNo.charAt(16) >= '0' && idNo.charAt(16) <= '9') {
@@ -109,19 +109,19 @@ export function idNoCheck8(userInfo,type) {
}
}
}
if(userInfo.idNo.length == 15) {
// 获取生日
let year = '19' + userInfo.idNo.substr(7, 2)
let month = userInfo.idNo.substr(9, 2)
let day = userInfo.idNo.substr(11, 2)
let thisBirthday = year + '-' + month + '-' + day
if(thisBirthday != userInfo.birthday) {
console.log('12321321321',thisBirthday)
return {
text: '出生日期必须与证件号码中的生日一致'
}
}
}
// if(userInfo.idNo.length == 15) {
// // 获取生日
// let year = '19' + userInfo.idNo.substr(7, 2)
// let month = userInfo.idNo.substr(9, 2)
// let day = userInfo.idNo.substr(11, 2)
// let thisBirthday = year + '-' + month + '-' + day
// if(thisBirthday != userInfo.birthday) {
// console.log('12321321321',thisBirthday)
// return {
// text: '出生日期必须与证件号码中的生日一致'
// }
// }
// }
if(userInfo.idNo.length == 18) {
// 获取生日
let year = userInfo.idNo.substr(6, 4)
@@ -134,14 +134,15 @@ export function idNoCheck8(userInfo,type) {
}
}
}
let thisSex = getSexById(userInfo.idNo)
if(thisSex != userInfo.sex) {
console.log('sexxxxxx',thisSex)
console.log('sexxxxxx',userInfo.sex)
return {
text: '性别必须与证件号码中的一致'
if(userInfo.idNo.length == 18){
let thisSex = getSexById(userInfo.idNo)
if(thisSex != userInfo.sex) {
return {
text: '性别必须与证件号码中的一致'
}
}
}
if (userInfo.nativeplace == '1' || userInfo.nativeplace == '2' || userInfo.nativeplace == '3' || userInfo.nativeplace == '4') {
return {
text: '外国人永久居留身份证不能选择中国国籍'