zouyu
2023-12-25 4636619883885100045bf8a91a70012c9b554294
src/permission.js
@@ -12,6 +12,7 @@
router.beforeEach((to, from, next) => {
  NProgress.start();
  const meta = to.meta || {};
  const whiteList = ['/login', '/404', '/401', '/lock','/pack']
  if (store.getters.access_token) {
    if (store.getters.isLock && to.path !== '/lock') {
      next({ path: '/lock' });
@@ -35,7 +36,15 @@
    // 页面多开:载入localStorage的auth参数 By Luxn
    let auth = JSON.parse(localStorage.getItem("authorization") || "{}");
    if ( meta.isAuth === false) {
      next();
      //没有token的情况
    if (whiteList.indexOf(to.path) !== -1) {
      // 如果在白名单内则直接跳转
      next()
    } else {
      // 其余页面重定向到登录页
      next('/login')
    }
      // next();
    }else{
      if (auth.date_time) {
        let key = ["access_token", "refresh_token", "expires_in", "user_info", "language"];
@@ -57,7 +66,6 @@
      }else{
        next('/login');
      }
    }
  }
})