From 5c48422b1117f6b466bc288b7ac5ace7d3f24516 Mon Sep 17 00:00:00 2001 From: qirong <2032486488@qq.com> Date: 星期四, 07 十二月 2023 14:26:56 +0800 Subject: [PATCH] 登录 --- src/utils/request.ts | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/utils/request.ts b/src/utils/request.ts index 5d688ad..c89cc52 100644 --- a/src/utils/request.ts +++ b/src/utils/request.ts @@ -53,7 +53,7 @@ config.url = url; } - if (!isRepeatSubmit && (config.method === 'post' || config.method === 'put')) { + if (!isRepeatSubmit && (config.method === 'post' || config.method === 'put' || config.method === 'get')) { const requestObj = { url: config.url, data: typeof config.data === 'object' ? JSON.stringify(config.data) : config.data, @@ -66,7 +66,7 @@ const s_url = sessionObj.url; // 璇锋眰鍦板潃 const s_data = sessionObj.data; // 璇锋眰鏁版嵁 const s_time = sessionObj.time; // 璇锋眰鏃堕棿 - const interval = 500; // 闂撮殧鏃堕棿(ms)锛屽皬浜庢鏃堕棿瑙嗕负閲嶅鎻愪氦 + const interval = 600000; // 闂撮殧鏃堕棿(ms)锛屽皬浜庢鏃堕棿瑙嗕负閲嶅鎻愪氦 if (s_data === requestObj.data && requestObj.time - s_time < interval && s_url === requestObj.url) { const message = '鏁版嵁姝e湪澶勭悊锛岃鍕块噸澶嶆彁浜�'; console.warn(`[${s_url}]: ` + message); @@ -77,7 +77,7 @@ } } // 褰撳紑鍚弬鏁板姞瀵� - if (isEncrypt && (config.method === 'post' || config.method === 'put')) { + if (isEncrypt && (config.method === 'post' || config.method === 'put' || config.method === 'get')) { // 鐢熸垚涓�涓� AES 瀵嗛挜 const aesKey = generateAesKey(); config.headers['encrypt-key'] = encrypt(encryptBase64(aesKey)); @@ -108,7 +108,7 @@ return res.data; } if (code === 401) { - + debugger const userStore = useUserStore(); await userStore.logout() @@ -118,10 +118,10 @@ } else if (code === HttpStatus.SERVER_ERROR) { console.log(msg); ElMessage({ message: msg, type: 'error' }); - return Promise.reject(new Error(msg)); + return Promise.reject(new Error('绯荤粺鍐呴儴閿欒')); } else if (code === HttpStatus.WARN) { ElMessage({ message: msg, type: 'warning' }); - return Promise.reject(new Error(msg)); + return Promise.reject(new Error('绯荤粺璀﹀憡娑堟伅')); } else if (code !== HttpStatus.SUCCESS) { ElNotification.error({ title: msg }); return Promise.reject('error'); -- Gitblit v1.8.0