import router from "./router"; import {getToken} from "@/utils/auth"; const whiteList = [ "/check", ]; router.beforeEach((to, from, next) => { // next(); // 验证 TOKEN if (getToken()) { /* 登录成功 */ next(); } else { /* 未登录 */ if (whiteList.indexOf(to.path) !== -1) { // 在免登录白名单,直接进入 next(); } else { // 否则全部重定向到登录页 window.location.href = 'http://10.8.11.123:8089/cas/login?service=http://10.8.11.98:9888/check' // window.location.href = 'http://10.8.11.123:8089/cas/login?service=http://localhost/check' } } });