Compare commits

...

2 Commits

8 changed files with 85 additions and 37 deletions

View File

@ -80,9 +80,9 @@ menus:
pureMarkdown: Markdown
pureEditor: Editor
pureAbnormal: Abnormal Page
pureFourZeroFour: "404"
pureFourZeroOne: "403"
pureFive: "500"
purePageNotFound: "404"
pureAccessDenied: "403"
pureServerError: "500"
pureComponents: Components
pureDialog: Dialog
pureDrawer: Drawer

View File

@ -80,9 +80,9 @@ menus:
pureMarkdown: Markdown
pureEditor: 编辑器
pureAbnormal: 异常页面
pureFourZeroFour: "404"
pureFourZeroOne: "403"
pureFive: "500"
purePageNotFound: "404"
pureAccessDenied: "403"
pureServerError: "500"
pureComponents: 组件
pureDialog: 函数式弹框
pureDrawer: 函数式抽屉

View File

@ -16,7 +16,7 @@ export default {
name: "403",
component: () => import("@/views/error/403.vue"),
meta: {
title: $t("menus.pureFourZeroOne")
title: $t("menus.pureAccessDenied")
}
},
{
@ -24,7 +24,7 @@ export default {
name: "404",
component: () => import("@/views/error/404.vue"),
meta: {
title: $t("menus.pureFourZeroFour")
title: $t("menus.purePageNotFound")
}
},
{
@ -32,7 +32,7 @@ export default {
name: "500",
component: () => import("@/views/error/500.vue"),
meta: {
title: $t("menus.pureFive")
title: $t("menus.pureServerError")
}
}
]

View File

@ -8,8 +8,27 @@ export default [
component: () => import("@/views/login/index.vue"),
meta: {
title: $t("menus.pureLogin"),
showLink: false,
rank: 101
showLink: false
}
},
// 全屏403无权访问页面
{
path: "/access-denied",
name: "AccessDenied",
component: () => import("@/views/error/403.vue"),
meta: {
title: $t("menus.pureAccessDenied"),
showLink: false
}
},
// 全屏500服务器出错页面
{
path: "/server-error",
name: "ServerError",
component: () => import("@/views/error/500.vue"),
meta: {
title: $t("menus.pureServerError"),
showLink: false
}
},
{
@ -17,8 +36,7 @@ export default [
component: Layout,
meta: {
title: $t("status.pureLoad"),
showLink: false,
rank: 102
showLink: false
},
children: [
{
@ -28,6 +46,15 @@ export default [
}
]
},
{
path: "/account-settings",
name: "AccountSettings",
component: () => import("@/views/account-settings/index.vue"),
meta: {
title: $t("buttons.pureAccountSettings"),
showLink: false
}
},
// 下面是一个无layout菜单的例子一个全屏空白页面因为这种情况极少发生所以只需要在前端配置即可配置路径src/router/modules/remaining.ts
{
path: "/empty",
@ -35,18 +62,7 @@ export default [
component: () => import("@/views/empty/index.vue"),
meta: {
title: $t("menus.pureEmpty"),
showLink: false,
rank: 103
}
},
{
path: "/account-settings",
name: "AccountSettings",
component: () => import("@/views/account-settings/index.vue"),
meta: {
title: $t("buttons.pureAccountSettings"),
showLink: false,
rank: 104
showLink: false
}
}
] satisfies Array<RouteConfigsTable>;

View File

@ -139,12 +139,17 @@ function findRouteByPath(path: string, routes: RouteRecordRaw[]) {
}
}
/** 动态路由注册完成后再添加全屏404页面不存在页面避免刷新动态路由页面时误跳转到404页面 */
function addPathMatch() {
if (!router.hasRoute("pathMatch")) {
router.addRoute({
path: "/:pathMatch(.*)",
name: "pathMatch",
redirect: "/error/404"
path: "/:pathMatch(.*)*",
name: "PageNotFound",
component: () => import("@/views/error/404.vue"),
meta: {
title: "menus.purePageNotFound",
showLink: false
}
});
}
}

View File

@ -10,9 +10,11 @@ const router = useRouter();
</script>
<template>
<div class="flex justify-center items-center h-[640px]">
<div
class="flex flex-col md:flex-row justify-center items-center min-h-full w-full p-4 md:p-0"
>
<noAccess />
<div class="ml-12">
<div class="mt-8 md:ml-12 md:mt-0 text-center md:text-left">
<p
v-motion
class="font-medium text-4xl mb-4! dark:text-white"
@ -32,7 +34,7 @@ const router = useRouter();
</p>
<p
v-motion
class="mb-4! text-gray-500"
class="text-xl mb-4! text-gray-500"
:initial="{
opacity: 0,
y: 100
@ -50,6 +52,7 @@ const router = useRouter();
<el-button
v-motion
type="primary"
class="block mx-auto md:inline-block md:mx-0"
:initial="{
opacity: 0,
y: 100
@ -68,3 +71,9 @@ const router = useRouter();
</div>
</div>
</template>
<style scoped>
.main-content {
margin: 0 !important;
}
</style>

View File

@ -10,9 +10,11 @@ const router = useRouter();
</script>
<template>
<div class="flex justify-center items-center h-[640px]">
<div
class="flex flex-col md:flex-row justify-center items-center min-h-full w-full p-4 md:p-0"
>
<noExist />
<div class="ml-12">
<div class="mt-8 md:ml-12 md:mt-0 text-center md:text-left">
<p
v-motion
class="font-medium text-4xl mb-4! dark:text-white"
@ -32,7 +34,7 @@ const router = useRouter();
</p>
<p
v-motion
class="mb-4! text-gray-500"
class="text-xl mb-4! text-gray-500"
:initial="{
opacity: 0,
y: 100
@ -50,6 +52,7 @@ const router = useRouter();
<el-button
v-motion
type="primary"
class="block mx-auto md:inline-block md:mx-0"
:initial="{
opacity: 0,
y: 100
@ -68,3 +71,9 @@ const router = useRouter();
</div>
</div>
</template>
<style scoped>
.main-content {
margin: 0 !important;
}
</style>

View File

@ -10,9 +10,11 @@ const router = useRouter();
</script>
<template>
<div class="flex justify-center items-center h-[640px]">
<div
class="flex flex-col md:flex-row justify-center items-center min-h-full w-full p-4 md:p-0"
>
<noServer />
<div class="ml-12">
<div class="mt-8 md:ml-12 md:mt-0 text-center md:text-left">
<p
v-motion
class="font-medium text-4xl mb-4! dark:text-white"
@ -32,7 +34,7 @@ const router = useRouter();
</p>
<p
v-motion
class="mb-4! text-gray-500"
class="text-xl mb-4! text-gray-500"
:initial="{
opacity: 0,
y: 100
@ -50,6 +52,7 @@ const router = useRouter();
<el-button
v-motion
type="primary"
class="block mx-auto md:inline-block md:mx-0"
:initial="{
opacity: 0,
y: 100
@ -68,3 +71,9 @@ const router = useRouter();
</div>
</div>
</template>
<style scoped>
.main-content {
margin: 0 !important;
}
</style>