'-'
zhangwei
4 天以前 ddbf9504fc5faf6764fffa4e9263a3ad927331d8
src/router/index.ts
@@ -106,8 +106,9 @@
}
/** 路由白名单 */
// const whiteList = ["/login"];
const whiteList = [];
const whiteList = ["/login"];
const noLoginList = ["/index", "/register", "/registersucess"];
// const whiteList = [];
const { VITE_HIDE_HOME } = import.meta.env;
@@ -141,7 +142,7 @@
    }
    // 开启隐藏首页后在浏览器地址栏手动输入首页welcome路由则跳转到404页面
    if (VITE_HIDE_HOME === "true" && to.fullPath === "/welcome") {
      next({ path: "/error/404" });
      next({ path: "/index" });
    }
    if (_from?.name) {
      // name为超链接
@@ -194,10 +195,15 @@
  } else {
    if (to.path !== "/login") {
      if (whiteList.indexOf(to.path) !== -1) {
        console.log(to.path, "====1", noLoginList.indexOf(to.path));
        next();
      } else {
        removeToken();
        next({ path: "/login" });
        // if (noLoginList.indexOf(to.path) == -1) {
        next();
        // } else {
        //   removeToken();
        //   next({ path: "/login" });
        // }
      }
    } else {
      next();