From 837c21ced9ed0aafe17a7c0c16975a1b6731eb9d Mon Sep 17 00:00:00 2001
From: qingyiay <2386314947@qq.com>
Date: 星期五, 07 七月 2023 11:30:37 +0800
Subject: [PATCH] 验质功能修改,websocket优化

---
 store/index.js |   26 +++++++++++++++++++-------
 1 files changed, 19 insertions(+), 7 deletions(-)

diff --git a/store/index.js b/store/index.js
index ed0f27b..4c8a99f 100644
--- a/store/index.js
+++ b/store/index.js
@@ -225,12 +225,22 @@
 			clearInterval(state.reconnectTimeOut)
 			state.socketTast = null
 			commit('changereconnectState', false)
-			if (state.connectNum < 6) {
-				dispatch('reconnect')
-			} else {
+			if (state.connectNum < 6 && state.globalisLogin) {
+				uni.showToast({
+					title: `杩炴帴澶辫触锛屾鍦ㄥ皾璇曠${state.connectNum}娆¤繛鎺,
+					icon: 'none'
+				})
 				commit('changereconnectNum', 1)
+				dispatch('reconnect')
+			} else if (state.connectNum > 6 && state.globalisLogin) {
+				commit('changereconnectNum', 1)
+				uni.showToast({
+					title: '缃戠粶寮傚父,璇风◢鍚庨噸璇�',
+					icon: 'none'
+				})
+			} else {
+				return
 			}
-
 		},
 		websocketOnError({ state, commit, dispatch }, e) {
 			// 濡傛灉閲嶈繛鐘舵�佷负false鍒欎笉杩涜閲嶈繛锛屼负true鎵嶄細
@@ -239,19 +249,21 @@
 			clearInterval(state.reconnectTimeOut)
 			state.socketTast = null
 			commit('changereconnectState', false)
-			if (state.connectNum < 6) {
+			if (state.connectNum < 6 && state.globalisLogin) {
 				uni.showToast({
 					title: `杩炴帴澶辫触锛屾鍦ㄥ皾璇曠${state.connectNum}娆¤繛鎺,
 					icon: 'none'
 				})
 				commit('changereconnectNum', 1)
 				dispatch('reconnect')
-			} else {
+			} else if (state.connectNum > 6 && state.globalisLogin) {
 				commit('changereconnectNum', 1)
 				uni.showToast({
 					title: '缃戠粶寮傚父,璇风◢鍚庨噸璇�',
 					icon: 'none'
 				})
+			} else {
+				return
 			}
 		},
 		// 鎺ユ敹鏁版嵁
@@ -262,7 +274,7 @@
 		reconnect({ state, commit, dispatch }) {
 			console.log(state.is_open_socket, '閲嶆柊杩炴帴socket鐘舵��');
 			clearInterval(state.globalIntervalId)
-			if (!state.is_open_socket) {
+			if (!state.is_open_socket && state.globalisLogin) {
 				state.reconnectTimeOut = setInterval(() => {
 					dispatch('websocketInit')
 				}, 5000)

--
Gitblit v1.9.1