From 616cf17d9ee0c7ad3c071698e4796c82225034a0 Mon Sep 17 00:00:00 2001 From: Turtle_Li <282189765@qq.com> Date: Mon, 6 Jul 2026 15:03:17 +0800 Subject: [PATCH] fix: hide batch image entry without allowed key --- frontend/src/components/layout/AppSidebar.vue | 6 +- .../dashboard/UserDashboardQuickActions.vue | 9 +- .../src/composables/useBatchImageAccess.ts | 83 +++++++++++++++++++ frontend/src/views/admin/DashboardView.vue | 4 + .../codex-report.md | 23 ++++- 5 files changed, 122 insertions(+), 3 deletions(-) create mode 100644 frontend/src/composables/useBatchImageAccess.ts diff --git a/frontend/src/components/layout/AppSidebar.vue b/frontend/src/components/layout/AppSidebar.vue index 8532ec4279..259879f3a4 100644 --- a/frontend/src/components/layout/AppSidebar.vue +++ b/frontend/src/components/layout/AppSidebar.vue @@ -195,6 +195,7 @@ import { useAdminSettingsStore, useAppStore, useAuthStore, useOnboardingStore } import VersionBadge from '@/components/common/VersionBadge.vue' import { sanitizeSvg } from '@/utils/sanitize' import { FeatureFlags, makeSidebarFlag } from '@/utils/featureFlags' +import { useBatchImageAccess } from '@/composables/useBatchImageAccess' interface NavItem { path: string @@ -240,6 +241,7 @@ const appStore = useAppStore() const authStore = useAuthStore() const onboardingStore = useOnboardingStore() const adminSettingsStore = useAdminSettingsStore() +const { canUseBatchImage, refreshBatchImageAccess } = useBatchImageAccess() const sidebarCollapsed = computed(() => appStore.sidebarCollapsed) const mobileOpen = computed(() => appStore.mobileOpen) @@ -683,6 +685,7 @@ const flagAffiliate = makeSidebarFlag(FeatureFlags.affiliate) const flagRiskControl = makeSidebarFlag(FeatureFlags.riskControl) const flagOpsMonitoring = () => adminSettingsStore.opsMonitoringEnabled const flagAdminPayment = () => adminSettingsStore.paymentEnabled +const flagBatchImageAccess = () => canUseBatchImage.value // buildSelfNavItems 构造用户自己的导航项(用户端主菜单和管理员的"我的账户"子菜单共享这组声明)。 // withDashboard=true 时包含仪表盘(用户端),false 时不含(管理员的个人区已经有独立仪表盘入口)。 @@ -696,7 +699,7 @@ function buildSelfNavItems(withDashboard: boolean): NavItem[] { } items.push( { path: '/keys', label: t('nav.apiKeys'), icon: KeyIcon }, - { path: '/batch-image', label: t('nav.batchImage'), icon: BatchImageIcon, hideInSimpleMode: true }, + { path: '/batch-image', label: t('nav.batchImage'), icon: BatchImageIcon, hideInSimpleMode: true, featureFlag: flagBatchImageAccess }, { path: '/usage', label: t('nav.usage'), icon: ChartIcon, hideInSimpleMode: true }, { path: '/available-channels', label: t('nav.availableChannels'), icon: ChannelIcon, hideInSimpleMode: true, featureFlag: flagAvailableChannels }, { path: '/monitor', label: t('nav.channelStatus'), icon: SignalIcon, featureFlag: flagChannelMonitor }, @@ -917,6 +920,7 @@ watch( ) onMounted(() => { + void refreshBatchImageAccess() if (isAdmin.value) { adminSettingsStore.fetch() } diff --git a/frontend/src/components/user/dashboard/UserDashboardQuickActions.vue b/frontend/src/components/user/dashboard/UserDashboardQuickActions.vue index 4dae89c4f0..c1b80a2d05 100644 --- a/frontend/src/components/user/dashboard/UserDashboardQuickActions.vue +++ b/frontend/src/components/user/dashboard/UserDashboardQuickActions.vue @@ -34,7 +34,7 @@ /> -