| | |
| | | /* |
| | | * @Descripttion: 工具集 |
| | | * @version: 1.2 |
| | | * @LastEditors: lzhe lzhe@example.com |
| | | * @LastEditTime: 2024-10-22 20:58:47 |
| | | * @LastEditors: 李喆(开发组) lzhe@yxqiche.com |
| | | * @LastEditTime: 2025-11-18 16:55:36 |
| | | */ |
| | | |
| | | import CryptoJS from 'crypto-js'; |
| | |
| | | |
| | | 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; |
| | |
| | | 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 |