//获取路由参数exportconstgetQueryString=(name: any)=>{const reg =newRegExp("(^|&)"+ name +"=([^&]*)(&|$)");const search = location.href.match(/\?(.*)/);if(search){const r = search[1].match(reg);if(r !=null){returndecodeURI(r[2]);}}returnnull;};
// 身份证号校验exportconstidValidation=(idCard: any)=>{var regIdCard =/^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])((\d{4})|\d{3}[Xx])$/,
flag =true;if(!regIdCard.test(idCard)){
console.log("身份证号格式输入错误1", idCard);
flag =false;}else{if(idCard.length ==18){var idCardWi =newArray(7,9,10,5,8,4,2,1,6,3,7,9,10,5,8,4,2);var idCardY =newArray(1,0,10,9,8,7,6,5,4,3,2);var idCardWiSum =0;for(var i =0; i <17; i++){
idCardWiSum += idCard.substring(i, i +1)* idCardWi[i];}var idCardMod = idCardWiSum %11;var idCardLast = idCard.substring(17);if(idCardMod ==2){if(!(idCardLast =="X"|| idCardLast =="x")){
console.log("身份证号输入错误2");
flag =false;}}else{if(idCardLast != idCardY[idCardMod]){
console.log("身份证号输入错误3");
flag =false;}}}}return flag;};
//名字格式校验exportconstnameValidation=(name: any)=>{// var reg = /^([\u4E00-\u9FA5\uf900-\ufa2d·s]{2,20}|[a-zA-Z.s]{1,30})$/g,let reg =/(^[\u4e00-\u9fa5]{2,20}(·[\u4e00-\u9fa5]{2,20})*$)|(^([A-Za-z]\s*){1,30}$)/;let flag =true;
name = name.trim()if(!reg.test(name)||/^(null|undefined)$/gi.test(name)){
console.log("名字格式不正确");
flag =false;}return flag;};
//手机号格式校验exportconstnameValidation=(phoneNum: any)=>{var reg =/^1[0-9]{10}$/,
flag =true;if(!reg.test(phoneNum)){
console.log("手机号格式输入不正确!", phoneNum);
flag =false;}return flag;};