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