From 88cb5497c5ae090d6d6ea4c981ae4aaebf0399cc Mon Sep 17 00:00:00 2001 From: xingyu4j Date: Mon, 21 Nov 2022 16:53:15 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E7=99=BB=E5=BD=95=E6=98=BE=E7=A4=BAloa?= =?UTF-8?q?ding?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/views/Login/components/LoginForm.vue | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/yudao-ui-admin-vue3/src/views/Login/components/LoginForm.vue b/yudao-ui-admin-vue3/src/views/Login/components/LoginForm.vue index 3c7ad6692..5d7b224ce 100644 --- a/yudao-ui-admin-vue3/src/views/Login/components/LoginForm.vue +++ b/yudao-ui-admin-vue3/src/views/Login/components/LoginForm.vue @@ -147,7 +147,8 @@ import { ElCol, ElLink, ElRow, - ElDivider + ElDivider, + ElLoading } from 'element-plus' import { reactive, ref, unref, onMounted, computed, watch } from 'vue' import * as LoginApi from '@/api/login' @@ -247,6 +248,11 @@ const handleLogin = async (params) => { if (!res) { return } + ElLoading.service({ + lock: true, + text: '正在加载系统中...', + background: 'rgba(0, 0, 0, 0.7)' + }) if (loginData.loginForm.rememberMe) { Cookies.set('username', loginData.loginForm.username, { expires: 30 }) Cookies.set('password', encrypt(loginData.loginForm.password), { expires: 30 }) @@ -265,6 +271,11 @@ const handleLogin = async (params) => { push({ path: redirect.value || permissionStore.addRouters[0].path }) } catch { loginLoading.value = false + } finally { + setTimeout(() => { + const loadingInstance = ElLoading.service() + loadingInstance.close() + }, 400) } }