From aad94b236ee3d6996cc3cfe1bfd6334a0c3557e9 Mon Sep 17 00:00:00 2001 From: RuoYi Date: Mon, 19 Sep 2022 13:22:52 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=9A=E7=94=A8=E4=B8=8B=E8=BD=BD=E6=96=B9?= =?UTF-8?q?=E6=B3=95=E6=96=B0=E5=A2=9Econfig=E9=85=8D=E7=BD=AE=E9=80=89?= =?UTF-8?q?=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/FileUpload/index.vue | 2 +- src/utils/request.js | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/components/FileUpload/index.vue b/src/components/FileUpload/index.vue index d3a0b97..10ee19f 100644 --- a/src/components/FileUpload/index.vue +++ b/src/components/FileUpload/index.vue @@ -70,7 +70,7 @@ const emit = defineEmits(); const number = ref(0); const uploadList = ref([]); const baseUrl = import.meta.env.VITE_APP_BASE_API; -const uploadFileUrl = ref(import.meta.env.VITE_APP_BASE_API + "/common/upload"); // 上传的图片服务器地址 +const uploadFileUrl = ref(import.meta.env.VITE_APP_BASE_API + "/common/upload"); // 上传文件服务器地址 const headers = ref({ Authorization: "Bearer " + getToken() }); const fileList = ref([]); const showTip = computed( diff --git a/src/utils/request.js b/src/utils/request.js index 79c720c..b0a528f 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -130,12 +130,13 @@ service.interceptors.response.use(res => { ) // 通用下载方法 -export function download(url, params, filename) { +export function download(url, params, filename, config) { downloadLoadingInstance = ElLoading.service({ text: "正在下载数据,请稍候", background: "rgba(0, 0, 0, 0.7)", }) return service.post(url, params, { transformRequest: [(params) => { return tansParams(params) }], headers: { 'Content-Type': 'application/x-www-form-urlencoded' }, - responseType: 'blob' + responseType: 'blob', + ...config }).then(async (data) => { const isLogin = await blobValidate(data); if (isLogin) {