permission.js 550B

123456789101112131415161718192021
  1. import router from "./router";
  2. import store from "./store";
  3. import isLogin from "@/api/login";
  4. const loginWhiteList = ["/", "/login", "/privacy", "/forgetPassword", "/userAgreement","/nopassword","/forget","/register","/setname",'/join','/createorg']; // 登录验证白名单
  5. router.beforeEach((to, from, next) => {
  6. // 线上注释
  7. // next()
  8. // return
  9. if (store.getters.user.admin == null) {
  10. if (loginWhiteList.indexOf(to.path) !== -1) {
  11. next();
  12. } else {
  13. next({ path: "/" });
  14. }
  15. } else {
  16. next();
  17. }
  18. });