diff --git a/src/router/index.js b/src/router/index.js index 58cc51338db5d7e5919c8bd2a3629072c329c845..1c38f56fd1b22ffabd3a68942c99a2ca114fa524 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 1b09b83b876dc67cfa9b9a8ad4bc24a45b1ffb02..fb16883db30716de08f941673fd25db0e2b165ce 100644 --- a/src/views/AdminView.vue +++ b/src/views/AdminView.vue @@ -15,6 +15,7 @@ +