|
@@ -5,7 +5,7 @@ $.support.cors = true;
|
|
|
const axios=require('axios');
|
|
|
const qs=require('querystring');
|
|
|
const isLocal = window.location.hostname.indexOf('localhost')!=-1;
|
|
|
-// const qhost = isLocal?host+prefix:prefix;
|
|
|
+const orgin = window.location.origin
|
|
|
const qhost = isLocal?host+prefix:prefix;
|
|
|
axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded';
|
|
|
//axios.defaults.baseURL = host; //默认地址
|
|
@@ -68,7 +68,7 @@ const json=(url,data,spec)=>{
|
|
|
//兼容ie8,axios在ie8下content-type设置不成功且会把headers置为null
|
|
|
return axios({
|
|
|
method:'post',
|
|
|
- url:url.indexOf('http:')!=-1?url:(spec?host+url:qhost+url),
|
|
|
+ url:url.indexOf('http:')!=-1?url:((spec&&isLocal)?host+url:((spec&&!isLocal)?orgin+url:qhost+url)),
|
|
|
data
|
|
|
});/*new Promise((resolve,reject)=>{
|
|
|
$.ajax({
|
|
@@ -92,7 +92,7 @@ const expJson = (url,data) =>{
|
|
|
method:'post',
|
|
|
url:url.indexOf('http:')!=-1?url:qhost+url,
|
|
|
data,
|
|
|
- contentType: "application/vnd.ms-excel" ,
|
|
|
+ contentType: "application/vnd.ms-excel;charset=UTF-8" ,
|
|
|
responseType: 'blob' //必须添加,否则会乱码
|
|
|
});
|
|
|
}
|