1777777777
a.substr(0, 3) + "****" + a.substr(6, 11)
手机号校验
export function validatorMobile(rule: any, mobile: string | number, callback: Function) {
// 允许空值,若需必填请添加多验证规则
if (!mobile) {
return callback()
}
if (!/^(1[3-9])\d{9}$/.test(mobile.toString())) {
return callback(new Error("请输入正确的手机号"))
}
return callback()
}
export function checkPwd(value:any){
var pattern1 = /([0-9]+)/;
var pattern2 = /([a-z]+)/;
var pattern3 = /([A-Z]+)/;
var title = ''
var pattern4 = /\s+/g;
//限制密码的位数在8-20位之间
if(value.length<10){
title ='密码最少为10位'
}
if(!pattern1.exec(value) || !pattern2.exec(value) || !pattern3.exec(value)){
title ='密码需包含字母大小写与数字组合'
}
if(pattern4.exec(value)){
title ='不能有空格、换行、tab缩进等所有的空白'
}
return title
}