app.js 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. import Vue from 'vue'
  2. import i18n from '@/locale';
  3. import router from './router/index'
  4. import store from './store'
  5. import { sync } from 'vuex-router-sync'
  6. import App from 'components/app-root'
  7. import { FontAwesomeIcon } from './icons'
  8. import iView from 'iview';
  9. import 'iview/dist/styles/iview.css';
  10. import commons from "@/utils/public.js";
  11. import apiTools from '@/api/api.js';
  12. import { fetch, post } from '@/filters/http.js';
  13. import VideoPlayer from 'vue-video-player';
  14. import jwtDecode from 'jwt-decode';
  15. import animate from 'animate.css'
  16. require('@/assets/css/common.css');
  17. require('@/assets/css/style.css');
  18. require('video.js/dist/video-js.css');
  19. require('vue-video-player/src/custom-theme.css');
  20. Vue.use(VideoPlayer);
  21. //新添加的
  22. import vuescroll from 'vue-scroll'
  23. import echarts from 'echarts'
  24. //全局API请求
  25. Vue.prototype.$api = apiTools;
  26. Vue.prototype.$post = post;
  27. Vue.prototype.$get = fetch;
  28. Vue.prototype.$jwtDecode = jwtDecode;
  29. Vue.use(vuescroll)
  30. Vue.use(animate)
  31. Vue.use(iView);
  32. Vue.prototype.$echarts = echarts
  33. //ZXJ
  34. Vue.prototype.common = commons;
  35. // Registration of global components
  36. Vue.component('icon', FontAwesomeIcon);
  37. //使用钩子函数对路由进行权限跳转
  38. //router.beforeEach((to, from, next) => {
  39. //const role = localStorage.getItem('token');
  40. // if (!role && to.path !== '/') {
  41. // next('/');
  42. // } else {
  43. // next();
  44. // }
  45. //})
  46. //Vue.prototype.$http = axios
  47. Vue.use(iView, {
  48. i18n: (key, value) => i18n.t(key, value)
  49. })
  50. sync(store, router)
  51. const app = new Vue({
  52. store,
  53. router,
  54. i18n,
  55. ...App
  56. })
  57. export {
  58. app,
  59. router,
  60. store
  61. }