From b4a2faba762b14f1f94c45845d883965321678ae Mon Sep 17 00:00:00 2001 From: Krauss <3317187936@qq.com> Date: Thu, 3 Oct 2024 17:37:01 +0800 Subject: [PATCH] 10-3-17:34 --- src/router/index.js | 11 +- src/views/AdminView.vue | 9 ++ src/views/AuditView.vue | 267 +++++++++++++++++++++++++++++++++++++ src/views/BookView.vue | 7 +- src/views/LayoutView.vue | 5 +- src/views/LoginView.vue | 10 +- src/views/RegisterView.vue | 29 +++- src/views/TypeView.vue | 18 +-- 8 files changed, 336 insertions(+), 20 deletions(-) create mode 100644 src/views/AuditView.vue diff --git a/src/router/index.js b/src/router/index.js index 58cc513..1c38f56 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -46,6 +46,11 @@ const routes = [ name: 'type', component: () => import('../views/TypeView.vue') }, + { + path: 'audit', + name: 'audit', + component: () => import('../views/AuditView.vue') + }, ] }, @@ -66,13 +71,11 @@ const router = new VueRouter({ //路由守卫 router.beforeEach((to,from,next) => { - if (to.path ==='/login') { - next();//允许访问登录页面 - } + const user =localStorage.getItem("user"); - if (!user && to.path !== '/login'){//如果没有读取到登录的用户信息则拉回登录页面 + if (!user && to.path !== '/login' && to.path !== '/register'){//如果没有读取到登录的用户信息则拉回登录页面 return next("/login"); } next(); diff --git a/src/views/AdminView.vue b/src/views/AdminView.vue index 1b09b83..fb16883 100644 --- a/src/views/AdminView.vue +++ b/src/views/AdminView.vue @@ -15,6 +15,7 @@ +