Browse Source

注册页面 企业名称表单 添加汉字验证

master
邓宏 3 months ago
parent
commit
67c0ab8210
  1. 16
      pages/home/register.vue

16
pages/home/register.vue

@ -58,21 +58,25 @@ export default {
password: "",
},
rules:{
name:{required:true, message:"企业名称必填!", trigger:"blur"},
name:{required:true, validator(rule,val,call){
if(!val)call(new Error("请输入企业名称!"));
else if(!/^[\u4e00-\u9fa5]+$/.test(val))call(new Error('请输入汉字!'));
else call();
}, trigger:"blur"},
creditCode:{required:true, validator(rule, val, call){
if(!val)call(new Error('统一社会信用代码必填!'));
if(!val)call(new Error('请输入统一社会信用代码!'));
else if(!/^([0-9A-HJ-NPQRTUWXY]{2}\d{6}[0-9A-HJ-NPQRTUWXY]{10}|[1-9]\d{14})$/.test(val))call(new Error('请输入正确的统一社会信用代码格式!'));
else call()
}, trigger:"blur"},
type:{required:true, message:"企业类型必选!", trigger:"blur"},
connectUser:{required:true, message:"企业联系人必填!", trigger:"blur"},
type:{required:true, message:"请选择企业类型!", trigger:"blur"},
connectUser:{required:true, message:"请输入企业联系人!", trigger:"blur"},
connectPhone:{required:true, validator(rule, val, call){
if(!val)call(new Error("手机号码必填!"));
if(!val)call(new Error("请输入手机号码!"));
else if(!/^1(3\d|4[5-9]|5[0-35-9]|6[567]|7[0-8]|8\d|9[0-35-9])\d{8}$/.test(val))call(new Error("请输入正确的手机号码格式!"));
else call()
}, trigger:"blur"},
password:{required:true, validator(rule,val,call){
if(!val)call(new Error('密码必填!'));
if(!val)call(new Error('请输入密码!'));
else if(!/^(?=.*\d)(?=.*[a-zA-Z])(?=.*[^\da-zA-Z\s]).+$/.test(val))call(new Error('密码格式为(大小写字母、数字、特殊字符)!'));
else call();
}, trigger:"blur"},

Loading…
Cancel
Save