// 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 VueClipboard from 'vue-clipboard2'
// 图片查看器
import Viewer from 'v-viewer'
import 'viewerjs/dist/viewer.css'
// 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
// 无缝滚动
import scroll from 'vue-seamless-scroll'
// datav
import dataV from '@jiaminghi/data-view'
Vue.use(Viewer)
// 图片查看器下边的操作按钮-若想隐藏改为false即可
Viewer.setDefaults({ Options: { 'inline': false, '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' } })
Vue.use(scroll)
Vue.config.productionTip = false
Vue.use(dataV)
// mount axios Vue.$http and this.$http
Vue.use(VueAxios)
Vue.use(VueCookies)
Vue.$cookies.config('7d')
Vue.use(VueClipboard)
/**
 * 权限检查
 */
Vue.prototype.$hasPermissions = function (value) {
  let isExist = false
  const roles = store.getters.roles
  const permissionList = roles.permissionList
  // console.log(permissionsStr,'permissionsStr')
  if (permissionList == undefined || permissionList == null) {
    return false
  }
  const has = permissionList.find(item => {
    return item == value
  })
  if (has) {
    isExist = true
  }
  return isExist
}
// 禁止输入框输入空格，换行符，<，>
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')
