main.js 1009 B

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