diff --git a/src/api/common/base/entity/index.ts b/src/api/common/base/entity/index.ts index 9fc3edf..651d049 100644 --- a/src/api/common/base/entity/index.ts +++ b/src/api/common/base/entity/index.ts @@ -38,9 +38,30 @@ export interface CasUser { /** SSO扩展用户模型 */ export interface KiccUser extends CasUser { - deptId: string; + // 扩展用户ID + id: string; + // CAS用户ID + casUserId: string; + // 用户类型 userType: string; - exPermissions: string[]; + // 所属部门ID + deptId: string; + // 所属部门名称 + deptName: string; + // 地图标记点位置图片旋转值 + mapOrientation: number; + // 地图设计器默认中心点位置 + mapCenter: string; + // 用户状态 + status: string; + // 指定登录后首页跳转 + homePath?: string; + // 角色ID权限 + roleIds: string[]; + // 菜单按钮权限 + permissions: string[]; + // 多租户ID集合 + tenantIds: string[]; [key: string]: any; } diff --git a/src/api/platform/core/controller/user.ts b/src/api/platform/core/controller/user.ts index db306a9..17363fd 100644 --- a/src/api/platform/core/controller/user.ts +++ b/src/api/platform/core/controller/user.ts @@ -4,7 +4,8 @@ * author wangxiang4 */ -import type { Captcha, LoginParams, TokenEnhancer, UserVo } from '../entity/user'; +import type { Captcha, LoginParams, TokenEnhancer } from '../entity/user'; +import { KiccUser } from '/@/api/common/base/entity'; import { encryptionLogin } from '/@/utils/cipher'; import { defHttp } from '/@/utils/http/axios'; import qs from 'qs'; @@ -45,7 +46,7 @@ export const login = (params: LoginParams) => { }; /** 获取当前用户信息 */ -export const getUserInfo = () => defHttp.get({ url: Api.getUserInfo }); +export const getUserInfo = () => defHttp.get({ url: Api.getUserInfo }); /** 登出 */ export const logout = () => defHttp.delete({ url: Api.logout }, { errorMessageMode: 'none'}); diff --git a/src/api/platform/core/entity/user.ts b/src/api/platform/core/entity/user.ts index cf27435..4414c4d 100644 --- a/src/api/platform/core/entity/user.ts +++ b/src/api/platform/core/entity/user.ts @@ -32,35 +32,6 @@ export interface TokenEnhancer { user_info: CasUser; } -/** 用户VO对象 */ -export interface UserVo extends SsoUser { - // 系统用户id - id: string; - // CAS用户ID - casUserId: string; - // 用户类型 - userType: string; - // 所属部门ID - deptId: string; - // 所属部门名称 - deptName: string; - // 地图标记点位置图片旋转值 - mapOrientation: number; - // 地图设计器默认中心点位置 - mapCenter: string; - // 用户状态 - status: string; - // 指定登录后首页跳转 - homePath?: string; - // 前端项目配置多租户选择集合 - tenantIds: string[]; - // 角色ID权限 - roleIds: string[]; - // 菜单按钮权限 - permissions: string[]; - [key: string]: any; -} - /** 验证码对象 */ export interface Captcha { // 验证码地址 diff --git a/src/api/platform/system/controller/ssoUser.ts b/src/api/platform/system/controller/ssoUser.ts index 61f9a7b..9e44fd7 100644 --- a/src/api/platform/system/controller/ssoUser.ts +++ b/src/api/platform/system/controller/ssoUser.ts @@ -5,7 +5,7 @@ */ import type { SsoUserParams, SsoUser ,SsoUserResult } from '/@/api/platform/system/entity/ssoUser'; import { defHttp } from '/@/utils/http/axios'; -import { UserVo } from '/@/api/platform/core/entity/user'; +import { KiccUser } from '/@/api/common/base/entity'; enum Api { list = '/system_proxy/system/ssoUser/list', @@ -35,4 +35,4 @@ export const updatePwd = (params: Partial) => defHttp.put({ url: Api.up export const resetPwd = (params: Partial) => defHttp.put({ url: Api.resetPwd, data: params }); -export const updateSsoUserAndExUser = (params: Partial) => defHttp.put({ url: Api.updateSsoUserAndExUser, data: params }); +export const updateSsoUserAndExUser = (params: Partial) => defHttp.put({ url: Api.updateSsoUserAndExUser, data: params }); diff --git a/src/api/platform/system/controller/user.ts b/src/api/platform/system/controller/user.ts index 33560aa..a843fae 100644 --- a/src/api/platform/system/controller/user.ts +++ b/src/api/platform/system/controller/user.ts @@ -4,8 +4,7 @@ * author wangxiang4 */ import type { UserParams, User, UserResult } from '/@/api/platform/system/entity/user'; -import type { UserVo } from '/@/api/platform/core/entity/user'; -import type { ResultVo } from '/@/api/common/base/entity'; +import type { KiccUser, ResultVo } from '/@/api/common/base/entity'; import { defHttp } from '/@/utils/http/axios'; enum Api { @@ -46,7 +45,7 @@ export const changeTenant = (tenantIds: string[]) => defHttp.get({ url: `${Api.c export const resetTenant = () => defHttp.get({ url: Api.resetTenant }); /** 获取全部快递员集合 */ -export const getCourierUserList = () => defHttp.get({ url: Api.getCourierUserList }); +export const getCourierUserList = () => defHttp.get({ url: Api.getCourierUserList }); /** 获取用户类型集合 */ export const getUserTypeList = () => defHttp.get({ url: Api.getUserTypeList }); diff --git a/src/api/platform/system/entity/user.ts b/src/api/platform/system/entity/user.ts index 03987f6..b948b0e 100644 --- a/src/api/platform/system/entity/user.ts +++ b/src/api/platform/system/entity/user.ts @@ -7,7 +7,7 @@ */ import type { R } from '/#/axios'; import type { CommonEntity, Page } from '/@/api/common/data/entity'; -import { UserVo } from '/@/api/platform/core/entity/user'; +import { KiccUser } from '/@/api/common/base/entity'; /** 用户查询参数 */ export type UserParams = Page & User; @@ -36,4 +36,4 @@ export interface User extends CommonEntity { } /** 用户响应对象 */ -export type UserResult = R; +export type UserResult = R; diff --git a/src/layouts/default/header/components/user-dropdown/index.vue b/src/layouts/default/header/components/user-dropdown/index.vue index 46bb816..4cb5f1c 100644 --- a/src/layouts/default/header/components/user-dropdown/index.vue +++ b/src/layouts/default/header/components/user-dropdown/index.vue @@ -50,7 +50,7 @@ import { createAsyncComponent } from '/@/utils/factory/createAsyncComponent'; import { useRouter } from 'vue-router'; type MenuEvent = 'logout' | 'doc' | 'lock' | 'accountSettings' | 'userCenter'; - import type { UserVo } from '/@/api/platform/core/entity/user'; + import { KiccUser } from '/@/api/common/base/entity'; import DropMenuItem from './DropMenuItem.vue'; export default defineComponent({ @@ -71,7 +71,7 @@ const { getUseLockPage } = useHeaderSetting(); const userStore = useUserStore(); - const getUserInfo = computed((): UserVo => userStore.getUserInfo || {}); + const getUserInfo = computed((): KiccUser => userStore.getUserInfo || {}); const { push } = useRouter(); const [register, { openModal }] = useModal(); diff --git a/src/store/modules/lock.ts b/src/store/modules/lock.ts index 851cd43..4b922b2 100644 --- a/src/store/modules/lock.ts +++ b/src/store/modules/lock.ts @@ -47,7 +47,7 @@ export const useLockStore = defineStore({ // 浏览器缓存已经清空,需要重新登录验证当前用户密码 const tryLogin = async () => { try { - const username = userStore.getUserInfo.userName; + const username = userStore.getUserInfo.username; const res = await userStore.login({ username, password: password, diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts index 02ab444..1430f74 100644 --- a/src/store/modules/user.ts +++ b/src/store/modules/user.ts @@ -10,7 +10,8 @@ import { store } from '/@/store'; import { PageEnum } from '/@/enums/pageEnum'; import { ACCESS_TOKEN_KEY, PERMISSIONS_KEY, REFRESH_TOKEN_KEY, ROLE_IDS_KEY, USER_INFO_KEY } from '/@/enums/cacheEnum'; import { getAuthCache, setAuthCache } from '/@/utils/auth'; -import { UserVo, LoginParams } from '/@/api/platform/core/entity/user'; +import { KiccUser } from '/@/api/common/base/entity'; +import { LoginParams } from '/@/api/platform/core/entity/user'; import { logout, getUserInfo, login } from '/@/api/platform/core/controller/user'; import { useI18n } from '/@/hooks/web/useI18n'; import { useMessage } from '/@/hooks/web/useMessage'; @@ -27,7 +28,7 @@ import { merge } from 'lodash-es'; import { RequestOptions } from '/#/axios'; interface UserState { - userInfo: Nullable; + userInfo: Nullable; sessionTimeout?: boolean; lastUpdateTime: number; roleIds: string[]; @@ -40,7 +41,7 @@ export const useUserStore = defineStore({ id: 'app-user', state: (): UserState => ({ // 用户信息 - userInfo: getAuthCache(USER_INFO_KEY), + userInfo: getAuthCache(USER_INFO_KEY), // 登录是否过期记录(确保下次登陆不刷新路由直接还原) sessionTimeout: false, // 最后一次性更新用户信息时间(用于页面刷新更新用户数据) @@ -55,7 +56,7 @@ export const useUserStore = defineStore({ refresh_token: getAuthCache(REFRESH_TOKEN_KEY), }), getters: { - getUserInfo(): UserVo { + getUserInfo(): KiccUser { return this.userInfo || {}; }, getAccessToken(): string { @@ -94,7 +95,7 @@ export const useUserStore = defineStore({ this.refresh_token = refreshToken; setAuthCache(REFRESH_TOKEN_KEY, refreshToken); }, - setUserInfo(userInfo: Nullable) { + setUserInfo(userInfo: Nullable) { this.userInfo = userInfo; this.lastUpdateTime = new Date().getTime(); setAuthCache(USER_INFO_KEY, userInfo); @@ -111,7 +112,7 @@ export const useUserStore = defineStore({ this.setPermissions([]); }, /** 登录 */ - async login(params: LoginParams): Promise { + async login(params: LoginParams): Promise { try { const { goHome = true, clientId = '', ...loginParams } = params; // 处理自定义授权客户端 @@ -134,7 +135,7 @@ export const useUserStore = defineStore({ } }, /** 登录成功后动作 */ - async afterLoginAction(goHome?: boolean): Promise { + async afterLoginAction(goHome?: boolean): Promise { if (!this.getAccessToken) return null; // 获取用户信息 const userInfo = await this.getUserInfoAction(); @@ -157,7 +158,7 @@ export const useUserStore = defineStore({ return userInfo; }, /** 获取用户信息 */ - async getUserInfoAction(): Promise { + async getUserInfoAction(): Promise { const { apiUrl } = useGlobSetting(); const { t } = useI18n(); try { diff --git a/src/utils/cache/persistent.ts b/src/utils/cache/persistent.ts index 3a8ddb6..b1804fb 100644 --- a/src/utils/cache/persistent.ts +++ b/src/utils/cache/persistent.ts @@ -8,7 +8,7 @@ */ import type { LockInfo } from '/#/store'; -import type { UserVo } from '/@/api/platform/core/entity/user'; +import { KiccUser } from '/@/api/common/base/entity'; import type { ProjectConfig } from '/#/config'; import type { RouteLocationNormalized } from 'vue-router'; import { createLocalStorage, createSessionStorage } from '/@/utils/cache'; @@ -34,7 +34,7 @@ interface BasicStore { [REFRESH_TOKEN_KEY]: string | number | null | undefined; [ROLE_IDS_KEY]: string[]; [PERMISSIONS_KEY]: string[]; - [USER_INFO_KEY]: UserVo; + [USER_INFO_KEY]: KiccUser; [LOCK_INFO_KEY]: LockInfo; [PROJ_CFG_KEY]: ProjectConfig; [MULTIPLE_TABS_KEY]: RouteLocationNormalized[]; diff --git a/src/views/core/lock/LockPage.vue b/src/views/core/lock/LockPage.vue index 04e31fe..c43bdff 100644 --- a/src/views/core/lock/LockPage.vue +++ b/src/views/core/lock/LockPage.vue @@ -88,7 +88,7 @@ import { useNow } from './useNow'; import { useDesign } from '/@/hooks/web/useDesign'; import { LockOutlined } from '@ant-design/icons-vue'; - import { UserVo } from '/@/api/platform/core/entity/user'; + import { KiccUser } from '/@/api/common/base/entity'; import defaultAvatar from '/@/assets/images/defaultAvatar.svg'; const InputPassword = Input.Password; @@ -101,7 +101,7 @@ const userStore = useUserStore(); const { hour, month, minute, meridiem, year, day, week } = useNow(true); const { t } = useI18n(); - const userInfo = computed(() => { + const userInfo = computed(() => { return userStore.getUserInfo || {}; }); diff --git a/src/views/system/user/account/setting/UserInfo.vue b/src/views/system/user/account/setting/UserInfo.vue index e794f4c..5c28aa5 100644 --- a/src/views/system/user/account/setting/UserInfo.vue +++ b/src/views/system/user/account/setting/UserInfo.vue @@ -35,12 +35,12 @@ import { useUserStore } from '/@/store/modules/user'; import { commonUpload } from '/@/api/platform/core/controller/upload'; import { useContentHeight } from '/@/hooks/web/useContentHeight'; - import { UserVo } from '/@/api/platform/core/entity/user'; + import { KiccUser } from '/@/api/common/base/entity'; import { isBase64image } from '/@/utils/is'; interface State { baseInfoBtnLoading: boolean; - userInfo: UserVo | any; + userInfo: KiccUser | any; } export default defineComponent({ components: { diff --git a/src/views/system/user/user.data.ts b/src/views/system/user/user.data.ts index 5cb369b..3497753 100644 --- a/src/views/system/user/user.data.ts +++ b/src/views/system/user/user.data.ts @@ -22,7 +22,7 @@ const { createConfirm } = useMessage(); export const columns: BasicColumn[] = [ { title: '用户名称', - dataIndex: 'userName', + dataIndex: 'username', width: 120 }, { @@ -59,7 +59,7 @@ export const columns: BasicColumn[] = [ createConfirm({ iconType: 'warning', title: '警告', - content: `确认要"${text}${record.userName}用户吗?`, + content: `确认要"${text}${record.username}用户吗?`, onOk: async () => { record.pendingStatus = true; const newStatus = checked ? '0' : '1';