const reg =/(^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$)|(^[1-9]\d{7}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}$)/;if(reg.test(value)){//18位身份证需要验证最后一位校验位if(value.length ==18){let valueList = value.split('');//∑(ai×Wi)(mod 11)//加权因子let factor =[7,9,10,5,8,4,2,1,6,3,7,9,10,5,8,4,2];//校验位let parity =[1,0,'X',9,8,7,6,5,4,3,2];let sum =0;let ai =0;let wi =0;for(let i =0; i <17; i++){
ai = value[i];
wi = factor[i];
sum += ai * wi;}if(parity[sum %11]!= valueList[17].toUpperCase()){returncallback(newError('该身份证号校验未通过'));}}callback()}else{returncallback(newError('请输入正确的身份证号'));}