From e9d95f6a18c39e449cc3d4a8656f15f64e186aec Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期五, 15 五月 2026 15:33:03 +0800
Subject: [PATCH] 天津宝东 1.代码更新
---
src/utils/request.js | 23 +++++++----------------
1 files changed, 7 insertions(+), 16 deletions(-)
diff --git a/src/utils/request.js b/src/utils/request.js
index ba31649..9cfcf5b 100644
--- a/src/utils/request.js
+++ b/src/utils/request.js
@@ -125,25 +125,16 @@
// 閫氱敤涓嬭浇鏂规硶
export function download(url, params, filename, config) {
downloadLoadingInstance = ElLoading.service({ text: "姝e湪涓嬭浇鏁版嵁锛岃绋嶅��", background: "rgba(0, 0, 0, 0.7)", })
- const downloadName = config?.filename || filename
- const requestMethod = (config?.method || 'post').toLowerCase()
- const requestPromise = requestMethod === 'get'
- ? service.get(url, {
- params,
- responseType: 'blob',
- ...config
- })
- : service.post(url, params, {
- transformRequest: [(params) => { return tansParams(params) }],
- headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
- responseType: 'blob',
- ...config
- })
- return requestPromise.then(async (data) => {
+ return service.post(url, params, {
+ transformRequest: [(params) => { return tansParams(params) }],
+ headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
+ responseType: 'blob',
+ ...config
+ }).then(async (data) => {
const isBlob = blobValidate(data)
if (isBlob) {
const blob = new Blob([data])
- saveAs(blob, downloadName)
+ saveAs(blob, filename)
} else {
const resText = await data.text()
const rspObj = JSON.parse(resText)
--
Gitblit v1.9.3