mirror of
https://github.com/fumiama/paper-manager.git
synced 2026-06-11 03:20:24 +08:00
edit login
This commit is contained in:
@@ -39,7 +39,7 @@
|
||||
<LoginForm />
|
||||
<ForgetPasswordForm />
|
||||
<RegisterForm />
|
||||
<MobileForm />
|
||||
<!-- <MobileForm /> -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -53,7 +53,7 @@
|
||||
import LoginForm from './LoginForm.vue'
|
||||
import ForgetPasswordForm from './ForgetPasswordForm.vue'
|
||||
import RegisterForm from './RegisterForm.vue'
|
||||
import MobileForm from './MobileForm.vue'
|
||||
// import MobileForm from './MobileForm.vue'
|
||||
import { useGlobSetting } from '/@/hooks/setting'
|
||||
import { useI18n } from '/@/hooks/web/useI18n'
|
||||
import { useDesign } from '/@/hooks/web/useDesign'
|
||||
|
||||
@@ -48,21 +48,26 @@
|
||||
<Button type="primary" size="large" block @click="handleLogin" :loading="loading">
|
||||
{{ t('sys.login.loginButton') }}
|
||||
</Button>
|
||||
<!-- <Button size="large" class="mt-4 enter-x" block @click="handleRegister">
|
||||
<Button
|
||||
size="large"
|
||||
class="mt-4 enter-x"
|
||||
block
|
||||
@click="setLoginState(LoginStateEnum.REGISTER)"
|
||||
>
|
||||
{{ t('sys.login.registerButton') }}
|
||||
</Button> -->
|
||||
</Button>
|
||||
</FormItem>
|
||||
<ARow class="enter-x">
|
||||
<ACol :md="8" :xs="24">
|
||||
<Button block @click="setLoginState(LoginStateEnum.MOBILE)">
|
||||
<!-- <ACol :md="8" :xs="24">
|
||||
<Button block @click="setLoginState(LoginStateEnum.MOBILE)">
|
||||
{{ t('sys.login.mobileSignInFormTitle') }}
|
||||
</Button>
|
||||
</ACol>
|
||||
<ACol :md="6" :xs="24">
|
||||
</ACol> -->
|
||||
<!-- <ACol :md="6" :xs="24">
|
||||
<Button block @click="setLoginState(LoginStateEnum.REGISTER)">
|
||||
{{ t('sys.login.registerButton') }}
|
||||
</Button>
|
||||
</ACol>
|
||||
</ACol> -->
|
||||
</ARow>
|
||||
</Form>
|
||||
</template>
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
[LoginStateEnum.RESET_PASSWORD]: t('sys.login.forgetFormTitle'),
|
||||
[LoginStateEnum.LOGIN]: t('sys.login.signInFormTitle'),
|
||||
[LoginStateEnum.REGISTER]: t('sys.login.signUpFormTitle'),
|
||||
[LoginStateEnum.MOBILE]: t('sys.login.mobileSignInFormTitle'),
|
||||
// [LoginStateEnum.MOBILE]: t('sys.login.mobileSignInFormTitle'),
|
||||
}
|
||||
return titleObj[unref(getLoginState)]
|
||||
})
|
||||
|
||||
@@ -7,8 +7,8 @@ export enum LoginStateEnum {
|
||||
LOGIN,
|
||||
REGISTER,
|
||||
RESET_PASSWORD,
|
||||
MOBILE,
|
||||
QR_CODE,
|
||||
// MOBILE,
|
||||
// QR_CODE,
|
||||
}
|
||||
|
||||
const currentState = ref(LoginStateEnum.LOGIN)
|
||||
@@ -43,8 +43,8 @@ export function useFormRules(formData?: Recordable) {
|
||||
|
||||
const getAccountFormRule = computed(() => createRule(t('sys.login.accountPlaceholder')))
|
||||
const getPasswordFormRule = computed(() => createRule(t('sys.login.passwordPlaceholder')))
|
||||
const getSmsFormRule = computed(() => createRule(t('sys.login.smsPlaceholder')))
|
||||
const getMobileFormRule = computed(() => createRule(t('sys.login.mobilePlaceholder')))
|
||||
// const getSmsFormRule = computed(() => createRule(t('sys.login.smsPlaceholder')))
|
||||
// const getMobileFormRule = computed(() => createRule(t('sys.login.mobilePlaceholder')))
|
||||
|
||||
const validatePolicy = async (_: RuleObject, value: boolean) => {
|
||||
return !value ? Promise.reject(t('sys.login.policyPlaceholder')) : Promise.resolve()
|
||||
@@ -65,13 +65,13 @@ export function useFormRules(formData?: Recordable) {
|
||||
const getFormRules = computed((): { [k: string]: ValidationRule | ValidationRule[] } => {
|
||||
const accountFormRule = unref(getAccountFormRule)
|
||||
const passwordFormRule = unref(getPasswordFormRule)
|
||||
const smsFormRule = unref(getSmsFormRule)
|
||||
const mobileFormRule = unref(getMobileFormRule)
|
||||
// const smsFormRule = unref(getSmsFormRule)
|
||||
// const mobileFormRule = unref(getMobileFormRule)
|
||||
|
||||
const mobileRule = {
|
||||
/*const mobileRule = {
|
||||
sms: smsFormRule,
|
||||
mobile: mobileFormRule,
|
||||
}
|
||||
}*/
|
||||
switch (unref(currentState)) {
|
||||
// register form rules
|
||||
case LoginStateEnum.REGISTER:
|
||||
@@ -82,19 +82,19 @@ export function useFormRules(formData?: Recordable) {
|
||||
{ validator: validateConfirmPassword(formData?.password), trigger: 'change' },
|
||||
],
|
||||
policy: [{ validator: validatePolicy, trigger: 'change' }],
|
||||
...mobileRule,
|
||||
// ...mobileRule,
|
||||
}
|
||||
|
||||
// reset password form rules
|
||||
case LoginStateEnum.RESET_PASSWORD:
|
||||
return {
|
||||
account: accountFormRule,
|
||||
...mobileRule,
|
||||
// ...mobileRule,
|
||||
}
|
||||
|
||||
// mobile form rules
|
||||
case LoginStateEnum.MOBILE:
|
||||
return mobileRule
|
||||
/*case LoginStateEnum.MOBILE:
|
||||
return mobileRule*/
|
||||
|
||||
// login form rules
|
||||
default:
|
||||
|
||||
Reference in New Issue
Block a user