main.js 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. import Vue from 'vue'
  2. import App from './App'
  3. import router from './router'
  4. import axios from 'axios'
  5. Vue.prototype.$axios = axios //全局注册,使用方法为:this.$axios
  6. import qs from 'qs'
  7. Vue.prototype.qs = qs //全局注册,使用方法为:this.qs
  8. Vue.prototype.$EventBus = new Vue() //中央时间总线
  9. Vue.config.productionTip = false //是阻止显示生产模式的消息
  10. // import VueRouter from "vue-router";
  11. // 解决两次访问相同路由地址报错
  12. // const originalPush = VueRouter.prototype.push
  13. // VueRouter.prototype.push = function push(location) {
  14. // return originalPush.call(this, location).catch(err => err)
  15. // }
  16. // axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded;charset=UTF-8';
  17. // axios.defaults.timeout = 30000;
  18. // axios.defaults.baseURL =process.env.API_HOST //韩佑波
  19. // // axios.defaults.baseURL = 'http://47.104.218.216:8000' //曹世祥
  20. // axios.defaults.withCredentials = true //axios请求时携带session
  21. // axios.defaults.crossDomain = true
  22. import 'babel-polyfill' //兼容IE11
  23. require("babel-polyfill")
  24. import VueLazyload from 'vue-lazyload'
  25. Vue.use(VueLazyload, {
  26. preLoad: 1.3,
  27. error: require('./assets/images/error.png'),
  28. loading: require('./assets/images/loading.gif'),
  29. attempt: 2
  30. })
  31. // 引入百度地图
  32. import BaiduMap from 'vue-baidu-map'
  33. import {
  34. BmPolygon,
  35. BmControl,
  36. BmMarker
  37. } from 'vue-baidu-map'
  38. Vue.use(BaiduMap, BmPolygon, BmControl, BmMarker, {
  39. ak: 'nroAiX0Lf6ppNEGt2dBLtDkOldGCPFwF'
  40. })
  41. import store from './vuex/store' //引入store.js
  42. import promise from 'es6-promise'
  43. promise.polyfill();
  44. import VueHighcharts from 'vue-highcharts';
  45. import Highcharts from 'highcharts';
  46. Highcharts.setOptions({
  47. // 所有语言文字相关配置都设置在 lang 里
  48.   lang: {
  49.   resetZoom: '重置',
  50.   resetZoomTitle: '重置缩放比例'
  51. }
  52. })
  53. Vue.use(VueHighcharts);
  54. import Viewer from 'v-viewer'
  55. Vue.use(Viewer, {
  56. defaultOptions: {
  57. "zIndex": 9999,
  58. }
  59. })
  60. import 'viewerjs/dist/viewer.css'
  61. // 样式
  62. import './assets/icon/iconfont.css'
  63. import './plugin/elementUi';
  64. // import './assets/css/theme/plantProtection/index.css' //植保皮肤一
  65. import '../theme/index.css' //皮肤一
  66. //导入全局样式
  67. import './assets/css/global.css'
  68. // 图片放大
  69. import preview from 'vue-photo-preview'
  70. import 'vue-photo-preview/dist/skin.css'
  71. Vue.use(preview)
  72. // 图片裁剪
  73. import VueCropper from 'vue-cropper'
  74. Vue.use(VueCropper)
  75. //格式化时间戳
  76. import './util/formatTime'
  77. //设备类型
  78. Vue.filter('equipType', function (i) {
  79. switch (i) {
  80. case '2':
  81. return '杀虫灯';
  82. break;
  83. case '3':
  84. return '虫情测报灯';
  85. break;
  86. case '4':
  87. return '性诱测报';
  88. break;
  89. case '5':
  90. return '环境监测';
  91. break;
  92. case '6':
  93. return '监控';
  94. break;
  95. case '7':
  96. return '孢子仪';
  97. break;
  98. case '9':
  99. return '糖醋测报';
  100. break;
  101. }
  102. })
  103. /* eslint-disable no-new */
  104. new Vue({
  105. el: '#app',
  106. router,
  107. store,
  108. components: {
  109. App
  110. },
  111. template: '<App/>'
  112. })