| | |
| | | */ |
| | | export function verifyPhone(val: string) { |
| | | // false: 手机号码不正确 |
| | | if (!/^((12[0-9])|(13[0-9])|(14[5|7])|(15([0-3]|[5-9]))|(18[0|1,5-9]))\d{8}$/.test(val)) return false; |
| | | if (!/^((12[0-9])|(13[0-9])|(14[5|7])|(15([0-3]|[5-9]))|(17([7-9]))|(18[0|1,5-9]))\d{8}$/.test(val)) return false; |
| | | // true: 手机号码正确 |
| | | else return true; |
| | | } |
| | |
| | | * @param val 当前值字符串 |
| | | * @returns 返回 true: 强密码正确 |
| | | */ |
| | | export function verifyPasswordPowerful(val: string) { |
| | | |
| | | export function verifyPwd(val: string) { |
| | | // false: 强密码不正确 |
| | | if (!/^(?![a-zA-z]+$)(?!\d+$)(?![!@#$%^&\.*]+$)(?![a-zA-z\d]+$)(?![a-zA-z!@#$%^&\.*]+$)(?![\d!@#$%^&\.*]+$)[a-zA-Z\d!@#$%^&\.*]{6,16}$/.test(val)) return false; |
| | | if (!/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[.\-/!@#$%^&*()_+])[A-Za-z\d.\-/!@#$%^&*()_+]{8,}$/.test(val)) return false; |
| | | // true: 强密码正确 |
| | | else return true; |
| | | } |
| | |
| | | // true:车牌号正确 |
| | | else return true; |
| | | } |
| | | |
| | | export function checkChineseName (name:string) { |
| | | let reg = /^[\u4e00-\u9fa5]{2,15}$/; |
| | | // 保留点后,用来校验的姓名,也是最终校验通过后返回的姓名 |
| | | let payerName = name.replaceAll(" ", "") |
| | | .replaceAll(" ", "") |
| | | .replaceAll("•", "·") |
| | | .replaceAll(".", "·"); |
| | | // 去除所有点后,用来校验的姓名 |
| | | let checkName = name.replaceAll(" ", "") |
| | | .replaceAll(" ", "") |
| | | .replaceAll("•", "") |
| | | .replaceAll(".", "") |
| | | .replaceAll("·", ""); |
| | | if(checkName.length === 1){ |
| | | // this.$message({ |
| | | // type:'warning', |
| | | // message:'姓名至少包含两位汉字' |
| | | // }) |
| | | return false; |
| | | } |
| | | if (reg.test(checkName)) { |
| | | if(payerName.substring(0,1) === '·'){ |
| | | // this.$message({ |
| | | // type:'warning', |
| | | // message:'姓名第一位不能为“·”' |
| | | // }) |
| | | return false; |
| | | } |
| | | if(payerName.substring(payerName.length - 1) === '·'){ |
| | | // this.$message({ |
| | | // type:'warning', |
| | | // message:'姓名最后不能为“·”' |
| | | // }) |
| | | return false; |
| | | } |
| | | if(payerName.indexOf("··") !== -1){ |
| | | // this.$message({ |
| | | // type:'warning', |
| | | // message:'姓名不能有连续的“·”' |
| | | // }) |
| | | return false; |
| | | } |
| | | return payerName; |
| | | } else { |
| | | // this.$message({ |
| | | // type:'warning', |
| | | // message:'姓名中只能包含汉字和“·”' |
| | | // }) |
| | | return false; |
| | | } |
| | | } |