From 49ae730a3950d89be1cc522b3e928d0343db7b48 Mon Sep 17 00:00:00 2001 From: MSuMshk <2039814060@qq.com> Date: Fri, 6 Feb 2026 12:49:55 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96=E5=A4=B4=E5=83=8F?= =?UTF-8?q?=E4=B8=8B=E6=8B=89=E8=8F=9C=E5=8D=95=E5=B1=95=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 将个人中心调整为商户中心并替换图标,移除文档与 GitHub 菜单项,套餐徽章改为展示用户套餐名称(默认标准版)。 --- apps/web-antd/src/api/core/user.ts | 18 ++++++++++++++- apps/web-antd/src/layouts/basic.vue | 34 +++++++++-------------------- 2 files changed, 27 insertions(+), 25 deletions(-) diff --git a/apps/web-antd/src/api/core/user.ts b/apps/web-antd/src/api/core/user.ts index 319f821..3a36ce1 100644 --- a/apps/web-antd/src/api/core/user.ts +++ b/apps/web-antd/src/api/core/user.ts @@ -3,18 +3,33 @@ import type { UserInfo } from '@vben/types'; import { requestClient } from '#/api/request'; const TENANT_STORAGE_KEY = 'sys-tenant-id'; +const PACKAGE_NAME_STORAGE_KEY = 'sys-package-name'; interface TenantUserProfile { account?: string; avatar?: string; displayName?: string; merchantId?: null | number | string; + packageName?: string; permissions?: string[]; roles?: string[]; + subscriptionPackageName?: string; tenantId?: number | string; + planName?: string; userId?: number | string; } +function resolvePackageName(profile: TenantUserProfile) { + const packageName = + profile.packageName ?? + profile.subscriptionPackageName ?? + profile.planName ?? + localStorage.getItem(PACKAGE_NAME_STORAGE_KEY) ?? + '标准版'; + + return packageName.trim() || '标准版'; +} + function normalizeId(value: null | number | string | undefined) { if (value === null || value === undefined) { return ''; @@ -25,7 +40,7 @@ function normalizeId(value: null | number | string | undefined) { function mapProfileToUserInfo(profile: TenantUserProfile): UserInfo { return { avatar: profile.avatar ?? '', - desc: '', + desc: resolvePackageName(profile), homePath: '', realName: profile.displayName ?? profile.account ?? '', roles: profile.roles ?? [], @@ -40,6 +55,7 @@ function mapProfileToUserInfo(profile: TenantUserProfile): UserInfo { */ export async function getUserInfoApi() { const profile = await requestClient.get('/auth/profile'); + localStorage.setItem(PACKAGE_NAME_STORAGE_KEY, resolvePackageName(profile)); if (profile.tenantId !== null && profile.tenantId !== undefined) { localStorage.setItem(TENANT_STORAGE_KEY, String(profile.tenantId)); } diff --git a/apps/web-antd/src/layouts/basic.vue b/apps/web-antd/src/layouts/basic.vue index 2226c68..9acdf1a 100644 --- a/apps/web-antd/src/layouts/basic.vue +++ b/apps/web-antd/src/layouts/basic.vue @@ -5,9 +5,9 @@ import { computed, ref, watch } from 'vue'; import { useRouter } from 'vue-router'; import { AuthenticationLoginExpiredModal } from '@vben/common-ui'; -import { VBEN_DOC_URL, VBEN_GITHUB_URL } from '@vben/constants'; +import { VBEN_GITHUB_URL } from '@vben/constants'; import { useWatermark } from '@vben/hooks'; -import { BookOpenText, CircleHelp, SvgGithubIcon } from '@vben/icons'; +import { CircleHelp } from '@vben/icons'; import { BasicLayout, LockScreen, @@ -89,26 +89,8 @@ const menus = computed(() => [ handler: () => { router.push({ name: 'Profile' }); }, - icon: 'lucide:user', - text: $t('page.auth.profile'), - }, - { - handler: () => { - openWindow(VBEN_DOC_URL, { - target: '_blank', - }); - }, - icon: BookOpenText, - text: $t('ui.widgets.document'), - }, - { - handler: () => { - openWindow(VBEN_GITHUB_URL, { - target: '_blank', - }); - }, - icon: SvgGithubIcon, - text: 'GitHub', + icon: 'lucide:store', + text: '商户中心', }, { handler: () => { @@ -125,6 +107,10 @@ const avatar = computed(() => { return userStore.userInfo?.avatar ?? preferences.app.defaultAvatar; }); +const packageTagText = computed(() => { + return userStore.userInfo?.desc?.trim() || '标准版'; +}); + async function handleLogout() { await authStore.logout(false); } @@ -176,8 +162,8 @@ watch( :avatar :menus :text="userStore.userInfo?.realName" - description="ann.vben@gmail.com" - tag-text="Pro" + :description="userStore.userInfo?.username" + :tag-text="packageTagText" @logout="handleLogout" />