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,