From 5bebf53d62c3519cf7be3e2217c5249e540173ec Mon Sep 17 00:00:00 2001
From: qingyiay <2386314947@qq.com>
Date: 星期四, 07 九月 2023 17:09:08 +0800
Subject: [PATCH] 操作指引修改

---
 store/index.js |   45 ++++++++++++++++++++++++++++++++++++---------
 1 files changed, 36 insertions(+), 9 deletions(-)

diff --git a/store/index.js b/store/index.js
index ed0f27b..1ee03b7 100644
--- a/store/index.js
+++ b/store/index.js
@@ -105,7 +105,11 @@
 		globalIntervalId: null,
 		is_open_socket: false, //閬垮厤閲嶅杩炴帴
 		connectNum: 1, //閲嶈繛娆℃暟,
-		reconnectTimeOut: null
+		reconnectTimeOut: null,
+		// 绉伴噸绋冲畾鎬�  0/绋冲畾 1/闈炵ǔ瀹�  闈炵ǔ瀹氭�佷笉鑳界偣绉伴噸
+		globalWarning: false,
+		globalShowWeigh: [],
+		isFirstLogin: true
 	},
 	mutations: {
 		lengthchange(state, payload) {
@@ -169,12 +173,23 @@
 		},
 		// 鏀瑰彉閲嶈繛娆℃暟
 		changereconnectNum(state, payload) {
-			if (state.connectNum < 6) {
+			if (state.connectNum <= 6) {
 				state.connectNum += payload
 			} else {
 				state.connectNum = payload
 			}
 		},
+		// 鏀瑰彉绋冲畾鎬�
+		changeWarning(state, payload) {
+			state.globalWarning = payload
+		},
+		changeglobalShowWeigh(state, payload) {
+			state.globalShowWeigh = payload
+		},
+		changeisFirstLogin(state, payload) {
+			state.isFirstLogin = payload
+			console.log(state.isFirstLogin, '绗竴娆$櫥褰�');
+		}
 	},
 	actions: {
 		websocketInit({ state, dispatch, commit }) {
@@ -225,12 +240,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 +264,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 +289,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