mirror of
				https://gitee.com/hhyykk/ipms-sjy.git
				synced 2025-10-31 10:18:42 +08:00 
			
		
		
		
	perf: store
This commit is contained in:
		| @@ -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(() => {}) | ||||
|   | ||||
| @@ -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() | ||||
|       } | ||||
|     } | ||||
|   | ||||
| @@ -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 { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 xingyu
					xingyu