Files
admin-web/src/app/pages/ForbiddenView.vue
T
2026-10-20 23:34:11 +08:00

30 lines
1.3 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<script setup lang="ts">
import '@/styles/adminWorkbench.css'
import { computed } from 'vue'
import { ShieldX } from '@lucide/vue'
import { useRoute, useRouter } from 'vue-router'
import { sanitizeInternalPath } from '@/core/routing/accessDecision'
import { useAccessPreviewStore } from '@/core/access/accessPreview'
const route = useRoute()
const router = useRouter()
const access = useAccessPreviewStore()
const sourcePath = computed(() => sanitizeInternalPath(route.query.from))
async function returnToAccessiblePage() {
if (access.firstAccessiblePath) await router.replace(access.firstAccessiblePath)
}
</script>
<template>
<section class="forbidden-page admin-workbench" aria-labelledby="forbidden-title">
<div class="forbidden-icon" aria-hidden="true"><ShieldX :size="32" /></div>
<p class="section-kicker">403 · 权限不足</p>
<h2 id="forbidden-title">当前登录账号无法访问此页面</h2>
<p>请联系平台管理员核对账号角色和权限配置。</p>
<p class="forbidden-source">来源页面:{{ sourcePath }}</p>
<el-button v-if="access.firstAccessiblePath" type="primary" @click="returnToAccessiblePage">返回可访问页面</el-button>
<p v-else>当前账号暂无可访问的业务菜单。</p>
</section>
</template>