import Vue from 'vue' import axios from 'axios' import VueAxios from 'vue-axios' import App from './App.vue' import router from './router' // Vue.config.productionTip = false Vue.prototype.host = 'https://ypzy.emingren.com' Vue.prototype.HOME = '/api' axios.interceptors.request.use(config => { if (config.url!="/api/api/user/login-by-Phone"&&config.url!="/api/api/common/send-sms-captcha") { if (!localStorage.userData) { router.replace('/login'); return config }else{ config.headers.Authorization = "Bearer "+JSON.parse(localStorage.userData).token } } return config }) Vue.use(VueAxios, axios) new Vue({ router, render: h => h(App) }).$mount('#app')