diff --git a/yudao-ui-admin-vue3/src/components/UserInfo/src/UserInfo.vue b/yudao-ui-admin-vue3/src/components/UserInfo/src/UserInfo.vue index 0d1fb480e..5bccbe429 100644 --- a/yudao-ui-admin-vue3/src/components/UserInfo/src/UserInfo.vue +++ b/yudao-ui-admin-vue3/src/components/UserInfo/src/UserInfo.vue @@ -6,6 +6,7 @@ import { useRouter } from 'vue-router' import { useDesign } from '@/hooks/web/useDesign' import avatarImg from '@/assets/imgs/avatar.gif' import { useUserStore } from '@/store/modules/user' +import { useTagsViewStore } from '@/store/modules/tagsView' const { t } = useI18n() @@ -15,6 +16,8 @@ const { push, replace } = useRouter() const userStore = useUserStore() +const tagsViewStore = useTagsViewStore() + const { getPrefixCls } = useDesign() const prefixCls = getPrefixCls('user-info') @@ -33,6 +36,7 @@ const loginOut = () => { }) .then(async () => { userStore.loginOut() + tagsViewStore.delAllViews replace('/login') }) .catch(() => {}) diff --git a/yudao-ui-admin-vue3/src/router/index.ts b/yudao-ui-admin-vue3/src/router/index.ts index 391e8b918..e844c5070 100644 --- a/yudao-ui-admin-vue3/src/router/index.ts +++ b/yudao-ui-admin-vue3/src/router/index.ts @@ -48,14 +48,14 @@ router.beforeEach(async (to, from, next) => { if (to.path === '/login') { next({ path: '/' }) } else { - console.info(3) // 获取所有字典 - const res = await listSimpleDictDataApi() - dictStore.setDictMap(res) + if (!dictStore.getHasDictData) { + const res = await listSimpleDictDataApi() + dictStore.setDictMap(res) + } if (userStore.getRoles.length === 0) { isRelogin.show = true isRelogin.show = false - console.info(2) // 后端过滤菜单 await permissionStore.generateRoutes() permissionStore.getAddRouters.forEach((route) => { @@ -66,7 +66,6 @@ router.beforeEach(async (to, from, next) => { const nextData = to.path === redirect ? { ...to, replace: true } : { path: redirect } next(nextData) } else { - console.info(3) next() } } diff --git a/yudao-ui-admin-vue3/src/store/modules/dict.ts b/yudao-ui-admin-vue3/src/store/modules/dict.ts index 28c2698a0..7cd1d725b 100644 --- a/yudao-ui-admin-vue3/src/store/modules/dict.ts +++ b/yudao-ui-admin-vue3/src/store/modules/dict.ts @@ -28,7 +28,7 @@ export const useDictStore = defineStore({ getDictMap(): Recordable { return this.dictMap }, - getHasDictData(): Boolean { + getHasDictData(): boolean { if (this.dictMap.length > 0) { return true } else {