Skip to content

Commit 31f8876

Browse files
author
piexlmax
committed
增加登录遮罩
1 parent 6731e67 commit 31f8876

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

web/src/pinia/modules/user.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
import { login, getUserInfo, setSelfInfo } from '@/api/user'
22
import { jsonInBlacklist } from '@/api/jwt'
33
import router from '@/router/index'
4-
import { ElMessage } from 'element-plus'
4+
import { ElLoading, ElMessage } from 'element-plus'
55
import { defineStore } from 'pinia'
66
import { ref, computed, watch } from 'vue'
77
import { useRouterStore } from './router'
88

99
export const useUserStore = defineStore('user', () => {
10+
const loadingInstance = ref(null)
11+
1012
const userInfo = ref({
1113
uuid: '',
1214
nickName: '',
@@ -48,6 +50,10 @@ export const useUserStore = defineStore('user', () => {
4850
}
4951
/* 登录*/
5052
const LoginIn = async(loginInfo) => {
53+
loadingInstance.value = ElLoading.service({
54+
fullscreen: true,
55+
text: '登陆中,请稍候...',
56+
})
5157
const res = await login(loginInfo)
5258
if (res.code === 0) {
5359
setUserInfo(res.data.user)
@@ -128,6 +134,7 @@ export const useUserStore = defineStore('user', () => {
128134
sideMode,
129135
setToken,
130136
baseColor,
131-
activeColor
137+
activeColor,
138+
loadingInstance
132139
}
133140
})

web/src/view/layout/index.vue

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222
<el-row class="pd-0">
2323
<el-col :xs="2" :lg="1" :md="1" :sm="1" :xl="1" style="z-index:100">
2424
<div class="menu-total" @click="totalCollapse">
25-
<div v-if="isCollapse" class="gvaIcon gvaIcon-arrow-double-right"></div>
26-
<div v-else class="gvaIcon gvaIcon-arrow-double-left"></div>
25+
<div v-if="isCollapse" class="gvaIcon gvaIcon-arrow-double-right" />
26+
<div v-else class="gvaIcon gvaIcon-arrow-double-left" />
2727
</div>
2828
</el-col>
2929
<el-col :xs="10" :lg="14" :md="14" :sm="9" :xl="14" :pull="1">
@@ -158,6 +158,9 @@ onMounted(() => {
158158
emitter.emit('mobile', isMobile.value)
159159
})()
160160
}
161+
if (userStore.loadingInstance) {
162+
userStore.loadingInstance.close()
163+
}
161164
})
162165
163166
const userStore = useUserStore()

0 commit comments

Comments
 (0)