import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import ElementUI from 'element-ui'
import Axios from 'axios'
import qs from 'qs'
import 'element-ui/lib/theme-chalk/index.css'
import './assets/font/iconfont.css'
import './assets/style/reset.css'
import '@/utils/rem.js'
import '@/utils/filters.js'
import Vant from 'vant'
import 'vant/lib/index.css'
Vue.config.productionTip = false
Axios.defaults.baseURL = '/api/'
Vue.prototype.$axios = Axios
Vue.prototype.$qs=qs
//添加请求拦截器,在请求头中加token
Axios.interceptors.request.use(function (config) {
    // 在发送请求之前做些什么
    //  config=>{
      config.headers = {
        'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8'
      }
  //     if(localStorage.getItem('Authorization')){
  //       config.headers = {
  //         'Authorization': localstorage.getItem('Authorization')
  //       }
  //     }
  // }
    return config;
  }, function (error) {
    // 对请求错误做些什么
     return Promise.reject(error)
  })
 //添加响应拦截器
 Axios.interceptors.response.use(function(response){
    return  response
 },function(erros){
   return  Promise.reject(error)
 })
Vue.use(ElementUI)
Vue.use(Vant)
new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')