import Vue from 'vue'
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import App from './App.vue'
import router from './router'
import './plugins/element.js'
// 导入全局样式表
import './assets/css/global.css'
import axios from 'axios'
//导入echart
import * as echarts from 'echarts';
Vue.prototype.$echarts = echarts


// 使用axios
// axios.defaults.baseURL = 'http://syjcapi.aielab.net/api/v1' 

axios.defaults.baseURL = 'http://new.syjc.com/api/v1'
Vue.prototype.$http = axios
Vue.config.productionTip = false
axios.interceptors.request.use(
  config => {
  // 判断是否存在token，如果存在的话，则每个http header都加上token
    let token = localStorage.getItem('token')
    if (!config.headers.hasOwnProperty('Access-token') && token) {
      config.headers.Authorization = token
    }
    return config
  },
  error => {
    return Promise.reject(error)
  })
Vue.use(ElementUI)

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