From 677158701afb1a196837a70a0a49d4fb7f1e9922 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E8=96=AA=E5=90=8D?= <942005050@qq.com> Date: Sun, 4 Feb 2024 14:29:23 +0800 Subject: [PATCH] login --- src/views/login/components/LoginForm.vue | 284 ++++++++++++++++++ src/views/login/components/LoginFormTitle.vue | 26 ++ src/views/login/components/MobileForm.vue | 225 ++++++++++++++ src/views/login/components/QrCodeForm.vue | 30 ++ src/views/login/components/RegisterForm.vue | 142 +++++++++ src/views/login/components/SSOLogin.vue | 199 ++++++++++++ src/views/login/components/index.ts | 8 + src/views/login/components/useLogin.ts | 42 +++ src/views/login/login.vue | 104 +++++++ 9 files changed, 1060 insertions(+) create mode 100644 src/views/login/components/LoginForm.vue create mode 100644 src/views/login/components/LoginFormTitle.vue create mode 100644 src/views/login/components/MobileForm.vue create mode 100644 src/views/login/components/QrCodeForm.vue create mode 100644 src/views/login/components/RegisterForm.vue create mode 100644 src/views/login/components/SSOLogin.vue create mode 100644 src/views/login/components/index.ts create mode 100644 src/views/login/components/useLogin.ts create mode 100644 src/views/login/login.vue diff --git a/src/views/login/components/LoginForm.vue b/src/views/login/components/LoginForm.vue new file mode 100644 index 000000000..6c235f45a --- /dev/null +++ b/src/views/login/components/LoginForm.vue @@ -0,0 +1,284 @@ + + + + diff --git a/src/views/login/components/LoginFormTitle.vue b/src/views/login/components/LoginFormTitle.vue new file mode 100644 index 000000000..cdf4facce --- /dev/null +++ b/src/views/login/components/LoginFormTitle.vue @@ -0,0 +1,26 @@ + + diff --git a/src/views/login/components/MobileForm.vue b/src/views/login/components/MobileForm.vue new file mode 100644 index 000000000..ebb36b84e --- /dev/null +++ b/src/views/login/components/MobileForm.vue @@ -0,0 +1,225 @@ + + + + diff --git a/src/views/login/components/QrCodeForm.vue b/src/views/login/components/QrCodeForm.vue new file mode 100644 index 000000000..31d28453e --- /dev/null +++ b/src/views/login/components/QrCodeForm.vue @@ -0,0 +1,30 @@ + + diff --git a/src/views/login/components/RegisterForm.vue b/src/views/login/components/RegisterForm.vue new file mode 100644 index 000000000..23b3bd428 --- /dev/null +++ b/src/views/login/components/RegisterForm.vue @@ -0,0 +1,142 @@ + + diff --git a/src/views/login/components/SSOLogin.vue b/src/views/login/components/SSOLogin.vue new file mode 100644 index 000000000..f31ab0e5f --- /dev/null +++ b/src/views/login/components/SSOLogin.vue @@ -0,0 +1,199 @@ + + diff --git a/src/views/login/components/index.ts b/src/views/login/components/index.ts new file mode 100644 index 000000000..204ad73d0 --- /dev/null +++ b/src/views/login/components/index.ts @@ -0,0 +1,8 @@ +import LoginForm from './LoginForm.vue' +import MobileForm from './MobileForm.vue' +import LoginFormTitle from './LoginFormTitle.vue' +import RegisterForm from './RegisterForm.vue' +import QrCodeForm from './QrCodeForm.vue' +import SSOLoginVue from './SSOLogin.vue' + +export { LoginForm, MobileForm, LoginFormTitle, RegisterForm, QrCodeForm, SSOLoginVue } diff --git a/src/views/login/components/useLogin.ts b/src/views/login/components/useLogin.ts new file mode 100644 index 000000000..b4a02f8f1 --- /dev/null +++ b/src/views/login/components/useLogin.ts @@ -0,0 +1,42 @@ +import { Ref } from 'vue' + +export enum LoginStateEnum { + LOGIN, + REGISTER, + RESET_PASSWORD, + MOBILE, + QR_CODE, + SSO +} + +const currentState = ref(LoginStateEnum.LOGIN) + +export function useLoginState() { + function setLoginState(state: LoginStateEnum) { + currentState.value = state + } + const getLoginState = computed(() => currentState.value) + + function handleBackLogin() { + setLoginState(LoginStateEnum.LOGIN) + } + + return { + setLoginState, + getLoginState, + handleBackLogin + } +} + +export function useFormValid(formRef: Ref) { + async function validForm() { + const form = unref(formRef) + if (!form) return + const data = await form.validate() + return data as T + } + + return { + validForm + } +} diff --git a/src/views/login/login.vue b/src/views/login/login.vue new file mode 100644 index 000000000..a0025ab66 --- /dev/null +++ b/src/views/login/login.vue @@ -0,0 +1,104 @@ + + + +