Skip to content

Commit 490c38a

Browse files
author
piexlmax
committed
调整用户切换角色路由跳转逻辑
1 parent 1f21e39 commit 490c38a

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

web/src/view/layout/aside/historyComponent/history.vue

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,10 @@ const initPage = () => {
311311
activeValue.value = window.sessionStorage.getItem('activeValue')
312312
}
313313
setTab(route)
314+
if (window.sessionStorage.getItem('needCloseAll') === 'true') {
315+
closeAll()
316+
window.sessionStorage.removeItem('needCloseAll')
317+
}
314318
}
315319
initPage()
316320

web/src/view/layout/index.vue

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,9 @@ import { setUserAuthority } from '@/api/user'
118118
import { emitter } from '@/utils/bus.js'
119119
import { computed, ref, onMounted, nextTick } from 'vue'
120120
import { useRouter, useRoute } from 'vue-router'
121-
import { useUserStore } from '@/pinia/modules/user'
122121
import { useRouterStore } from '@/pinia/modules/router'
123122
import { fmtTitle } from '@/utils/fmtRouterTitle'
123+
import { useUserStore } from '@/pinia/modules/user'
124124
125125
const router = useRouter()
126126
const route = useRoute()
@@ -202,10 +202,8 @@ const changeUserAuth = async(id) => {
202202
authorityId: id
203203
})
204204
if (res.code === 0) {
205-
emitter.emit('closeAllPage')
206-
setTimeout(() => {
207-
window.location.reload()
208-
}, 50)
205+
window.sessionStorage.setItem('needCloseAll', 'true')
206+
window.location.reload()
209207
}
210208
}
211209

0 commit comments

Comments
 (0)