|
@@ -1,6 +1,8 @@
|
|
|
import Vue from 'vue';
|
|
|
import axios from 'axios';
|
|
|
import VueAxios from 'vue-axios';
|
|
|
+import getConfig from '../config/dev.js'
|
|
|
+let list = getConfig()
|
|
|
// axios.defaults.headers.post['Content-Type'] = 'application/json';
|
|
|
axios.defaults.transformRequest = [function (data) {
|
|
|
if (data instanceof Object && !(data instanceof FormData)) {
|
|
@@ -8,18 +10,24 @@ axios.defaults.transformRequest = [function (data) {
|
|
|
}
|
|
|
return data;
|
|
|
}],
|
|
|
+
|
|
|
+axios.defaults.baseURL = list.BASE_URL
|
|
|
// 添加请求拦截器
|
|
|
axios.interceptors.request.use(function (config) {
|
|
|
- if (config.url.startsWith("http")) {
|
|
|
- return config;
|
|
|
- }
|
|
|
- let localhost = ''
|
|
|
- if (process.env.NODE_ENV == "production") {
|
|
|
- localhost = window.staticHost ? window.staticHost : "/spfm/"
|
|
|
- }
|
|
|
- config.url = localhost + config.url
|
|
|
- let url = localhost + config.url
|
|
|
- if (url.indexOf('/sysmgr/sys/login/auth/captcha') == -1 && url.indexOf('/sysmgr/sys/login/auth/token') == -1) {
|
|
|
+ // console.log('[ axios.config ] >', config)
|
|
|
+ // if (config.url.startsWith("http")) {
|
|
|
+ // return config;
|
|
|
+ // }
|
|
|
+ // let localhost = ''
|
|
|
+ // if (process.env.NODE_ENV == "production") {
|
|
|
+ // localhost = window.staticHost ? window.staticHost : "/spfm/"
|
|
|
+ // }
|
|
|
+ // console.log('[ axios.localhost ] >', localhost)
|
|
|
+ // config.url = localhost + config.url
|
|
|
+ // let url = localhost + config.url
|
|
|
+ // console.log('[ axios.url ] >', url)
|
|
|
+ console.log(list.BASE_URL);
|
|
|
+ if (list.BASE_URL.indexOf('/sysmgr/sys/login/auth/captcha') == -1 && list.BASE_URL.indexOf('/sysmgr/sys/login/auth/token') == -1) {
|
|
|
let token = window.sessionStorage.agileauthtoken;
|
|
|
if (token != undefined && token != 'undefined') {
|
|
|
token = JSON.parse(token);
|