From 0b0bcef2a7107e4274f24a6a84adfc5b9faccca1 Mon Sep 17 00:00:00 2001 From: taoshihan <630892807@qq.com> Date: Thu, 10 Nov 2022 23:38:32 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=A2=E6=9C=8D=E6=8F=90=E7=A4=BA=E4=BF=A1?= =?UTF-8?q?=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- static/css/common.css | 2 +- static/js/chat-page.js | 22 ++++++++-------------- static/templates/chat_page.html | 6 +++--- 3 files changed, 12 insertions(+), 18 deletions(-) diff --git a/static/css/common.css b/static/css/common.css index 9b95bea..98b1c9a 100644 --- a/static/css/common.css +++ b/static/css/common.css @@ -460,7 +460,7 @@ a{color: #07a9fe;text-decoration: none;} align-items: center; } .chatEntBox { - width: calc(100% - 270px); + width: calc(100% - 265px); float: left; border-right: 1px solid #e6e6e6; } diff --git a/static/js/chat-page.js b/static/js/chat-page.js index 1982475..133a59a 100644 --- a/static/js/chat-page.js +++ b/static/js/chat-page.js @@ -20,8 +20,6 @@ new Vue({ flyLang:GOFLY_LANG[LANG], textareaFocused:false, replys:[], - noticeName:"", - noticeAvatar:"", showIconBtns:false, showFaceIcon:false, isIframe:false, @@ -31,7 +29,6 @@ new Vue({ //初始化websocket initConn:function() { let socket = new ReconnectingWebSocket(this.server+"?visitor_id="+this.visitor.visitor_id);//创建Socket实例 - socket.maxReconnectAttempts = 30; this.socket = socket this.socket.onmessage = this.OnMessage; this.socket.onopen = this.OnOpen; @@ -41,9 +38,8 @@ new Vue({ }, OnOpen:function() { console.log("ws:onopen"); - this.chatTitle=GOFLY_LANG[LANG]['connectok']; - this.showTitle(this.chatTitle); - + //获取欢迎 + this.getNotice(); this.socketClosed=false; this.focusSendConn=false; }, @@ -227,8 +223,6 @@ new Vue({ _this.setCache("visitor",res.result); //_this.getMesssagesByVisitorId(); _this.initConn(); - //获取欢迎 - _this.getNotice(); }); // }else{ // this.visitor=obj; @@ -343,13 +337,13 @@ new Vue({ var code=res.code; if(code!=200) return; _this.kefuInfo=res.result; - var welcome=res.result.welcome; - if(!welcome) return; + _this.showTitle(_this.kefuInfo.nickname+" 为您服务"); + if(!_this.kefuInfo.welcome) return; var msg={ - content:replaceContent(welcome), - avator:res.result.avatar, - name :res.result.nickname, - time:new Date(), + content:replaceContent(_this.kefuInfo.welcome), + avator:_this.kefuInfo.avatar, + name :_this.kefuInfo.nickname, + time:_this.getNowDate(), } _this.msgList.push(msg); _this.scrollBottom(); diff --git a/static/templates/chat_page.html b/static/templates/chat_page.html index d5e453e..fccf1cf 100644 --- a/static/templates/chat_page.html +++ b/static/templates/chat_page.html @@ -11,10 +11,10 @@ - + - + @@ -91,5 +91,5 @@ var LANG=checkLang(); - +