feat: add exception pages (#735)

#### What type of PR is this?

/kind feature
/milestone 2.0

#### What this PR does / why we need it:

完善 Console 端的 404/403 页面。

#### Which issue(s) this PR fixes:

Fixes https://github.com/halo-dev/halo/issues/2597

#### Screenshots:

<img width="1920" alt="image" src="https://user-images.githubusercontent.com/21301288/204723752-fa20d9c0-4cec-4d9f-8a8c-c4fa964e0e16.png">

#### Special notes for your reviewer:

None

#### Does this PR introduce a user-facing change?


```release-note
完善 Console 端的 404/403 页面。
```
pull/737/head
Ryan Wang 2022-11-30 22:57:53 +08:00 committed by GitHub
parent c26e438420
commit 93e0bebddb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 54 additions and 2 deletions

View File

@ -1 +1,6 @@
<template>403</template>
<script setup lang="ts">
import Exception from "./components/Exception.vue";
</script>
<template>
<Exception code="403" message="没有权限访问此页面" />
</template>

View File

@ -1 +1,6 @@
<template>404</template>
<script setup lang="ts">
import Exception from "./components/Exception.vue";
</script>
<template>
<Exception code="404" message="没有找到该页面" />
</template>

View File

@ -0,0 +1,42 @@
<script lang="ts" setup>
import { VButton, VSpace } from "@halo-dev/components";
import { useRouter } from "vue-router";
withDefaults(
defineProps<{
code: number | string;
title?: string;
message?: string;
}>(),
{
title: undefined,
message: undefined,
}
);
const router = useRouter();
</script>
<template>
<div class="grid h-screen place-content-center bg-white px-4">
<div class="text-center">
<h1 class="text-8xl font-black text-gray-200">
{{ code }}
</h1>
<p class="text-2xl font-bold tracking-tight text-gray-900 sm:text-4xl">
{{ title }}
</p>
<p class="mt-4 text-gray-500">{{ message }}</p>
<div class="mt-4">
<VSpace>
<VButton @click="router.back()"> </VButton>
<VButton type="secondary" :route="{ name: 'Dashboard' }">
仪表盘
</VButton>
</VSpace>
</div>
</div>
</div>
</template>