diff --git a/src/main.js b/src/main.js index c311e24..c06ac10 100644 --- a/src/main.js +++ b/src/main.js @@ -70,14 +70,9 @@ router.beforeEach((to, from, next) => { document.title = `${to.meta.title} | 视频监控可视化平台`; const role = localStorage.getItem("userName"); const token = localStorage.getItem("token"); - if (!role && to.path !== "/login") { + if (!token && to.path !== "/login") { + alert("1111111111"); next("/login"); - } else if (to.meta.permission) { - console.log(to.meta.permission); - console.log(role); - // 如果是管理员权限则可进入,这里只是简单的模拟管理员权限而已 - // role === "xytest" ? next() : next("/403"); - next() } else { next(); } diff --git a/src/router/index.js b/src/router/index.js index f2adf33..a947a22 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -4,15 +4,16 @@ import VueRouter from "vue-router"; Vue.use(VueRouter); const routes = [ - // { - // path: "/", - // redirect: "/realTimeMonitor", - // }, + { + path: "/", + redirect: "/login", + }, { path: "/", component: () => import(/* webpackChunkName: "home" */ "../components/common/Home.vue"), meta: { title: "首页" }, + redirect: "/realTimeMonitor", children: [ { path: "/stritl",