From 396b9a06392db5736eb5a7d485879174d73bb39a Mon Sep 17 00:00:00 2001
From: zhanghua <314079846@qq.com>
Date: 星期五, 09 一月 2026 16:03:45 +0800
Subject: [PATCH] 补签
---
src/utils/request.ts | 54 +++++++++++++++++++++++++++++-------------------------
1 files changed, 29 insertions(+), 25 deletions(-)
diff --git a/src/utils/request.ts b/src/utils/request.ts
index 79b82f4..4a40ea9 100644
--- a/src/utils/request.ts
+++ b/src/utils/request.ts
@@ -1,6 +1,6 @@
import axios, { AxiosResponse, InternalAxiosRequestConfig } from 'axios';
import { useUserStore } from '@/store/modules/user';
-import { getToken } from '@/utils/auth';
+import { getToken, getPlat } from '@/utils/auth';
import { tansParams, blobValidate } from '@/utils/ruoyi';
import cache from '@/plugins/cache';
import { HttpStatus } from '@/enums/RespEnum';
@@ -12,6 +12,7 @@
import { encrypt } from '@/utils/jsencrypt';
import router from "@/router";
import { ElLoading, ElMessage, ElNotification } from "element-plus";
+import { el } from 'element-plus/es/locale';
let downloadLoadingInstance: LoadingInstance;
// 鏄惁鏄剧ず閲嶆柊鐧诲綍
@@ -115,7 +116,10 @@
await userStore.logout()
console.log(code, 'code==============');
- await router.push({ path: '/login' });
+ if (getPlat() === 'dingding')
+ await router.push({ path: '/login' });
+ else
+ await router.push({ path: '/rzt_login' });
return
} else if (code === HttpStatus.SERVER_ERROR) {
console.log(msg);
@@ -149,30 +153,30 @@
downloadLoadingInstance = ElLoading.service({ text: '姝e湪涓嬭浇鏁版嵁锛岃绋嶅��', background: 'rgba(0, 0, 0, 0.7)' });
// prettier-ignore
return service.post(url, params, {
- transformRequest: [
- (params: any) => {
- return tansParams(params);
- }
- ],
- headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
- responseType: 'blob'
- }).then(async (resp: any) => {
- const isLogin = blobValidate(resp);
- if (isLogin) {
- const blob = new Blob([resp]);
- FileSaver.saveAs(blob, fileName);
- } else {
- const resText = await resp.data.text();
- const rspObj = JSON.parse(resText);
- const errMsg = errorCode[rspObj.code] || rspObj.msg || errorCode['default'];
- ElMessage.error(errMsg);
+ transformRequest: [
+ (params: any) => {
+ return tansParams(params);
}
- downloadLoadingInstance.close();
- }).catch((r: any) => {
- console.error(r);
- ElMessage.error('涓嬭浇鏂囦欢鍑虹幇閿欒锛岃鑱旂郴绠$悊鍛橈紒');
- downloadLoadingInstance.close();
- });
+ ],
+ headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
+ responseType: 'blob'
+ }).then(async (resp: any) => {
+ const isLogin = blobValidate(resp);
+ if (isLogin) {
+ const blob = new Blob([resp]);
+ FileSaver.saveAs(blob, fileName);
+ } else {
+ const resText = await resp.data.text();
+ const rspObj = JSON.parse(resText);
+ const errMsg = errorCode[rspObj.code] || rspObj.msg || errorCode['default'];
+ ElMessage.error(errMsg);
+ }
+ downloadLoadingInstance.close();
+ }).catch((r: any) => {
+ console.error(r);
+ ElMessage.error('涓嬭浇鏂囦欢鍑虹幇閿欒锛岃鑱旂郴绠$悊鍛橈紒');
+ downloadLoadingInstance.close();
+ });
}
// 瀵煎嚭 axios 瀹炰緥
export default service;
--
Gitblit v1.8.0