From 3c38d52663c57b74b6fce9d61e6b85e446413d47 Mon Sep 17 00:00:00 2001 From: mryanshenghong Date: Wed, 27 Jul 2022 02:44:54 -0400 Subject: [PATCH] feat(pages): migrate pages --- src/components/LoginModal.vue | 2 +- src/pages/activate/index.vue | 64 +++++++++++++++++++++++++++++++++++ src/pages/notfound/index.vue | 30 ++++++++++++++++ src/pages/staging/index.vue | 53 +++++++++++++++++++++++++++++ src/router/index.ts | 22 +++++++++++- 5 files changed, 169 insertions(+), 2 deletions(-) create mode 100644 src/pages/activate/index.vue create mode 100644 src/pages/notfound/index.vue create mode 100644 src/pages/staging/index.vue diff --git a/src/components/LoginModal.vue b/src/components/LoginModal.vue index c31615a..d49b96d 100644 --- a/src/components/LoginModal.vue +++ b/src/components/LoginModal.vue @@ -46,7 +46,7 @@ + diff --git a/src/pages/notfound/index.vue b/src/pages/notfound/index.vue new file mode 100644 index 0000000..2e32206 --- /dev/null +++ b/src/pages/notfound/index.vue @@ -0,0 +1,30 @@ + + + + diff --git a/src/pages/staging/index.vue b/src/pages/staging/index.vue new file mode 100644 index 0000000..6a0f9fa --- /dev/null +++ b/src/pages/staging/index.vue @@ -0,0 +1,53 @@ + + + + diff --git a/src/router/index.ts b/src/router/index.ts index 909e971..8f77340 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -1,9 +1,10 @@ import { createRouter, createWebHistory, RouteRecordRaw } from "vue-router"; import Home from "@/pages/home/Home.vue"; +import Staging from "@/pages/staging/index.vue"; const routes: Array = [ { path: "/", - name: "home", + name: "Home", component: Home, }, { @@ -11,6 +12,12 @@ const routes: Array = [ name: "Content", component: () => import("@/pages/content/Content.vue"), }, + { + path: "/staging", + name: "Staging", + component: Staging, + props: true, + }, // { // path: "/about", // name: "about", @@ -20,6 +27,11 @@ const routes: Array = [ // component: () => // import(/* webpackChunkName: "about" */ "../views/AboutView.vue"), // }, + { + path: "/:pathMatch(.*)*", + name: "NotFound", + component: () => import("@/pages/notfound/index.vue"), + }, ]; const router = createRouter({ @@ -27,4 +39,12 @@ const router = createRouter({ routes, }); +router.beforeEach((to, from, next) => { + if (to.name === "Media" && localStorage.role !== "0") { + next({ name: "NotFound" }); + } else { + next(); + } +}); + export default router;