Explorar el Código

预问诊请求地址修改

zhouna hace 5 años
padre
commit
532b0070a5
Se han modificado 2 ficheros con 4 adiciones y 4 borrados
  1. 3 3
      src/utils/ajax.js
  2. 1 1
      src/utils/tools.js

+ 3 - 3
src/utils/ajax.js

@@ -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' //必须添加,否则会乱码
   });
 }

+ 1 - 1
src/utils/tools.js

@@ -1211,7 +1211,7 @@ function getCalendarDate(info) {
 // 导出
 function downloadExportedData(data, fileName) {
     // var blob = new Blob([data], {type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8'}); //type表示xlsx类型
-    var blob = new Blob([data], {type: 'application/vnd.ms-excel'}); //type表示xlsx类型
+    var blob = new Blob([data], {type: 'application/vnd.ms-excel;charset=UTF-8'}); //type表示xlsx类型
     var href = window.URL.createObjectURL(blob);//创建下载的链接
     // 为兼容FF26 (不支持a标签的模拟点击事件)
      if (navigator.userAgent.indexOf("Firefox") > -1){