main.js 892 B

12345678910111213141516171819202122232425262728
  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.toLowerCase());
  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. console.log(traditional,to.path)
  16. if (traditional || advertisement || Mobile || menuDiet1 || Calendar) return next();
  17. if (!localStorage.user) {
  18. // apply 必须拿到oa用户数据
  19. getUser(() => next())
  20. } else next();
  21. });
  22. new Vue({
  23. router,
  24. render: h => h(App),
  25. }).$mount("#app");