From 1f26c30a8d1c5e3d9ab262b382284c8ea96f29b2 Mon Sep 17 00:00:00 2001 From: 马宇豪 <978517621@qq.com> Date: 星期二, 05 十一月 2024 15:47:17 +0800 Subject: [PATCH] 修改密码 --- src/utils/toolsValidate.ts | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 files changed, 56 insertions(+), 3 deletions(-) diff --git a/src/utils/toolsValidate.ts b/src/utils/toolsValidate.ts index 434466e..8033a29 100644 --- a/src/utils/toolsValidate.ts +++ b/src/utils/toolsValidate.ts @@ -210,7 +210,7 @@ */ 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; } @@ -256,9 +256,10 @@ * @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; } @@ -366,3 +367,55 @@ // 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; + } +} -- Gitblit v1.9.2