| | |
| | | import { router } from '@/router' |
| | | import { useUserStore } from '@/store/modules/user' |
| | | import { useAppMode } from '@/hooks/core/useAppMode' |
| | | import { extractRouteAuthMarks, extractUserButtons, hasAuthPermission } from '@/hooks/core/useAuth' |
| | | |
| | | function checkAuthPermission(el, binding) { |
| | | const authList = router.currentRoute.value.meta.authList || [] |
| | | const hasPermission = authList.some((item) => item.authMark === binding.value) |
| | | const authList = extractRouteAuthMarks(router.currentRoute.value.meta.authList) |
| | | const buttons = extractUserButtons(useUserStore().getUserInfo) |
| | | const { isBackendMode } = useAppMode() |
| | | const hasPermission = hasAuthPermission(binding.value, { |
| | | authList, |
| | | buttons, |
| | | isBackendMode: isBackendMode.value, |
| | | routePath: router.currentRoute.value.path |
| | | }) |
| | | if (!hasPermission) { |
| | | removeElement(el) |
| | | } |