import App from './App.vue'

// import ElementUI from 'element-ui';
// import "hi-ui/lib/hi-ui.css";
// import 'font-awesome/css/font-awesome.css'
//这样多次引用element
// Vue.use(ELEMENT, {
//   size: 'mini'
// })
Vue.prototype.$ELEMENT = { size: 'mini', zIndex: 3000 };
import Message from './components/vue-m-message'
Vue.use(Message) // will mount `Vue.prototype.$message`

import './assets/icon/iconfont.css';
import ZhcBirtCmps from 'zhc-birt-cmps'
Vue.use(ZhcBirtCmps)
import Cookies from 'js-cookie'
import {
  setToken,
} from "./utils/auth.js";
Vue.use(ELEMENT)
console.log('token', Cookies.get('EAP-Token'))
setToken(Cookies.get('EAP-Token') || '')

import axios from "./funclib/AxiosUtil";
import hiSetting from './hiSetting'
import * as echarts from "echarts"
Vue.prototype.$echarts = echarts;


// Vue.prototype.$HI = {
//   projectName: hiSetting.projectName,
//   serverUrl: hiSetting.serverUrl,
//   serverName: hiSetting.serverName,
//   request: axios,
//   queryOperate: 'like',
//   pageSize: 20,
//   saveUrl: hiSetting.saveUrl,
//   queryUrl: hiSetting.queryUrl,
//   querysUrl: hiSetting.serverUrl + "/data/querys",
//   policyUrl: hiSetting.policyUrl,
//   enumsUrl: hiSetting.serverUrl + "/platf/xtgn/enums/fgroupid/",
//   upload: hiSetting.upload,
//   download: hiSetting.download,
//   preview: hiSetting.preview || hiSetting.review,
//   getFlowInfo: hiSetting.getFlowInfo,
//   getApprovalInfo: hiSetting.getApprovalInfo,
//   processFlow: hiSetting.processFlow,
//   queryTask: hiSetting.queryTask,
//   withdrawtask: hiSetting.withdrawtask,
//   taskDiagram: hiSetting.taskDiagram,
//   openOrdernumber: hiSetting.openOrdernumber,
//   birtModel: hiSetting.serverUrl + "/birt/model1",
//   getProcessInfo: hiSetting.serverUrl + '/flow/getProcessInfo',
//   exportUrl: hiSetting.serverUrl + "/export/dataexcel"
// };
function getFullUrl(url1, url2){
  return url2 && url2.includes(url1) ? url2 : url1 + url2
}

Vue.prototype.$HI = {
  projectName: window.HIVUI_SETTING.projectName,
  serverUrl: window.HIVUI_SETTING.url,
  serverName: window.HIVUI_SETTING.serverName,
  request: axios,
  queryOperate: 'like',
  pageSize: 20,
  saveUrl: getFullUrl(window.HIVUI_SETTING.url, window.HIVUI_SETTING.saveUrl),
  queryUrl: getFullUrl(window.HIVUI_SETTING.url, window.HIVUI_SETTING.queryUrl),
  querysUrl: window.HIVUI_SETTING.url + "/data/querys",
  policyUrl: window.HIVUI_SETTING.policyUrl,
  enumsUrl: window.HIVUI_SETTING.url + "/platf/xtgn/enums/fgroupid/",
  upload: getFullUrl(window.HIVUI_SETTING.url, window.HIVUI_SETTING.upload),
  download: getFullUrl(window.HIVUI_SETTING.url, window.HIVUI_SETTING.download),
  preview: getFullUrl(window.HIVUI_SETTING.url, window.HIVUI_SETTING.preview || window.HIVUI_SETTING.review),
  getFlowInfo: getFullUrl(window.HIVUI_SETTING.url, window.HIVUI_SETTING.getFlowInfo),
  getApprovalInfo: getFullUrl(window.HIVUI_SETTING.url, window.HIVUI_SETTING.getApprovalInfo),
  processFlow: getFullUrl(window.HIVUI_SETTING.url, window.HIVUI_SETTING.processFlow),
  queryTask: getFullUrl(window.HIVUI_SETTING.url, window.HIVUI_SETTING.queryTask),
  withdrawtask: getFullUrl(window.HIVUI_SETTING.url, window.HIVUI_SETTING.withdrawtask),
  taskDiagram: getFullUrl(window.HIVUI_SETTING.url, window.HIVUI_SETTING.taskDiagram),
  openOrdernumber: getFullUrl(window.HIVUI_SETTING.url, window.HIVUI_SETTING.openOrdernumber),
  birtModel: window.HIVUI_SETTING.url + "/birt/model1",
  getProcessInfo: window.HIVUI_SETTING.url + '/flow/getProcessInfo',
  exportUrl: window.HIVUI_SETTING.url + "/export/dataexcel",
  isLang: window.HIVUI_SETTING.isLang || false,
};

new Vue({
  render: h => h(App),
}).$mount('#app')
