clll
2023-11-03 bcf86e7323837ff6e2c9cd6bb25b9d29907e34ed
CanadaMes-ui/src/router/index.js
@@ -33,6 +33,7 @@
        path: '/home',
        component: () => import('../views/home')
      },
      {
@@ -48,6 +49,7 @@
        component: () => import('../views/device/parameter'),
      },
      {
        path: '/device/alarm',
        component: () => import('../views/device/alarm')
@@ -56,6 +58,7 @@
        path: '/device/iostate',
        component: () => import('../views/device/iostate')
      },
      {
        path: '/device/control',
        component: () => import('../views/device/control')
@@ -76,6 +79,10 @@
        path: '/Electrical/State',
        component: () => import('../views/Electrical/State')
      },
      {
        path: '/Electrical/alarm',
        component: () => import('../views/Electrical/alarm')
      },
@@ -84,7 +91,10 @@
  }
];
const router = new VueRouter({
  // base: '/canadames/',
  routes
});
@@ -96,6 +106,18 @@
  // 获取token
  const hasToken = getToken();
  const isExist = Vue.prototype.$tagList.some(tag => tag.path === to.fullPath);
  if (!isExist) {
    Vue.prototype.$tagList.push({
      path: to.fullPath,
      data: null
    });
  }
  // 没有token则跳转到登录页面
  if (!hasToken) return next('/login');