From f5a16e4534b815471fdd22edab89a010d492c4aa Mon Sep 17 00:00:00 2001 From: RuoYi <yzz_ivy@163.com> Date: 星期五, 28 十月 2022 20:13:44 +0800 Subject: [PATCH] 修复使用透明底png图片时,自动填充黑色背景 --- src/utils/request.js | 9 +++++---- 1 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/utils/request.js b/src/utils/request.js index e82383a..b0a528f 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -1,11 +1,11 @@ import axios from 'axios' import { ElNotification , ElMessageBox, ElMessage, ElLoading } from 'element-plus' -import store from '@/store' import { getToken } from '@/utils/auth' import errorCode from '@/utils/errorCode' import { tansParams, blobValidate } from '@/utils/ruoyi' import cache from '@/plugins/cache' import { saveAs } from 'file-saver' +import useUserStore from '@/store/modules/user' let downloadLoadingInstance; // 鏄惁鏄剧ず閲嶆柊鐧诲綍 @@ -85,7 +85,7 @@ } ).then(() => { isRelogin.show = false; - store.dispatch('LogOut').then(() => { + useUserStore().logOut().then(() => { location.href = '/index'; }) }).catch(() => { @@ -130,12 +130,13 @@ ) // 閫氱敤涓嬭浇鏂规硶 -export function download(url, params, filename) { +export function download(url, params, filename, config) { downloadLoadingInstance = ElLoading.service({ text: "姝e湪涓嬭浇鏁版嵁锛岃绋嶅��", 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) { -- Gitblit v1.9.3