import Vue from 'vue';
import App from './App';
import router from './router';
import store from './store';
import { axios } from './service/api/index';
import directives from './directives';
import ElementUI from 'element-ui';
import vueGicHeader from '../components/dm-header.js';
import vueGicFooter from '@gic-test/vue-gic-footer';
import vueGicAsideMenu from '@/components/aside-menu';
import vueGicCard from '@gic-test/vue-gic-card';
import vueGicStore from '@gic-test/vue-gic-store';
import vueGicStoreLinkage from '@gic-test/vue-gic-store-linkage/src/lib';
import vueGicStoreGroup from '@gic-test/vue-gic-store-group';
import vueGicPeople from '@gic-test/vue-gic-people/src/lib';
import vueGicConfirmPeople from '@gic-test/vue-gic-confirm-people/src/lib';
import vueGicImgPreview from '@gic-test/vue-gic-img-preview';
import vueGicMemberGroup from '@gic-test/vue-gic-member-group/src/lib';
import { gicStoreCard } from '@gic-test/vue-gic-store-new';
import packele from 'packele';
Vue.config.productionTip = false;
Vue.use(packele);
Vue.use(ElementUI);
Vue.use(vueGicHeader);
Vue.use(vueGicFooter);
Vue.use(vueGicAsideMenu);
Vue.use(vueGicCard);
Vue.use(vueGicStore);
Vue.use(vueGicStoreLinkage);
Vue.use(vueGicStoreGroup);
Vue.use(vueGicPeople);
Vue.use(vueGicConfirmPeople);
Vue.use(vueGicImgPreview);
Vue.use(vueGicMemberGroup);
Vue.use(gicStoreCard);
Vue.prototype.axios = axios;
Vue.prototype.axios.withCredentials = true;
Object.keys(directives).map(item => Vue.directive(item, directives[item]));
window.$bus = new Vue();
let flag = false;
Vue.prototype.$tips = function({ message = '提示', type = 'success' }) {
  if (flag) {
    return;
  } else {
    this.$message({ message, type });
  }
  flag = true;
  setTimeout(_ => {
    flag = false;
  }, 1000);
};

/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  store,
  components: { App },
  template: '<App/>'
});
