Skip to content

Commit

Permalink
add error page
Browse files Browse the repository at this point in the history
  • Loading branch information
syzygy608 committed Jul 9, 2024
1 parent 54dcb11 commit f95ad25
Show file tree
Hide file tree
Showing 7 changed files with 61 additions and 4 deletions.
1 change: 1 addition & 0 deletions components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ declare module 'vue' {
CourseCard: typeof import('./src/components/pages/main/courseCard.vue')['default']
Custom: typeof import('./src/components/pages/main/serach_modes/custom.vue')['default']
Department: typeof import('./src/components/pages/main/serach_modes/department.vue')['default']
Error_box: typeof import('./src/components/common/error_box.vue')['default']
Footer: typeof import('./src/components/layout/footer.vue')['default']
InputArea: typeof import('./src/components/pages/main/inputArea.vue')['default']
Intro: typeof import('./src/components/pages/home/intro.vue')['default']
Expand Down
29 changes: 29 additions & 0 deletions src/components/common/error_box.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<template>
<div class="p-12 bg-red-100 border-red-400 border">
<div
class="text-2xl py-3 my-3 items-center flex border-b border-red-600">
<ExclamationCircleOutlined />
<div class="px-3">錯誤</div>
</div>
<div class="text-md">
{{ message }}
</div>
<div class="flex my-3 justify-center">
<router-link
to="/"
class="bg-red-300 p-3 rounded-lg hover:bg-red-400 duration-200">
回首頁
</router-link>
</div>
</div>
</template>

<script setup>
import { ExclamationCircleOutlined } from "@ant-design/icons-vue";
import { ref } from "vue";
const props = defineProps({
error: String,
});
const message = ref(props.error);
</script>
2 changes: 1 addition & 1 deletion src/components/layout/footer.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<div
class="bg-orange-200 py-3 w-full flex items-center select-none">
class="bg-orange-200 h-[4rem] py-3 w-full flex items-center select-none">
<div class="font-mono text-center mx-auto">
CCU Class 2021-2024
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/components/layout/navbar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const router = useRouter();

<template>
<div
class="z-10 bg-orange-200 px-3 py-3 flex md:flex-row flex-row-reverse items-center place-content-between select-none">
class="z-10 h-[4rem] bg-orange-200 px-3 py-3 flex md:flex-row flex-row-reverse items-center place-content-between select-none">
<router-link to="/">
<div
class="font-bold text-2xl bg-gradient-to-br from-orange-300 to-red-700 text-transparent bg-clip-text">
Expand Down
5 changes: 5 additions & 0 deletions src/router/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ const routes = [
name: "Tutorial",
component: () => import("../views/page_tutorial.vue"),
},
{
path: "/record/error",
name: "RecordError",
component: () => import("../views/page_record_error.vue"),
},
];

const router = createRouter({
Expand Down
7 changes: 5 additions & 2 deletions src/views/page_error.vue
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
<script setup>
import Navbar from "@components/layout/navbar.vue";
import Foot from "@components/layout/footer.vue";
import ErrorBox from "@components/common/error_box.vue";
</script>

<template>
<div id="main">
<Navbar />
<div style="margin-bottom: 14rem; margin-top: 14rem">
<div style="text-align: center">Something Went Wrong!!</div>
<div
style="height: calc(100vh - 8rem)"
class="flex items-center justify-center">
<ErrorBox error="Something Went Wrong!!"></ErrorBox>
</div>
<Foot />
</div>
Expand Down
19 changes: 19 additions & 0 deletions src/views/page_record_error.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<script setup>
import Navbar from "@components/layout/navbar.vue";
import Foot from "@components/layout/footer.vue";
import ErrorBox from "@components/common/error_box.vue";
</script>

<template>
<div id="main">
<Navbar />
<div
style="height: calc(100vh - 8rem)"
class="flex items-center justify-center">
<ErrorBox
error="本分享連結已過期,請聯絡擁有者重新產生。"></ErrorBox>
</div>
<Foot />
</div>
</template>
>

0 comments on commit f95ad25

Please sign in to comment.