main.js 843 B

123456789101112131415161718192021222324252627
  1. import Vue from "vue";
  2. import App from "./App.vue";
  3. import router from "./router";
  4. import ElementUI from "element-ui";
  5. import "element-ui/lib/theme-chalk/index.css";
  6. import { getUser } from "./utils/tool";
  7. Vue.use(ElementUI);
  8. router.beforeEach((to, from, next) => {
  9. if (to.meta.title) document.title = to.meta.title;
  10. const traditional = /^\/traditional/g.test(to.path);
  11. const advertisement = /^\/advertisement/g.test(to.path);
  12. const Mobile = /^\/Mobile/g.test(to.path);
  13. const menuDiet1 = /^\/menuDiet/g.test(to.path);
  14. const Calendar = /^\/Calendar/g.test(to.path);
  15. if (traditional || advertisement || Mobile || menuDiet1 || Calendar) return next();
  16. if (!localStorage.user) {
  17. // apply 必须拿到oa用户数据
  18. getUser(() => next())
  19. } else next();
  20. });
  21. new Vue({
  22. router,
  23. render: h => h(App),
  24. }).$mount("#app");