From 0ea5292d578722b614bb15204023ff0f55c14b6b Mon Sep 17 00:00:00 2001 From: taoshihan1991 <630892807@qq.com> Date: Wed, 24 Feb 2021 10:13:32 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8D=95=E7=82=B9=E8=BF=9E=E6=8E=A5=E4=B8=8E?= =?UTF-8?q?=E5=88=87=E6=8D=A2=E7=AA=97=E5=8F=A3=E9=87=8D=E8=BF=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- static/js/chat-page.js | 19 ++++++++++--------- ws/visitor.go | 12 ++++++++++++ 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/static/js/chat-page.js b/static/js/chat-page.js index 28040e6..e8b0f51 100644 --- a/static/js/chat-page.js +++ b/static/js/chat-page.js @@ -16,12 +16,10 @@ new Vue({ timer:null, sendDisabled:false, flyLang:GOFLY_LANG[LANG], - connecting:true, }, methods: { //初始化websocket initConn:function() { - this.connecting=true; let socket = new ReconnectingWebSocket(this.server+"?visitor_id="+this.visitor.visitor_id);//创建Socket实例 socket.maxReconnectAttempts = 30; this.socket = socket @@ -33,10 +31,10 @@ new Vue({ }, OnOpen:function() { this.chatTitle=GOFLY_LANG[LANG]['connectok']; - this.connecting=false; - + this.socketClosed=false; }, OnMessage:function(e) { + this.socketClosed=false; const redata = JSON.parse(e.data); if (redata.type == "kfOnline") { let msg = redata.data @@ -155,9 +153,9 @@ new Vue({ }, OnClose:function() { this.socketClosed=true; - this.chatTitle="连接关闭!请重新打开页面"; - $(".chatBox").append("