49 lines
1.4 KiB
JavaScript
49 lines
1.4 KiB
JavaScript
export function emailFormItem(name) {
|
||
return {
|
||
type: 'input-email',
|
||
name: name,
|
||
label: '邮箱',
|
||
placeholder: '请输入邮箱',
|
||
required: true,
|
||
clearable: true,
|
||
clearValueOnEmpty: true,
|
||
validateApi: '${base}/user/exists_username/${username}',
|
||
}
|
||
}
|
||
|
||
export function passwordFormItem(name, label = '密码') {
|
||
return {
|
||
type: 'input-password',
|
||
name: name,
|
||
label: label,
|
||
placeholder: `请输入${label}`,
|
||
required: true,
|
||
clearable: true,
|
||
clearValueOnEmpty: true,
|
||
validations: {
|
||
matchRegexp:
|
||
/^(?=.*\d)(?!.*(\d)\1{2})(?!.*(012|123|234|345|456|567|678|789|987|876|765|654|543|432|321|210))(?=.*[a-zA-Z])(?=.*[^\da-zA-Z\s]).{8,16}$/,
|
||
},
|
||
validationErrors: {
|
||
matchRegexp:
|
||
`${label}至少包含字母、数字、特殊字符,8-16位,并且不能连续出现3个大小连续或相同的数字`,
|
||
},
|
||
}
|
||
}
|
||
|
||
export function confirmPasswordFormItem(name, target, label = '密码') {
|
||
return {
|
||
type: 'input-password',
|
||
name: name,
|
||
label: `确认${label}`,
|
||
placeholder: `请再次输入${label}`,
|
||
required: true,
|
||
clearable: true,
|
||
validations: {
|
||
equalsField: target,
|
||
},
|
||
validationErrors: {
|
||
equalsField: `两次输入${label}不一致`,
|
||
},
|
||
}
|
||
} |