import Vue from 'vue';
import App from './App.vue';
import ui from 'element-ui';
import router from './router/router';
import axios from './router/axios';
import utils from './utils';
import vcUI from 'dvcp-ui';
import 'dvcp-ui/lib/styles/common.scss';
import 'dvcp-ui/lib/dvcp-ui.css';
import store from './store';
import dataV from '@jiaminghi/data-view';
import dvui from '../project/dvui/entries'

Vue.use(dataV);
Vue.use(ui);
Vue.use(vcUI);
Vue.use(dvui)
//富文本编辑器配置
Vue.config.productionTip = false;
Object.keys(utils).map((e) => (Vue.prototype[e] = utils[e]));
Vue.prototype.$request = axios
const app = new Vue({
  router,
  store,
  render: h => h(App)
});
let theme = null
store.dispatch('getSystem').then(({colorScheme}) => {
  theme = JSON.parse(colorScheme || null)
  Vue.prototype.$theme = theme?.web || "blue"
  return import(`dvcp-ui/lib/styles/theme.${theme?.web}.scss`).catch(() => 0)
}).finally(() => {
  !theme ? app.$mount('#app') : import(`dvcp-ui/lib/styles/common.scss`).finally(() => app.$mount('#app'))
})

