master
fanluyan 2 years ago
parent 176a3d89c1
commit 54bb0df7b2

@ -70,14 +70,9 @@ router.beforeEach((to, from, next) => {
document.title = `${to.meta.title} | 视频监控可视化平台`; document.title = `${to.meta.title} | 视频监控可视化平台`;
const role = localStorage.getItem("userName"); const role = localStorage.getItem("userName");
const token = localStorage.getItem("token"); const token = localStorage.getItem("token");
if (!role && to.path !== "/login") { if (!token && to.path !== "/login") {
alert("1111111111");
next("/login"); next("/login");
} else if (to.meta.permission) {
console.log(to.meta.permission);
console.log(role);
// 如果是管理员权限则可进入,这里只是简单的模拟管理员权限而已
// role === "xytest" ? next() : next("/403");
next()
} else { } else {
next(); next();
} }

@ -4,15 +4,16 @@ import VueRouter from "vue-router";
Vue.use(VueRouter); Vue.use(VueRouter);
const routes = [ const routes = [
// { {
// path: "/", path: "/",
// redirect: "/realTimeMonitor", redirect: "/login",
// }, },
{ {
path: "/", path: "/",
component: () => component: () =>
import(/* webpackChunkName: "home" */ "../components/common/Home.vue"), import(/* webpackChunkName: "home" */ "../components/common/Home.vue"),
meta: { title: "首页" }, meta: { title: "首页" },
redirect: "/realTimeMonitor",
children: [ children: [
{ {
path: "/stritl", path: "/stritl",

Loading…
Cancel
Save