From 394f867eb1c8c9a8063c122e08cd72a692b59608 Mon Sep 17 00:00:00 2001 From: jingrow Date: Tue, 18 Nov 2025 23:37:49 +0800 Subject: [PATCH] filter: hide pagetype and workspace menu items for non-System User --- .../frontend/src/shared/stores/menu.ts | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/apps/jingrow/frontend/src/shared/stores/menu.ts b/apps/jingrow/frontend/src/shared/stores/menu.ts index 88181fd..80851b3 100644 --- a/apps/jingrow/frontend/src/shared/stores/menu.ts +++ b/apps/jingrow/frontend/src/shared/stores/menu.ts @@ -1,5 +1,6 @@ import { defineStore } from 'pinia' import { computed, ref } from 'vue' +import { useAuthStore } from './auth' export interface AppMenuItem { id: string @@ -163,7 +164,25 @@ export const useMenuStore = defineStore('menu', () => { persist() } - const visibleItems = computed(() => items.value.filter(m => !m.hidden)) + const visibleItems = computed(() => { + const authStore = useAuthStore() + const userType = authStore.user?.user_type + + // 非 System User 用户类型不显示 pagetype 和 workspace 类型的菜单项 + const isSystemUser = userType === 'System User' + + return items.value.filter(m => { + // 过滤隐藏的菜单项 + if (m.hidden) return false + + // 非 System User 过滤掉 pagetype 和 workspace 类型 + if (!isSystemUser && (m.type === 'pagetype' || m.type === 'workspace')) { + return false + } + + return true + }) + }) return { items,