验证规则
验证规则
ruleValidate: { // 新增用户--弹出框--字段验证
loginName: [
{ required: true, message: '不能为空', trigger: 'blur' },
{ pattern: /^([a-zA-Z0-9!@#$%^&*/()\-_=+{};:,<.>]{5,20})$/, message: '请输入5~20位,字母|数字|符号(!@#&-_ )', trigger: 'blur' }
],
userName: [
{ required: true, message: '不能为空', trigger: 'blur' },
{ pattern: /^[\u4e00-\u9fa5]+$/, message: '格式错误,仅支持中文输入', trigger: 'blur' }
],
phone: [
// { pattern: /^1\d{10}$/, message: '手机号码不正确', trigger: 'blur' },
{ required: true, message: '不能为空', trigger: 'blur' },
{ pattern: /^\d{11}$/, message: '格式错误,仅支持11位数字' }
],
email: [
{ required: true, message: '不能为空', trigger: 'blur' }
],
sex: [
{ required: true, message: '不能为空', trigger: 'blur' }
],
userCode: [
{ required: true, message: '不能为空', trigger: 'blur' },
{ pattern: /^[0-9a-zA-Z]+$/, message: '格式错误,仅支持英文和数字' }
],
identityCard: [
{ required: true, message: '不能为空', trigger: 'blur' },
{ pattern: /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/, message: '格式错误,请输入正确的身份证号' }
]
},