// ie polyfill
import '@babel/polyfill'

import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store/'
import { VueAxios } from './utils/request'
import Viewer from 'v-viewer'
import 'viewerjs/dist/viewer.css'
// 大屏组件
import {loading,borderBox13,digitalFlop,capsuleChart,borderBox8,borderBox12,borderBox11} from '@jiaminghi/data-view'
import Echart from './bigScreenComponents/echart/index.vue'
import ItemWrap from './bigScreenComponents/item-wrap/item-wrap.vue'
import Reacquire from './bigScreenComponents/reacquire/reacquire.vue'
// 自定义组件
Vue.component("Echart",Echart)
Vue.component("ItemWrap",ItemWrap)
Vue.component("Reacquire",Reacquire)

// 引入组件库
// import "vue-easytable/libs/theme-default/index.css";
import zhCN from "vue-easytable/libs/locale/lang/zh-CN.js";
import VueEasytable from "vue-easytable";
VueEasytable.VeLocale.use(zhCN);
Vue.use(VueEasytable);

// datav组件
Vue.use(loading)
Vue.use(borderBox13)
Vue.use(borderBox12)
Vue.use(borderBox11)
Vue.use(borderBox8)
Vue.use(digitalFlop)
Vue.use(capsuleChart)

// tv 焦点控制
import focusable from 'vue-tv-focusable';
Vue.use(focusable);

// mock
// import './mock'

import bootstrap from './core/bootstrap'
import './core/use'
import './permission' // permission control
import './utils/filter'

import VueCookies from 'vue-cookies' // global filter
Vue.use(Viewer)
Viewer.setDefaults({
  Options: { 'inline': true, 'button': true, 'navbar': true, 'title': true, 'toolbar': true, 'tooltip': true, 'movable': true, 'zoomable': true, 'rotatable': true, 'scalable': true, 'transition': true, 'fullscreen': true, 'keyboard': true, 'url': 'data-source' }
}) // global filter

Vue.config.productionTip = false

// mount axios Vue.$http and this.$http
Vue.use(VueAxios)
Vue.use(VueCookies)
Vue.$cookies.config('7d')

import LocaleProvider from 'ant-design-vue'
Vue.use(LocaleProvider)

// moment
import moment from 'moment'; 
import 'moment/locale/zh-cn';
moment.locale('zh-cn'); //设置语言 或 moment.lang('zh-cn'); 
Vue.prototype.$moment = moment;//挂载到当前vue实例对象
 
/**
 * 权限检查
 */
Vue.prototype.$hasPermissions = function (value) {
  let isExist = false
  const roles = store.getters.roles
  const permissionList = roles.permissionList
  if (permissionList == undefined || permissionList == null) {
    return false
  }
  const has = permissionList.find(item => {
    return item == value
  })
  if (has) {
    isExist = true
  }
  return isExist
}
// vuescroll
import vuescroll from 'vuescroll'
Vue.use(vuescroll)
// 禁止输入框输入空格，换行符，<，>
Vue.prototype.$filterEmpty = function (e) {
  return e.target.value.replace(/\s|\r\n|\n|<|>/g, '')
}
new Vue({
  router,
  store,
  created: bootstrap,
  render: h => h(App)
}).$mount('#app')
