فهرست منبع

优化:聊天监听到断网,则立即把连接状态标记为 false,让其发不了消息

shizhongqi 10 ماه پیش
والد
کامیت
d657d972f9
2فایلهای تغییر یافته به همراه8 افزوده شده و 6 حذف شده
  1. 4 3
      hdApp/src/admin/chat/chatPage.vue
  2. 4 3
      mallApp/src/pages/chat/chatPage.vue

+ 4 - 3
hdApp/src/admin/chat/chatPage.vue

@@ -446,10 +446,11 @@ export default {
             }, 3000);
           }
 
+          this.isConnected = false;
           // 尝试重新连接超过 maxReconnectCount 次才标记为未连接状态
-          if (!this.isManualDisconnect && this.reconnectCount >= this.maxReconnectCount) {
-            this.isConnected = false;
-          }
+          // if (!this.isManualDisconnect && this.reconnectCount >= this.maxReconnectCount) {
+          //   this.isConnected = false;
+          // }
         });
 
         // 监听WebSocket错误

+ 4 - 3
mallApp/src/pages/chat/chatPage.vue

@@ -530,10 +530,11 @@ export default {
             }, 3000);
           }
 
+          this.isConnected = false;
           // 尝试重新连接超过 maxReconnectCount 次才标记为未连接状态
-          if (!this.isManualDisconnect && this.reconnectCount >= this.maxReconnectCount) {
-            this.isConnected = false;
-          }
+          // if (!this.isManualDisconnect && this.reconnectCount >= this.maxReconnectCount) {
+          //   this.isConnected = false;
+          // }
         });
 
         // 监听WebSocket错误