2022-03-03 11:28:10 +08:00
|
|
|
import Vue from 'vue'
|
2022-03-03 11:40:29 +08:00
|
|
|
import axios from 'axios'
|
|
|
|
import VueAxios from 'vue-axios'
|
2022-03-03 11:28:10 +08:00
|
|
|
import App from './App.vue'
|
|
|
|
import router from './router'
|
2022-03-04 20:25:37 +08:00
|
|
|
|
2022-03-03 13:41:12 +08:00
|
|
|
// Vue.config.productionTip = false
|
2022-03-03 15:51:49 +08:00
|
|
|
Vue.prototype.host = 'https://ypzy.emingren.com'
|
2022-03-03 13:41:12 +08:00
|
|
|
Vue.prototype.HOME = '/api'
|
|
|
|
|
|
|
|
|
|
|
|
axios.interceptors.request.use(config => {
|
2022-03-03 15:51:49 +08:00
|
|
|
if (config.url!="/api/api/user/login-by-Phone"&&config.url!="/api/api/common/send-sms-captcha") {
|
|
|
|
if (!localStorage.userData) {
|
2022-03-04 20:25:37 +08:00
|
|
|
router.replace('/login');
|
|
|
|
return config
|
2022-03-03 15:51:49 +08:00
|
|
|
}else{
|
|
|
|
config.headers.Authorization = "Bearer "+JSON.parse(localStorage.userData).token
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-03-03 13:41:12 +08:00
|
|
|
|
|
|
|
|
|
|
|
return config
|
|
|
|
})
|
2022-03-03 11:40:29 +08:00
|
|
|
Vue.use(VueAxios, axios)
|
2022-03-03 11:28:10 +08:00
|
|
|
new Vue({
|
|
|
|
router,
|
|
|
|
render: h => h(App)
|
|
|
|
}).$mount('#app')
|