From ca73a173f008c8d7a9d700bad897ca24fe2d2203 Mon Sep 17 00:00:00 2001
From: k94314517 <8417338+k94314517@user.noreply.gitee.com>
Date: 星期一, 16 十月 2023 09:29:57 +0800
Subject: [PATCH] 111

---
 minipro_standard/util/request/responseInterceptors.js |   18 ++++++++----------
 1 files changed, 8 insertions(+), 10 deletions(-)

diff --git a/minipro_standard/util/request/responseInterceptors.js b/minipro_standard/util/request/responseInterceptors.js
index 16f08d8..05bebf2 100644
--- a/minipro_standard/util/request/responseInterceptors.js
+++ b/minipro_standard/util/request/responseInterceptors.js
@@ -6,25 +6,23 @@
 	uni.$u.http.interceptors.response.use((response) => {
 		uni.hideLoading();
 		const data = response.data
-		if (response.data.code === 401) {     // 澶勭悊鐧诲綍杩囨湡
+		if (data.code === 401) {     // 澶勭悊鐧诲綍杩囨湡
 			uni.showToast({ title: '鐧诲綍杩囨湡锛屽噯澶囪嚜鍔ㄩ噸鏂扮櫥褰�', icon: 'none', duration: 2000, mask: true });
 			setTimeout(() => {
 				uni.reLaunch({ url: '/pages/login/login' });
 			}, 2000)
 			return
 		}
-		if (response.data.code !== 200) {     // 璇锋眰鎶ラ敊
-			uni.showToast({ title: response.data.message, icon: 'none', duration: 2000 });
+		if (data.code !== 200) {     // 璇锋眰鎶ラ敊
+			uni.showToast({ title: data.message, icon: 'none', duration: 2000 });
 		}
 		return data || {}
-	}, (response) => {
-		uni.hideLoading();
-		let code;
+	}, (error) => {
+		uni.hideLoading();
+		let code  = error.code
 		if (error.code === "ECONNABORTED") {
 			code = 999
-		} else {
-			code = error.response.status
-		}
+		} 
 		switch (code) {
 			case 404:
 				uni.showToast({ title: '璇锋眰璧勬簮涓嶅瓨鍦�', icon: 'none', duration: 2000 });
@@ -36,6 +34,6 @@
 				uni.showToast({ title: '璇锋眰瓒呮椂', icon: 'none', duration: 2000 });
 				break;
 		}
-		return Promise.reject(response)
+		return Promise.reject(error)
 	})
 }

--
Gitblit v1.9.3