diff --git a/src/components/Home/Login/CommonLogin.vue b/src/components/Home/Login/CommonLogin.vue index 748422e..af29d94 100644 --- a/src/components/Home/Login/CommonLogin.vue +++ b/src/components/Home/Login/CommonLogin.vue @@ -48,7 +48,7 @@
登录管理系统 @@ -85,7 +85,7 @@ import { onMounted, reactive, ref } from 'vue' import { loginRules } from '@/utils/element/elRules' import { getLocalStorage, setLocalStorage } from 'vue3-common/utils/storageUtil' import { ILoginType } from '@/types/auth' -import {isMobile} from "vue3-common/utils/layoutUtil"; +import { isMobile } from 'vue3-common/utils/layoutUtil' const rules = reactive(loginRules) const authStore = useAuthStore() @@ -104,20 +104,22 @@ onMounted(() => { const handleLogin = async (type: ILoginType) => { loginFormRef.value.validate(async (valid: any) => { if (valid) { - authStore.loginLoading = true - if (type === 'common' && !isMobile()) { - ElMessage.error("目前只支持移动端") - authStore.loginLoading = false + ElMessage.error('目前只支持移动端') return } if (type === 'admin' && isMobile()) { - ElMessage.error("目前只支持PC端") - authStore.loginLoading = false + ElMessage.error('目前只支持PC端') return } + if (type === 'common') { + authStore.loginLoading = true + } else { + authStore.loginAdminLoading = true + } + try { await authStore.handleLogin(type) userStore.handleSession(authStore.homeSession) @@ -134,6 +136,7 @@ const handleLogin = async (type: ILoginType) => { } } finally { authStore.loginLoading = false + authStore.loginAdminLoading = false } } else { ElMessage.error('请输入正确的信息') diff --git a/src/store/auth.ts b/src/store/auth.ts index c02c331..4e58e62 100644 --- a/src/store/auth.ts +++ b/src/store/auth.ts @@ -21,6 +21,7 @@ export const useAuthStore = defineStore('auth', { }, loginType: 'common' as ILoginType, loginLoading: false, + loginAdminLoading: false, isVerified: false, isGettingCode: false, getCodeCountdown: 60,