feat:登录-新增用户账号登录 验证码 ipBlock

1. 新增 登录的 图形校验码
2. 遗落问题,登录页的提交,表单全部统一了。没有区分类型,而且类型的枚举和校验没真正使用。还有其他功能如注册,改密码都没开出来
This commit is contained in:
lvjunzhao
2025-04-10 17:12:15 +08:00
parent 54fa34028e
commit daae3c89e7
6 changed files with 231 additions and 7 deletions

View File

@ -9,6 +9,7 @@ export enum LoginStateEnum {
RESET_PASSWORD,
MOBILE,
QR_CODE,
LOGIN_WITH_CAPTCHA,
}
const currentState = ref(LoginStateEnum.LOGIN);
@ -43,6 +44,7 @@ export function useFormRules(formData?: Recordable) {
const getAccountFormRule = computed(() => createRule(t('请输入账号')));
const getPasswordFormRule = computed(() => createRule(t('请输入密码')));
const getCaptchaCodeFormRule = computed(() => createRule(t('请输入图形验证码')));
const getSmsFormRule = computed(() => createRule(t('请输入验证码')));
const getMobileFormRule = computed(() => createRule(t('请输入手机号码')));
@ -65,6 +67,7 @@ export function useFormRules(formData?: Recordable) {
const getFormRules = computed((): { [k: string]: ValidationRule | ValidationRule[] } => {
const accountFormRule = unref(getAccountFormRule);
const passwordFormRule = unref(getPasswordFormRule);
const captchaCodeFormRule = unref(getCaptchaCodeFormRule);
const smsFormRule = unref(getSmsFormRule);
const mobileFormRule = unref(getMobileFormRule);
@ -96,6 +99,14 @@ export function useFormRules(formData?: Recordable) {
case LoginStateEnum.MOBILE:
return mobileRule;
// 枚举没实现,暂不适用
case LoginStateEnum.LOGIN_WITH_CAPTCHA:
return {
account: accountFormRule,
password: passwordFormRule,
captchaCode: captchaCodeFormRule,
};
// login form rules
default:
return {