zhangwei
2025-08-29 e1b04baf60478e3de9e41e1fc39e1e4346321817
src/router/index.ts
@@ -107,7 +107,7 @@
/** 路由白名单 */
const whiteList = ["/login"];
const noLoginList = ["/index", "/register", "/registersucess"];
const noLoginList = ["/index", "/register", "/registernav", "/registersucess"];
// const whiteList = [];
const { VITE_HIDE_HOME } = import.meta.env;
@@ -128,7 +128,7 @@
      if (!item.meta.title) return "";
      const Title = getConfig().Title;
      if (Title) document.title = `${item.meta.title} | ${Title}`;
      else document.title = item.meta.title as string;
      else document.title = item.meta.title;
    });
  }
  /** 如果已经登录并存在登录信息后不能跳转到路由白名单,而是继续保持在当前页面 */
@@ -194,16 +194,11 @@
    }
  } else {
    if (to.path !== "/login") {
      if (whiteList.indexOf(to.path) !== -1) {
        console.log(to.path, "====1", noLoginList.indexOf(to.path));
      if (noLoginList.indexOf(to.path) !== -1) {
        next();
      } else {
        // if (noLoginList.indexOf(to.path) == -1) {
        next();
        // } else {
        //   removeToken();
        //   next({ path: "/login" });
        // }
        removeToken();
        next({ path: "/index" });
      }
    } else {
      next();