Commit 5c8ef4de by 李伟康

fix(equity): 修复表单验证规则中的正则表达式问题

更新了联系电话和证件号码的验证逻辑。联系电话现在使用更严格的正则表达式
验证手机号码格式。证件号码验证移除了对 cardType 的依赖,统一使用 18 位数字
或字母的验证规则。
1 parent d757948e
......@@ -731,7 +731,8 @@ const EQUITY_FORM_RULE = {
{ required: true, message: '联系电话不能为空' },
{
validator: (rule, value) => {
return !data.phoneRex.test(value) ? { message: '请输入正确的手机号' } : null
const phoneRex = /^[1]([3-9])[0-9]{9}$/;
return !phoneRex.test(value) ? { message: '请输入正确的手机号' } : null
}
}
],
......@@ -739,8 +740,8 @@ const EQUITY_FORM_RULE = {
{ required: true, message: '证件号码不能为空' },
{
validator: (rule, value) => {
let reg = value.cardType == 1 || value.cardType == 2 ? /[a-zA-Z0-9]{18}/.test(value) : /\S\s{0,18}/.test(value)
let tip = value.cardType == 1 || value.cardType == 2 ? '证件号码请输入18位数字或字母' : '证件号码不能为空'
let reg = /[a-zA-Z0-9]{18}/.test(value)
let tip = '证件号码请输入18位数字或字母'
return reg ? null : { message: tip }
},
trigger: 'change'
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!