From 6a1ca738a5514bb7e45c20ae4c2f513e1e777ab0 Mon Sep 17 00:00:00 2001 From: taoshihan1991 <630892807@qq.com> Date: Wed, 21 Apr 2021 11:00:12 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E8=B6=85=E7=AE=A1=E4=B8=8D=E5=9C=A8?= =?UTF-8?q?=E8=8E=B7=E5=8F=96=E6=89=80=E6=9C=89=E5=9C=A8=E7=BA=BF=E7=94=A8?= =?UTF-8?q?=E6=88=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- controller/visitor.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/controller/visitor.go b/controller/visitor.go index 7aea8a4..443fa72 100644 --- a/controller/visitor.go +++ b/controller/visitor.go @@ -258,11 +258,10 @@ func GetVisitorOnlines(c *gin.Context) { // @Router /visitors_kefu_online [get] func GetKefusVisitorOnlines(c *gin.Context) { kefuName, _ := c.Get("kefu_name") - roleId, _ := c.Get("kefu_id") users := make([]*VisitorOnline, 0) visitorIds := make([]string, 0) for uid, visitor := range ws.ClientList { - if visitor.To_id != kefuName && roleId.(float64) != 2 { + if visitor.To_id != kefuName { continue } userInfo := new(VisitorOnline) From 60e2c27f991139fc4462b1e3f344dc6a42191c62 Mon Sep 17 00:00:00 2001 From: taoshihan1991 <630892807@qq.com> Date: Fri, 23 Apr 2021 14:27:15 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E5=8F=AF=E4=BB=A5=E7=BC=96=E8=BE=91?= =?UTF-8?q?=E8=87=AA=E5=8A=A8=E5=9B=9E=E5=A4=8D=E5=92=8C=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E8=AE=BF=E5=AE=A2=E5=92=A8=E8=AF=A2=E6=8C=89=E9=92=AE=E6=A0=B7?= =?UTF-8?q?=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cmd/js/chat-main.js | 38 ++++++++++++++++++++++++++++++++ cmd/templates/chat_main.html | 42 +++++++++++++++++++++++++++++++----- controller/reply.go | 18 ++++++++++++++++ models/replys.go | 7 ++++++ router/api.go | 1 + static/css/common.css | 4 ++-- static/css/gofly-front.css | 16 +++++++------- 7 files changed, 111 insertions(+), 15 deletions(-) diff --git a/cmd/js/chat-main.js b/cmd/js/chat-main.js index 9712b30..251bd03 100644 --- a/cmd/js/chat-main.js +++ b/cmd/js/chat-main.js @@ -2,6 +2,7 @@ var app=new Vue({ el: '#app', delimiters:["<{","}>"], data: { + visible:false, chatTitleType:"info", fullscreenLoading:true, leftTabActive:"first", @@ -41,12 +42,14 @@ var app=new Vue({ otherKefus:[], replyGroupDialog:false, replyContentDialog:false, + editReplyContentDialog:false, replySearch:"", replySearchList:[], replySearchListActive:[], groupName:"", groupId:"", replys:[], + replyId:"", replyContent:"", replyTitle:"", ipBlacks:[], @@ -102,6 +105,7 @@ var app=new Vue({ case "userOnline": this.addOnlineUser(redata.data); + break; case "userOffline": this.removeOfflineUser(redata.data); @@ -119,6 +123,7 @@ var app=new Vue({ break; } + if (redata.type == "message") { let msg = redata.data let content = {} @@ -148,6 +153,7 @@ var app=new Vue({ name:msg.name, body: msg.content, icon: msg.avator + }); _this.alertSound(); _this.chatInputing=""; @@ -214,6 +220,7 @@ var app=new Vue({ // content.is_kefu = true; // content.time = ''; // this.msgList.push(content); + _this.sendDisabled=false; this.scrollBottom(); }, //处理当前在线用户列表 @@ -237,6 +244,9 @@ var app=new Vue({ break; } } + if(this.visitor.visitor_id==retData.uid){ + this.getVistorInfo(retData.uid) + } }, //处理当前在线用户列表 @@ -386,6 +396,9 @@ var app=new Vue({ type: 'error' }); } + if(data.code==400){ + window.location.href="/login"; + } } }); }, @@ -500,6 +513,9 @@ var app=new Vue({ } }); }, + replaceContent(content){ + return replaceContent(content) + }, //滚到底部 scrollBottom(){ this.$nextTick(() => { @@ -747,6 +763,27 @@ var app=new Vue({ _this.getReplys(); }); }, + //编辑回复 + editReplyContent(save,id,title,content){ + var _this=this; + if(save=='yes'){ + var data={ + reply_id:this.replyId, + reply_title:this.replyTitle, + reply_content:this.replyContent + } + this.sendAjax("/reply_content_save","post",data,function(result){ + _this.editReplyContentDialog=false; + _this.getReplys(); + }); + }else{ + this.editReplyContentDialog=true; + this.replyId=id; + this.replyTitle=title; + this.replyContent=content; + } + + }, //搜索回复 searchReply(){ var _this=this; @@ -779,6 +816,7 @@ var app=new Vue({ }, //划词搜索 selectText(){ + return false; var _this=this; $('body').click(function(){ try{ diff --git a/cmd/templates/chat_main.html b/cmd/templates/chat_main.html index 2013e2a..1da14c8 100644 --- a/cmd/templates/chat_main.html +++ b/cmd/templates/chat_main.html @@ -24,6 +24,7 @@ white-space: nowrap; color: #999; } + .chatBoxMe .el-col-3{float: right;text-align: right;} .chatBoxMe .chatUser{text-align: right} .chatBox{width: 100%;height:calc(100% - 175px);;overflow-y: auto;overflow-x: hidden;} @@ -31,7 +32,7 @@
-确定删除吗?
+