mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2024-11-30 11:11:55 +08:00
perf: 登录显示loading
This commit is contained in:
parent
33fbe43ff6
commit
88cb5497c5
@ -147,7 +147,8 @@ import {
|
|||||||
ElCol,
|
ElCol,
|
||||||
ElLink,
|
ElLink,
|
||||||
ElRow,
|
ElRow,
|
||||||
ElDivider
|
ElDivider,
|
||||||
|
ElLoading
|
||||||
} from 'element-plus'
|
} from 'element-plus'
|
||||||
import { reactive, ref, unref, onMounted, computed, watch } from 'vue'
|
import { reactive, ref, unref, onMounted, computed, watch } from 'vue'
|
||||||
import * as LoginApi from '@/api/login'
|
import * as LoginApi from '@/api/login'
|
||||||
@ -247,6 +248,11 @@ const handleLogin = async (params) => {
|
|||||||
if (!res) {
|
if (!res) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
ElLoading.service({
|
||||||
|
lock: true,
|
||||||
|
text: '正在加载系统中...',
|
||||||
|
background: 'rgba(0, 0, 0, 0.7)'
|
||||||
|
})
|
||||||
if (loginData.loginForm.rememberMe) {
|
if (loginData.loginForm.rememberMe) {
|
||||||
Cookies.set('username', loginData.loginForm.username, { expires: 30 })
|
Cookies.set('username', loginData.loginForm.username, { expires: 30 })
|
||||||
Cookies.set('password', encrypt(loginData.loginForm.password), { 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 })
|
push({ path: redirect.value || permissionStore.addRouters[0].path })
|
||||||
} catch {
|
} catch {
|
||||||
loginLoading.value = false
|
loginLoading.value = false
|
||||||
|
} finally {
|
||||||
|
setTimeout(() => {
|
||||||
|
const loadingInstance = ElLoading.service()
|
||||||
|
loadingInstance.close()
|
||||||
|
}, 400)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user