perf: Setting menu permission

This commit is contained in:
fit2cloud-chenyw
2025-07-18 12:45:46 +08:00
parent e257c3be61
commit 2eef41131d
5 changed files with 45 additions and 13 deletions
+6 -5
View File
@@ -3,7 +3,8 @@ import { computed } from 'vue'
import { ElMenu } from 'element-plus-secondary'
import { useRoute, useRouter } from 'vue-router'
import MenuItem from './MenuItem.vue'
import { useUserStore } from '@/stores/user'
const userStore = useUserStore()
const router = useRouter()
defineProps({
collapse: Boolean,
@@ -16,7 +17,6 @@ const activeMenu = computed(() => route.path)
const arr = route.path.split('/')
return arr[arr.length - 1]
}) */
const showSysmenu = computed(() => {
return route.path.includes('/system')
})
@@ -25,8 +25,7 @@ const routerList = computed(() => {
if (showSysmenu.value) {
return router.getRoutes().filter((route) => route.path.includes('/system') && !route.redirect)
}
return router.getRoutes().filter((route) => {
const list = router.getRoutes().filter((route) => {
return (
!route.path.includes('canvas') &&
!route.path.includes('member') &&
@@ -34,11 +33,13 @@ const routerList = computed(() => {
!route.path.includes('preview') &&
route.path !== '/login' &&
!route.path.includes('/system') &&
(route.path.includes('set') || !route.redirect) &&
((route.path.includes('set') && userStore.isSpaceAdmin) || !route.redirect) &&
route.path !== '/:pathMatch(.*)*' &&
!route.path.includes('dsTable')
)
})
return list
})
</script>
+1 -1
View File
@@ -25,7 +25,7 @@ defineProps({
const name = computed(() => userStore.getName)
const account = computed(() => userStore.getAccount)
const currentLanguage = computed(() => userStore.getLanguage)
const isAdmin = computed(() => userStore.getUid === '1')
const isAdmin = computed(() => userStore.isAdmin)
const dialogVisible = ref(false)
const languageList = [