Parcourir la source

success里增加判断跳转api

Ming il y a 3 ans
Parent
commit
dccb492862
1 fichiers modifiés avec 17 ajouts et 19 suppressions
  1. 17 19
      util/api.js

+ 17 - 19
util/api.js

@@ -28,25 +28,33 @@ export const myRequest = (options) => {
 				let notShowToastUrl = ['Login/getLoginAuthorize'];
 				if (!notShowToastUrl.includes(options.url)) {
 					if (res.data.flag == false) {
-						return uni.showToast({
-							title: res.data.msg ? res.data.msg : "获取数据失败",
-							icon: "none"
-						})
+						
+						// 修复首页操作失败bug start
+						let notIndexFail2 = ['Index/getDataStatistics'];
+						if (notIndexFail2.includes(options.url)) {
+							window.location.href = 'https://qhome.usky.cn/index.html#/pages/index/index';
+						}else{
+							return uni.showToast({
+								title: res.data.msg ? res.data.msg : "获取数据失败",
+								icon: "none"
+							})
+						}
+						// end
+						
+						// return uni.showToast({
+						// 	title: res.data.msg ? res.data.msg : "获取数据失败",
+						// 	icon: "none"
+						// })
 					}
 					resolve(res)
 				}
-
 			},
 			fail: (err) => {
 
 				// 修复首页请求接口失败bug start
 				let notIndexFail = ['Index/getDataStatistics','Com/getAuthorizationUrl'];
 				if (notIndexFail.includes(options.url)) {
-					// alert(3)
 					window.location.href = 'https://qhome.usky.cn/index.html#/pages/index/index';
-					// uni.switchTab({
-					// 	url: '/pages/index/index'
-					// });
 				}else{
 					uni.showModal({
 						showCancel: false,
@@ -54,16 +62,6 @@ export const myRequest = (options) => {
 					});
 				}
 				// end
-				
-				// uni.showModal({
-				// 	showCancel: false,
-				// 	content: '请求接口失败'
-				// });
-				
-				
-				
-
-			
 
 				reject(err)