import 'babel-polyfill'
import Vue from 'vue'

import 'normalize.css/normalize.css' // A modern alternative to CSS resets

import './assets/font/iconfont.css'
import moment from 'moment'
import echarts from 'echarts'
import './utils/rem'

import '@/styles/index.scss' // global css
// import { lazyAMapApiLoaderInstance } from 'vue-amap'
import App from './App'
import store from './store'
import router from './router'

import '@/icons' // icon
import '@/permission' // permission control
import util from '@/common/js/utils'
import * as utils from './utils/index'
import { parseTime } from '@/utils/index.js'

import { xrBaseCodeList } from './api/force'
import hevueImgPreview from 'hevue-img-preview'
import EasyComponent from './plugins/EasyComponent/index'
EasyComponent({
  BaseOptionsLoader(baseCode) {
    return xrBaseCodeList({ codeid: baseCode })
  }
})
import '@/plugins/element/index'
Vue.use(hevueImgPreview)

/**
 * If you don't want to use mock-server
 * you want to use MockJs for mock api
 * you can execute: mockXHR()
 *
 * Currently MockJs will be used in the production environment,
 * please remove it before going online! ! !
 *
 */
// import { mockXHR } from '../mock'
// if (process.env.NODE_ENV === 'production') {
//   mockXHR()
// }
Vue.prototype.$echarts = echarts
Vue.prototype.$moment = moment
// 工具类
Vue.prototype.$util = util
Vue.prototype.$utils = utils
Vue.prototype.console = console
Vue.component('paper-swiper', () => import ('@/components/PaperSwiper'))
Vue.component('paper', () => import ('@/components/Paper'))
Vue.component('CommonTitle', () => import ('@/components/CommonTitle'))
Vue.component('IframePdf', () => import ('@/components/IframePdf/iframePdf'))
Vue.filter('datetime', function(value) {
  if (!value) return ''
  return parseTime(value, '{yyyy}-{mm}-{dd} {hh}:{ii}:{ss}')
})
Vue.config.productionTip = false

new Vue({
  el: '#app',
  router,
  store,
  render: h => h(App)
})

// 离开删除
window.onbeforeunload = function() {
  sessionStorage.removeItem('ssoToken')
}
