外国人永久居留身份证增加长度校验

This commit is contained in:
liu.xiaofeng@ebiz-digits.com
2024-01-18 15:08:27 +08:00
parent 2ca8936ec7
commit 264b83f27c
3 changed files with 80 additions and 51 deletions

View File

@@ -29,29 +29,29 @@ function getSearchString (key) {
} }
return obj[key] return obj[key]
} }
let apiVersion = 'v2' let apiVersion = 'v1'
var ua = window.navigator.userAgent.toLowerCase() // var ua = window.navigator.userAgent.toLowerCase()
//通过正则表达式匹配ua中是否含有MicroMessenger字符串, 在微信 // //通过正则表达式匹配ua中是否含有MicroMessenger字符串, 在微信
if (localStorage.getItem('apiVersion')) { // if (localStorage.getItem('apiVersion')) {
apiVersion = localStorage.getItem('apiVersion') // apiVersion = localStorage.getItem('apiVersion')
} else { // } else {
if (ua.match(/MicroMessenger/i) == 'micromessenger') { // if (ua.match(/MicroMessenger/i) == 'micromessenger') {
//report/reportList数据报表页面在浏览器可以打开了但在微信或企业微信中打开不了,接口请求不需要token // //report/reportList数据报表页面在浏览器可以打开了但在微信或企业微信中打开不了,接口请求不需要token
if (window.location.href.indexOf('apiVersion') > 0) { // if (window.location.href.indexOf('apiVersion') > 0) {
apiVersion = getSearchString('apiVersion') == 'V3' ? 'v3' : 'v2';//url中apiVersion没有时为v2 // apiVersion = getSearchString('apiVersion') == 'V3' ? 'v3' : 'v2';//url中apiVersion没有时为v2
} else { // } else {
apiVersion = 'v3' // apiVersion = 'v3'
} // }
} else { // } else {
// 在app // // 在app
if (navigator.userAgent.indexOf('JZG_') > 0) { // if (navigator.userAgent.indexOf('JZG_') > 0) {
apiVersion = navigator.userAgent.split('JZG_')[1].split('/')[0].split('_')[1] == 'V3' ? 'v3' : 'v2' // apiVersion = navigator.userAgent.split('JZG_')[1].split('/')[0].split('_')[1] == 'V3' ? 'v3' : 'v2'
} // }
} // }
window.localStorage.setItem('apiVersion', apiVersion) // window.localStorage.setItem('apiVersion', apiVersion)
} // }
// 可以多个接口域名,按需添加 // // 可以多个接口域名,按需添加
console.log('环境:', process.env.VUE_APP_FLAG) // console.log('环境:', process.env.VUE_APP_FLAG)
switch (process.env.VUE_APP_FLAG) { switch (process.env.VUE_APP_FLAG) {
case 'dev': case 'dev':
apiDomain = 'https://iagentsales-test2.e-guofu.com:5200/api/' + apiVersion // 国富api ///api/v1 apiDomain = 'https://iagentsales-test2.e-guofu.com:5200/api/' + apiVersion // 国富api ///api/v1

View File

@@ -773,8 +773,6 @@
this.isNewPeopleFlagTipshow = true this.isNewPeopleFlagTipshow = true
}, },
workcompanys(list) { workcompanys(list) {
// 单位数据
console.log(list)
this.userWorkcompanys = list this.userWorkcompanys = list
}, },
setCustomerMarriage(marriageCode) { setCustomerMarriage(marriageCode) {
@@ -1606,9 +1604,10 @@
} }
}, },
getRelatedData(val, source) { getRelatedData(val, source) {
if (this.userInfo.idType != '1') { if (this.userInfo.idType != '1' && this.userInfo.idType != '8') {
return return
} }
if(this.userInfo.idType == '1'){
//如果证件校验不通过,恢复默认值 //如果证件校验不通过,恢复默认值
if (idToData(val).text) { if (idToData(val).text) {
;[this.userInfo.idNo, this.userInfo.sex, this.userInfo.birthday, this.effectiveDateTypeAble] = ['', '0', '', false] ;[this.userInfo.idNo, this.userInfo.sex, this.userInfo.birthday, this.effectiveDateTypeAble] = ['', '0', '', false]
@@ -1636,6 +1635,12 @@
} else { } else {
// this.userInfo.effectiveDateType = false // this.userInfo.effectiveDateType = false
} }
}
if(this.userInfo.idType == '8'){
this.userInfo.birthday = idToData(val).birthday
this.userInfo.sex = idToData(val).sex
console.log(this.userInfo.birthday)
}
}, },
}, },

View File

@@ -24,6 +24,30 @@ export function idToData(idNo) {
text: '您填写的证件号码有误' text: '您填写的证件号码有误'
} }
} }
console.log('12321321321')
let birthday = getBirthById(idNo)
let age = utilsAge.getAge(birthday, new Date())
let sex = getSexById(idNo)
return {
birthday,
age,
sex
}
}
//外国人永久居留身份证带出出生日期,性别,年龄
export function idToData8(idNo) {
//非空
if (!idNo.trim()) {
return {
text: '证件号码不能为空'
}
}
if (idNo.length != 15 && idNo.length != 18) {
return {
text: '外国人永久居留身份证位数有误'
}
}
let birthday = getBirthById(idNo) let birthday = getBirthById(idNo)
let age = utilsAge.getAge(birthday, new Date()) let age = utilsAge.getAge(birthday, new Date())
let sex = getSexById(idNo) let sex = getSexById(idNo)