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 |   58 ++++++++++++++++++++++++++++++++--------------------------
 1 files changed, 32 insertions(+), 26 deletions(-)

diff --git a/src/utils/request.ts b/src/utils/request.ts
index 55f7498..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;
 // 鏄惁鏄剧ず閲嶆柊鐧诲綍
@@ -47,6 +48,7 @@
     }
     // get璇锋眰鏄犲皠params鍙傛暟
     if (config.method === 'get' && config.params) {
+      console.log(config.params, '璇锋眰鍙傛暟');
       let url = config.url + '?' + tansParams(config.params);
       url = url.slice(0, -1);
       config.params = {};
@@ -78,6 +80,7 @@
     }
     // 褰撳紑鍚弬鏁板姞瀵�
     if (isEncrypt && (config.method === 'post' || config.method === 'put' || config.method === 'get')) {
+      console.log('寮�鍚簡鍙傛暟鍔犲瘑');
       // 鐢熸垚涓�涓� AES 瀵嗛挜
       const aesKey = generateAesKey();
       config.headers['encrypt-key'] = encrypt(encryptBase64(aesKey));
@@ -90,7 +93,7 @@
     return config;
   },
   (error: any) => {
-    console.log(error);
+    console.log(error, 'wcs');
     return Promise.reject(error);
   }
 );
@@ -113,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);
@@ -147,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