* 手机号校验规则 (工信部2019年最新公布)
/**手机号正则*/
export const phoneRule = /^(?:(?:\+|00)86)?1(?:(?:3[\d])|(?:4[5-79])|(?:5[0-35-9])|(?:6[5-7])|(?:7[0-8])|(?:8[\d])|(?:9[189]))\d{8}$/;
/**手机号校验*/
export const phoneFun = (params) => {
const regex = new RegExp(phoneRule);
return regex.test(params)
}
* 身份证 校验规则(一代、二代)
/**身份证正则*/
export const cardIdRule = /(^\d{8}(0\d|10|11|12)([0-2]\d|30|31)\d{3}$)|(^\d{6}(18|19|20)\d{2}(0[1-9]|10|11|12)([0-2]\d|30|31)\d{3}(\d|X|x)$)/;
/***身份证校验*/
export const cardIdFun = (params) => {
const regex = new RegExp(cardIdRule);
return regex.test(params)
}
* 英文和数字 校验规则
/**英文和数字正则*/
export const numEnsRule = /^[A-Za-z0-9]+$/;
/**英文和数字校验*/
export const numEnsRuleFun = (params) => {
const