yangys
2025-11-18 831cfa4c439c6d073d706a82d2a439f8b1818498
src/utils/tool.js
@@ -1,8 +1,8 @@
/*
 * @Descripttion: 工具集
 * @version: 1.2
 * @LastEditors: lzhe lzhe@example.com
 * @LastEditTime: 2024-10-08 18:04:17
 * @LastEditors: 李喆(开发组) lzhe@yxqiche.com
 * @LastEditTime: 2025-11-18 16:55:36
 */
import CryptoJS from 'crypto-js';
@@ -18,7 +18,7 @@
console.log(hostname,port,pathname)
if (process.env.NODE_ENV=='development') {
   //var path = "120.46.212.231:85";  //如果是本地联调,写成120.46.212.231:85,发版写成hostname+":"+port;
   //var path = "120.46.212.231:85/";  //如果是本地联调,写成120.46.212.231:86,发版写成hostname+":"+port;
   var path = hostname+":"+port;
} else {
   var path = hostname+":"+port;
@@ -271,5 +271,18 @@
      return `${encodeURIComponent(key)}=${encodeURIComponent(obj[key])}`;
     }).join('&');
}
// 下载文件
tool.downFile = function(link,fileName) {
   const x = new XMLHttpRequest();
   x.open('GET', link, true);
   x.responseType = 'blob';
   x.onload = function () {
      const url = window.URL.createObjectURL(x.response);
      const a = document.createElement('a');
      a.href = url;
      a.download = fileName;
      a.click();
   }
   x.send();
}
export default tool