From 21decad50c33ee74e4513b7365ce78765d4a43a3 Mon Sep 17 00:00:00 2001 From: xlzy <1017866168@qq.com> Date: Mon, 27 Mar 2023 23:14:20 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E6=9B=B4=E6=96=B0=E3=80=91=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E6=B8=85=E9=99=A4=E7=BC=93=E5=AD=98=E4=B9=8B=E5=90=8E?= =?UTF-8?q?=EF=BC=8C=E5=A4=B4=E5=83=8F=E6=B2=A1=E6=9C=89=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- snowy-admin-web/src/store/global.js | 5 +++++ snowy-admin-web/src/views/auth/login/util.js | 3 +++ 2 files changed, 8 insertions(+) diff --git a/snowy-admin-web/src/store/global.js b/snowy-admin-web/src/store/global.js index c6689ed4..f90940fa 100644 --- a/snowy-admin-web/src/store/global.js +++ b/snowy-admin-web/src/store/global.js @@ -27,6 +27,9 @@ const getCacheConfig = (value) => { return data } +/** + * deprecated 请使用 useGlobalStore + */ export const globalStore = defineStore({ id: 'global', state: () => ({ @@ -95,3 +98,5 @@ export const globalStore = defineStore({ } } }) + +export const useGlobalStore = globalStore diff --git a/snowy-admin-web/src/views/auth/login/util.js b/snowy-admin-web/src/views/auth/login/util.js index 672c4c6b..03a01f5c 100644 --- a/snowy-admin-web/src/views/auth/login/util.js +++ b/snowy-admin-web/src/views/auth/login/util.js @@ -4,11 +4,14 @@ import dictApi from '@/api/dev/dictApi' import router from '@/router' import tool from '@/utils/tool' import { message } from 'ant-design-vue' +import { useGlobalStore } from '@/store' export const afterLogin = async (loginToken) => { tool.data.set('TOKEN', loginToken) // 获取登录的用户信息 const loginUser = await loginApi.getLoginUser() + const globalStore = useGlobalStore() + globalStore.setUserInfo(loginUser) tool.data.set('USER_INFO', loginUser) // 获取用户的菜单