修复已知问题
This commit is contained in:
@@ -15,6 +15,9 @@ const PASSWORD_REGEX = /^(?=.*[A-Za-z])(?=.*\d)[A-Za-z\d@$!%*#?&]{8,}$/
|
||||
/** 交易密码(必须是6位数字) */
|
||||
const TRANSACTION_PASSWORD_REGEX = /^\d{6}$/
|
||||
|
||||
/** 群号码(只能是数字,至少3位,最多11位)*/
|
||||
const GROUP_NUMBER_REGEX = /^\d{3,11}$/
|
||||
|
||||
/**
|
||||
* 校验手机号
|
||||
* @param {string} phone - 待校验的手机号
|
||||
@@ -102,3 +105,22 @@ export const validateTransactionPassword = (password, name = '密码') => {
|
||||
}
|
||||
return { valid: true, message: '' }
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验群号码
|
||||
* @param {string} groupNumber - 待校验的群号码
|
||||
* @returns {{ valid: boolean, message: string }}
|
||||
*/
|
||||
export const validateGroupNumber = groupNumber => {
|
||||
if (!groupNumber) return { valid: false, message: '群号码不能为空' }
|
||||
if (groupNumber.length < 3) {
|
||||
return { valid: false, message: '群号码长度不能少于3位' }
|
||||
}
|
||||
if (groupNumber.length > 11) {
|
||||
return { valid: false, message: '群号码长度不能超过11位' }
|
||||
}
|
||||
if (!GROUP_NUMBER_REGEX.test(groupNumber)) {
|
||||
return { valid: false, message: '群号码只能是数字' }
|
||||
}
|
||||
return { valid: true, message: '' }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user