import Vue from 'vue'
import 'normalize.css/normalize.css' // 用于加载页面时上面的加载动画条。
import Element from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import moment from 'moment' // 时间库
import '@/styles/index.scss' // global css
import request from '@/utils/request'
import axios_user from '@/utils/request-user'
import App from './App'
import router from './router'
import store from './store'
import {getToken, getEmployeeMap,getCache,setCache,removeCache} from '@/utils/auth'
import {supremeAuthority,authoritys,getUserData,getTypsName} from './api/auth';
import downloadFile from '@/utils/downloadFile'
import i18n from './lang' // Internationalization
import './icons' // icon
import './permission' // permission control
import * as filters from '@/utils/filters' // global filters
import jtoken from '@/utils/Jtoken'
import noData from '@/components/noData'
Vue.component('NoData', noData)

import VConsole from 'vconsole'
// new VConsole()

// 头像
import userImage from '@/components/user_image'
Vue.component('userImage', userImage)
// wx通讯录
import WWOpenDatas from '@/components/wxOpendata'
Vue.component('WWOpenData', WWOpenDatas)
// 选择部门的选中内容覆盖
import deptData from '@/components/deptData.vue'
Vue.component('deptData', deptData)

// 选择部门的选中内容覆盖
import ShowDeptName from '@/components/ShowDeptName.vue'
Vue.component('ShowDeptName', ShowDeptName)

Vue.use(Element, {
  size: 'medium',
  i18n: (key, value) => i18n.t(key, value)
})

Vue.prototype.$downloadFile = downloadFile
Vue.prototype.$getToken = getToken()
Vue.prototype.$http = request
Vue.prototype.$http_user = axios_user
Vue.prototype.$jtoken = jtoken
Vue.prototype.$moment = moment
Vue.prototype.serveAd = process.env.SERVE_AD
Vue.prototype.serverdomain = process.env.BASE_API
Vue.prototype.$supremeAuthority = supremeAuthority
Vue.prototype.$authoritys = authoritys
Vue.prototype.$getTypsName = getTypsName
Vue.prototype.$getEmployeeMap = getEmployeeMap
Vue.prototype.$userInfo = getUserData
Vue.prototype.$wx = (window).wx; // 全局使用
Vue.prototype.$getCache = getCache
Vue.prototype.$setCache = setCache
Vue.prototype.$removeCache = removeCache

Object.keys(filters).forEach(key => {
  Vue.filter(key, filters[key])
})
Vue.config.ignoredElements = ['ww-open-data'];
Vue.config.productionTip = false

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