WXL (wul)
11 小时以前 286af19ce9f0c0bff1cad2e1106c4abae72554b0
src/permission.js
@@ -52,12 +52,33 @@
      }
    }
  } else {
    // 没有token
    if (whiteList.indexOf(to.path) !== -1) {
    let processedPath = to.path;
    if (to.path.startsWith("/aifollowup")) {
      processedPath = to.path.replace(/^\/aifollowup/, "") || "/";
    }
    console.log(processedPath, "处理后的路径");
    if (whiteList.indexOf(processedPath) !== -1) {
      // 在免登录白名单,直接进入
      next();
      // 如果路径被修改了,需要重定向
      if (processedPath !== to.path) {
        next({
          path: processedPath,
          query: to.query,
          hash: to.hash,
        });
        NProgress.done();
      } else {
        next();
      }
    } else {
      next(`/login?redirect=${to.fullPath}`); // 否则全部重定向到登录页
      // 保存重定向URL时需要处理路径
      const redirectPath = to.path.startsWith("/aifollowup")
        ? to.path.replace(/^\/aifollowup/, "")
        : to.fullPath;
      next(`/login?redirect=${redirectPath}`); // 否则全部重定向到登录页
      NProgress.done();
    }
  }