Просмотр исходного кода

登录过期在支付时隐藏

fuwei 6 лет назад
Родитель
Сommit
4b92ceccd9
2 измененных файлов с 23 добавлено и 11 удалено
  1. 1 1
      mall/src/pages/pay/index.vue
  2. 22 10
      mall/src/plugins/luch-request_0.0.7/request.js

+ 1 - 1
mall/src/pages/pay/index.vue

@@ -488,7 +488,7 @@ export default {
     background-color: #fff;
     color: #3385ff;
     .view-more-text {
-      z-index: 997;
+      z-index: 200;
       margin-right: 14px;
     }
     i {

+ 22 - 10
mall/src/plugins/luch-request_0.0.7/request.js

@@ -146,9 +146,14 @@ class Request {
 					resolve(response.data)
 				}
 				if (statusCode === 200) { // 成功
+			
+					
 					if (response.data.code === 1) {
 						resolve(response.data)
 					} else {
+						
+						let noLogin = ['pages/pay/index','pages/callback/success']
+						let currentPages = getCurrentPages()[0].route
 						// 返回错误信息
 						if (response.data.code == 0) {
 							if (!config.hideError) {
@@ -163,11 +168,15 @@ class Request {
 						} else if (response.data.code && response.data.code == -1) {
 							// 无权限或者登录过期
 							uni.removeStorageSync('token')
-							uni.showToast({
-								title: '登录过期,正在重新登录...',
-								icon: 'none',
-								mask: true
-							})
+							
+							if(noLogin.indexOf(currentPages) == -1){
+								uni.showToast({
+									title: '登录过期,正在重新登录...',
+									icon: 'none',
+									mask: true
+								})
+							}
+							
 							setTimeout(() => {
 								getCheckLogin()
 								uni.reLaunch({
@@ -178,11 +187,14 @@ class Request {
 							uni.removeStorageSync('token')
 							uni.removeStorageSync('shopUser')
 							uni.removeStorageSync('account')
-							uni.showToast({
-								title: '登录失效,正在重新登录...',
-								icon: 'none',
-								mask: true
-							})
+							if(noLogin.indexOf(currentPages) == -1){
+								uni.showToast({
+									title: '登录失效,正在重新登录...',
+									icon: 'none',
+									mask: true
+								})
+							}
+							
 							setTimeout(() => {
 								getCheckLogin()
 								uni.reLaunch({