diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts index 1d4d4629..1a9b1932 100644 --- a/src/store/modules/user.ts +++ b/src/store/modules/user.ts @@ -9,6 +9,8 @@ import { parseUrlPath } from '@/plugins/file-static-url'; /**用户信息类型 */ type UserInfo = { + /**用户ID */ + userId: string; /**登录账号 */ userName: string; /**用户角色 字符串数组 */ @@ -31,6 +33,7 @@ type UserInfo = { const useUserStore = defineStore('user', { state: (): UserInfo => ({ + userId: '', userName: '', roles: [], permissions: [], @@ -109,6 +112,7 @@ const useUserStore = defineStore('user', { const res = await getInfo(); if (res.code === RESULT_CODE_SUCCESS && res.data) { const { user, roles, permissions } = res.data; + this.userId = user.userId; // 登录账号 this.userName = user.userName; // 用户头像