import Vue from 'vue'

import 'normalize.css/normalize.css' // A modern alternative to CSS resets
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import '@/styles/index.scss' // global css
import App from './App'
import store from './store'
import router from './router'
import '@/icons' // icon
import '@/permission' // permission control
import VideoPlayer from 'vue-video-player'
import 'video.js/dist/video-js.css'
import 'vue-video-player/src/custom-theme.css'
import {
  getFullUrl
} from '@/utils/index'
import { file } from '@/utils/file'
import * as echarts from 'echarts';
import Components from '@/components'

Vue.use(Components)
Vue.prototype.$getFullUrl = getFullUrl
Vue.prototype.$echarts = echarts
Vue.prototype.$file = file
Vue.use(ElementUI)
Vue.use(VideoPlayer)
Vue.config.productionTip = false


// 自定义指令，防止用户多次提交，点击一次后禁用，持续两秒
Vue.directive('preventReClick', {
  inserted(el, binding) {
    el.addEventListener('click', () => {
      if (!el.disabled) {
        el.disabled = true
        setTimeout(() => {
          el.disabled = false
        }, binding.value || 2000)
      }
    })
  }
});


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