import Vue from 'vue'
import App from './App'
import router from './router'
import axios from 'axios'
Vue.prototype.$axios = axios //全局注册，使用方法为:this.$axios
import qs from 'qs'
Vue.prototype.qs = qs //全局注册，使用方法为:this.qs

Vue.prototype.$EventBus = new Vue() //中央时间总线

Vue.config.productionTip = false //是阻止显示生产模式的消息


// import VueRouter from "vue-router";
// 解决两次访问相同路由地址报错
// const originalPush = VueRouter.prototype.push
// VueRouter.prototype.push = function push(location) {
//   return originalPush.call(this, location).catch(err => err)
// }

// axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded;charset=UTF-8';
// axios.defaults.timeout = 30000;
// axios.defaults.baseURL =process.env.API_HOST  //韩佑波
// // axios.defaults.baseURL = 'http://47.104.218.216:8000' //曹世祥
// axios.defaults.withCredentials = true //axios请求时携带session
// axios.defaults.crossDomain = true


import 'babel-polyfill' //兼容IE11
require("babel-polyfill")

// 引入百度地图
import BaiduMap from 'vue-baidu-map'
import {
  BmPolygon,
  BmControl,
  BmMarker
} from 'vue-baidu-map'
Vue.use(BaiduMap, BmPolygon, BmControl, BmMarker, {
  ak: 'nroAiX0Lf6ppNEGt2dBLtDkOldGCPFwF'
})

import store from './vuex/store' //引入store.js

import promise from 'es6-promise'
promise.polyfill();


import VueHighcharts from 'vue-highcharts';
Vue.use(VueHighcharts);
import Viewer from 'v-viewer'
Vue.use(Viewer, {
  defaultOptions: {
    "zIndex": 9999,
  }
 })
import 'viewerjs/dist/viewer.css'

// 样式
import './assets/icon/iconfont.css'
import './plugin/elementUi';
// import './assets/css/theme/plantProtection/index.css' //植保皮肤一
import '../theme/index.css'  //皮肤一

//导入全局样式
import './assets/css/global.css'

// 图片放大
import preview from 'vue-photo-preview'
import 'vue-photo-preview/dist/skin.css'
Vue.use(preview)
// 图片裁剪
import VueCropper from 'vue-cropper'
Vue.use(VueCropper)



//格式化时间戳
import './util/formatTime'

//设备类型
Vue.filter('equipType', function (i) {
  switch (i) {
    case '2':
      return '杀虫灯';
      break;
    case '3':
      return '虫情测报灯';
      break;
    case '4':
      return '性诱测报';
      break;
    case '5':
      return '环境监测';
      break;
    case '6':
      return '监控';
      break;
    case '7':
      return '孢子仪';
      break;
    case '9':
      return '糖醋测报';
      break;
  }
})

/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  store,
  components: {
    App
  },
  template: '<App/>'
})