From 69a246ac8a19604603b32a262eb32aee475ba3bc Mon Sep 17 00:00:00 2001
From: RuoYi <yzz_ivy@163.com>
Date: 星期二, 15 十一月 2022 14:24:34 +0800
Subject: [PATCH] 修复调度日志点击多次数据不变化的问题
---
src/utils/request.js | 15 +++++++++++----
1 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/src/utils/request.js b/src/utils/request.js
index e82383a..55936f9 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(() => {
@@ -97,6 +97,12 @@
ElMessage({
message: msg,
type: 'error'
+ })
+ return Promise.reject(new Error(msg))
+ } else if (code === 601) {
+ ElMessage({
+ message: msg,
+ type: 'warning'
})
return Promise.reject(new Error(msg))
} else if (code !== 200) {
@@ -130,12 +136,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