refactor: 清理临时检查文件;用户信息增强与登录页优化

- 删除 INSPECTION.md / TODO.md 等临时检查文档
- 新增 UserCompanySummaryVO:登录用户返回所属公司摘要信息
- UserServiceImpl / UserVO:调整用户信息结构与缓存逻辑
- 前端:登录页布局优化 / 用户下拉组件更新
This commit is contained in:
小蟑螂
2026-05-09 17:11:59 +08:00
parent 3d1f9f2a2a
commit 47cc5dc6d1
13 changed files with 102 additions and 327 deletions
@@ -32,7 +32,10 @@ export namespace AuthApi {
/** 用户信息 */
export interface UserInfo {
id: number;
companyId?: number;
company?: {
id: number;
name: string;
};
departmentId?: number;
positionId?: number;
loginCode: string;
@@ -7,8 +7,11 @@ export namespace UserVO {
export interface UserInfoVO {
/** 用户编号 */
id: number;
/** 公司id */
companyId?: number;
/** 公司摘要(列表为上次所在公司;/user/info 为当前 token 公司) */
company?: {
id: number;
name: string;
};
/** 部门id */
departmentId?: number;
/** 岗位id */
@@ -118,6 +118,22 @@ const avatar = computed(() => {
return userStore.userInfo?.avatar ?? preferences.app.defaultAvatar;
});
/** 当前登录上下文下的公司名称(来自 /user/info 的 company) */
const companyName = computed(() => {
const info = userStore.userInfo as null | { company?: { name?: string } };
const name = info?.company?.name?.trim();
return name || '';
});
/** 用户下拉副标题:第一行手机号,第二行公司名称(不放同一行) */
const userDropdownDescription = computed(() => {
const phone = (userStore.userInfo?.phone || '-').trim() || '-';
if (companyName.value) {
return `${phone}\n${companyName.value}`;
}
return phone;
});
async function handleLogout() {
await authStore.logout(false);
}
@@ -153,7 +169,7 @@ watch(
:avatar
:menus
:text="userStore.userInfo?.realName"
:description="userStore.userInfo?.phone || '-'"
:description="userDropdownDescription"
@logout="handleLogout"
/>
</template>
@@ -218,7 +218,9 @@ if (enableShortcutKey.value) {
</Badge>
</slot>
</div>
<div class="text-muted-foreground text-xs font-normal">
<div
class="text-muted-foreground whitespace-pre-line text-xs font-normal"
>
{{ description }}
</div>
</div>
@@ -39,7 +39,9 @@
"@vben/utils": "workspace:*",
"@vueuse/core": "catalog:",
"@vueuse/motion": "catalog:",
"clsx": "catalog:",
"echarts": "catalog:",
"tailwind-merge": "catalog:",
"vue": "catalog:",
"vxe-pc-ui": "catalog:",
"vxe-table": "catalog:"
@@ -12,6 +12,7 @@ import type { SetupContext } from 'vue';
import type { VbenFormProps } from '@vben-core/form-ui';
import type { ClassValue } from 'clsx';
import type { ExtendedVxeGridApi, VxeGridProps } from './types';
import {
@@ -25,18 +26,18 @@ import {
watch,
} from 'vue';
import { clsx } from 'clsx';
import { usePriorityValues } from '@vben/hooks';
import { EmptyIcon } from '@vben/icons';
import { $t } from '@vben/locales';
import { usePreferences } from '@vben/preferences';
import {
cloneDeep,
cn,
isBoolean,
isEqual,
mergeWithArrayOverride,
} from '@vben/utils';
import { twMerge } from 'tailwind-merge';
import { VbenHelpTooltip, VbenLoading } from '@vben-core/shadcn-ui';
import { VxeButton } from 'vxe-pc-ui';
@@ -49,6 +50,11 @@ import 'vxe-table/styles/cssvar.scss';
import 'vxe-pc-ui/styles/cssvar.scss';
import './style.css';
/** 合并 Tailwind 类名(须放在全部 import 之后,避免非法模块语法导致运行时无 cn) */
function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs));
}
interface Props extends VxeGridProps {
api: ExtendedVxeGridApi;
}
+5 -2
View File
@@ -7,9 +7,12 @@ interface UserInfo extends Omit<BasicUserInfo, 'userId' | 'username'> {
*/
id: number;
/**
* 公司id
* 当前登录上下文下的公司(含 id、名称)
*/
companyId?: number;
company?: {
id: number;
name: string;
};
/**
* 部门id
*/
+6
View File
@@ -1497,9 +1497,15 @@ importers:
'@vueuse/motion':
specifier: 'catalog:'
version: 3.0.3(magicast@0.3.5)(vue@3.5.17(typescript@5.8.3))
clsx:
specifier: ^2.1.1
version: 2.1.1
echarts:
specifier: 'catalog:'
version: 5.6.0
tailwind-merge:
specifier: 'catalog:'
version: 2.6.0
vue:
specifier: ^3.5.17
version: 3.5.17(typescript@5.8.3)