router.js 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. import Vue from "vue";
  2. import Router from "vue-router";
  3. import PortalRoutes from "./modules/portal/routes/routes";
  4. import BasicRoutes from "./modules/basic/routes/routes";
  5. import examworkRoutes from "./modules/examwork/routes/routes";
  6. import MarklRoutes from "./modules/marking/routes/routes";
  7. import QuestionsRoutes from "./modules/questions/routes/routes";
  8. import OeRoutes from "./modules/oe/routes/routes";
  9. import PrintRoutes from "./modules/print/routes/routes";
  10. Vue.use(Router);
  11. let router = new Router({
  12. mode: "history",
  13. routes: [
  14. ...PortalRoutes,
  15. ...BasicRoutes,
  16. ...examworkRoutes,
  17. ...MarklRoutes,
  18. ...QuestionsRoutes,
  19. ...OeRoutes,
  20. ...PrintRoutes
  21. ]
  22. });
  23. // router.beforeEach((to, from, next) => {
  24. // const loginPath = "/login/" + localStorage.getItem("domain");
  25. // if (to.path.match(/^\/login\/.+$/)) {
  26. // next();
  27. // } else {
  28. // if (!window.sessionStorage.getItem("token")) {
  29. // if (!localStorage.getItem("domain")) {
  30. // alert("地址出错,找不到机构!");
  31. // }
  32. // next({ path: loginPath });
  33. // } else {
  34. // next();
  35. // }
  36. // }
  37. // });
  38. export default router;