import babelpolyfill from 'babel-polyfill'
// import Vue from 'vue'
import App from './App'
// import ElementUI from 'element-ui'
// import 'element-ui/lib/theme-chalk/index.css'
import '@/assets/css/common.less'
// import '@/assets/css/alibaba.less'
// import './assets/theme/theme-green/index.css'
// import store from './vuex'
import store from './vuex/index'
import {router} from './router'
import './common/axiosSetting'
import CKEditor from '@ckeditor/ckeditor5-vue';
Vue.use( CKEditor );
// import 'font-awesome/css/font-awesome.min.css'
// Vue.use(ElementUI)
//引用富文本编辑器
// import VueQuillEditor from 'vue-quill-editor'
//引入富文本css
// require styles
// import 'quill/dist/quill.core.css'
// import 'quill/dist/quill.snow.css'
// import 'quill/dist/quill.bubble.css'
//富文本编辑器添加实例
// Vue.use(VueQuillEditor, /* { default global options } */)

ELEMENT.Dialog.props.lockScroll.default = false;
ELEMENT.Dialog.props.closeOnClickModal.default = false;
window.log = message => console.log(message)
let basicBtn=currentBtnName=>{
	let eglishPermission=[]
	if(currentBtnName.permissions.length>0){
		currentBtnName.permissions[0].basic.map((v, i) => {
			eglishPermission.push(v.btnName)
		})
		return eglishPermission
	}
}
let specialBtn=currentBtnName=>{
	let specialPermission=[]
	if(currentBtnName.permissions.length>1){
		currentBtnName.permissions[1].basic.map((v, i) => {
			specialPermission.push(v.btnName)
		})
	}
	return specialPermission
}
const hasPermission = userPermission => {
	let permissionBtnArray = [];
	let permissions = JSON.parse(localStorage.getItem('permissions'));
	let path = router.history.current.path;
	permissions.forEach(permission => {
		if (permission.permissionPaths.indexOf(path) > -1) {
			permissionBtnArray = permission.permissionBtnNameArray;
		}
	});
	return permissionBtnArray.includes(userPermission);
}
//全局方法挂载
Vue.prototype.$_has = hasPermission
new Vue({
  el: '#app',
  template: '<App/>',
  router,
  store,
  components: { App },
  // render: h => h(App)
})

