diff --git a/src/hooks/web/useCache.ts b/src/hooks/web/useCache.ts index 6d2a93183..38b816a9e 100644 --- a/src/hooks/web/useCache.ts +++ b/src/hooks/web/useCache.ts @@ -13,7 +13,8 @@ export const CACHE_KEY = { THEME: 'theme', LAYOUT: 'layout', ROLE_ROUTERS: 'roleRouters', - DICT_CACHE: 'dictCache' + DICT_CACHE: 'dictCache', + DEPT: 'dept' } export const useCache = (type: CacheType = 'localStorage') => { diff --git a/src/views/Login/components/LoginForm.vue b/src/views/Login/components/LoginForm.vue index 9499f4970..6c235f45a 100644 --- a/src/views/Login/components/LoginForm.vue +++ b/src/views/Login/components/LoginForm.vue @@ -87,6 +87,9 @@ import * as LoginApi from '@/api/login' import { LoginStateEnum, useFormValid, useLoginState } from './useLogin' import { getCodeImg } from "@/api/login"; +import { CACHE_KEY, useCache } from '@/hooks/web/useCache' +import * as DeptApi from '@/api/system/dept' + defineOptions({ name: 'LoginForm' }) const { t } = useI18n() @@ -212,6 +215,9 @@ const handleLogin = async (params) => { console.log(redirect.value) push({ path: redirect.value || permissionStore.addRouters[0].path }) } + // 存储 部门信息 + const { wsCache } = useCache() + wsCache.set(CACHE_KEY.DEPT, await DeptApi.getSimpleDeptList()) } finally { getCode() loginLoading.value = false