|
@@ -50,7 +50,7 @@
|
|
|
</el-input>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="密码" prop="password">
|
|
|
- <el-input size="large" v-model="form.password" type="password" show-password placeholder="请输入登录密码">
|
|
|
+ <el-input size="large" v-model="form.password" type="password" show-password placeholder="请输入包含英文字母大小写、数字和特殊符号的 8-16 位组合">
|
|
|
<template #prefix>
|
|
|
<el-icon>
|
|
|
<Unlock />
|
|
@@ -124,11 +124,20 @@ const validatePhoneNumber = (rule, value, callback) => {
|
|
|
}
|
|
|
callback()
|
|
|
}
|
|
|
+const passwordValValidate = (rule, value, callback) => {
|
|
|
+ if (!value) {
|
|
|
+ return callback(new Error('请输入密码'))
|
|
|
+ } else if (/^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[._~!@#$^&*])[A-Za-z0-9._~!@#$^&*]{8,16}$/g.test(value)) {
|
|
|
+ return callback()
|
|
|
+ } else {
|
|
|
+ return callback(new Error('请输入包含英文字母大小写、数字和特殊符号的 8-16 位组合'))
|
|
|
+ }
|
|
|
+}
|
|
|
const rules = reactive({
|
|
|
nick_name: [{ required: true, message: '请输入昵称', trigger: 'blur' }],
|
|
|
phone: [{ required: true, validator: validatePhoneNumber, trigger: 'blur' }],
|
|
|
account: [{ required: true, message: '请输入账号', trigger: 'blur' }],
|
|
|
- password: [{ required: true, message: '请输入密码', trigger: 'blur' }],
|
|
|
+ password: [{ required: true, validator: passwordValValidate, trigger: 'blur' }],
|
|
|
email: [{ required: true, message: '请输入电子邮箱', trigger: 'blur' }],
|
|
|
type: [{ required: true, message: '请选择注册类型', trigger: 'blur' }],
|
|
|
role: [{ required: true, message: '请选择角色', trigger: 'blur' }],
|