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 @@ -
+
- -
<{item.item_name}>
-
+ +
+
+
<{item.item_name}>
+
+ 编辑 删除
+添加回复内容 - -删除组 + +

确定删除吗?

+
+ 取消 + 确定 +
+ -删除组 +
+
@@ -270,6 +289,19 @@ 取 消 + + + + + 保 存 + 取 消 + +
diff --git a/controller/reply.go b/controller/reply.go index 2c2c070..2bb2f23 100644 --- a/controller/reply.go +++ b/controller/reply.go @@ -68,6 +68,24 @@ func PostReplyContent(c *gin.Context) { "msg": "ok", }) } +func PostReplyContentSave(c *gin.Context) { + kefuId, _ := c.Get("kefu_name") + replyId := c.PostForm("reply_id") + replyTitle := c.PostForm("reply_title") + replyContent := c.PostForm("reply_content") + if replyId == "" || replyTitle == "" || replyContent == "" { + c.JSON(400, gin.H{ + "code": 200, + "msg": "参数错误!", + }) + return + } + models.UpdateReplyContent(replyId, kefuId.(string), replyTitle, replyContent) + c.JSON(200, gin.H{ + "code": 200, + "msg": "ok", + }) +} func DelReplyContent(c *gin.Context) { kefuId, _ := c.Get("kefu_name") id := c.Query("id") diff --git a/models/replys.go b/models/replys.go index 8cb5381..6efe406 100644 --- a/models/replys.go +++ b/models/replys.go @@ -67,6 +67,13 @@ func CreateReplyContent(groupId string, userId string, content, itemName string) } DB.Create(g) } +func UpdateReplyContent(id, userId, title, content string) { + r := &ReplyItem{ + ItemName: title, + Content: content, + } + DB.Model(&ReplyItem{}).Where("user_id = ? and id = ?", userId, id).Update(r) +} func DeleteReplyContent(id string, userId string) { DB.Where("user_id = ? and id = ?", userId, id).Delete(ReplyItem{}) } diff --git a/router/api.go b/router/api.go index 2b3d97f..f5b00ec 100644 --- a/router/api.go +++ b/router/api.go @@ -85,6 +85,7 @@ func InitApiRouter(engine *gin.Engine) { engine.GET("/replys", middleware.JwtApiMiddleware, controller.GetReplys) engine.POST("/reply", middleware.JwtApiMiddleware, middleware.RbacAuth, controller.PostReply) engine.POST("/reply_content", middleware.JwtApiMiddleware, middleware.RbacAuth, controller.PostReplyContent) + engine.POST("/reply_content_save", middleware.JwtApiMiddleware, controller.PostReplyContentSave) engine.DELETE("/reply_content", middleware.JwtApiMiddleware, middleware.RbacAuth, controller.DelReplyContent) engine.DELETE("/reply", middleware.JwtApiMiddleware, middleware.RbacAuth, controller.DelReplyGroup) engine.POST("/reply_search", middleware.JwtApiMiddleware, controller.PostReplySearch) diff --git a/static/css/common.css b/static/css/common.css index 220fd67..2c78d2f 100644 --- a/static/css/common.css +++ b/static/css/common.css @@ -321,7 +321,7 @@ line-height: 21px; font-size: 14px; } -.chatContent a{color: #07a9fe;text-decoration: none;} +a{color: #07a9fe;text-decoration: none;} .chatContent:before,.chatContent:after { content: ""; display: block; @@ -439,4 +439,4 @@ cursor: pointer; } .iconBtnsBox .kefuSendBtn{margin-right: 4px;float: right;} -.clear{clear:both;} \ No newline at end of file +.clear{clear:both;} diff --git a/static/css/gofly-front.css b/static/css/gofly-front.css index f168054..21b02ba 100644 --- a/static/css/gofly-front.css +++ b/static/css/gofly-front.css @@ -1,6 +1,6 @@ .launchButtonBox{ position: fixed!important; - bottom: 10px; + bottom: 2px; right: 20px; left: auto; z-index: 999999; @@ -54,13 +54,13 @@ display: none; } .launchButton{ - height: 48px; + height: 42px; width: auto; z-index: 10000000000000!important; - background: #fac917; + border-radius: 2px; border: 0!important; - border-radius: 20px; - box-shadow: 0 3px 15px 0 rgba(0,0,0,.25)!important; + background: rgb(18, 122, 202); + box-shadow: rgba(0, 0, 0, 0.06) 0px 1px 6px, rgba(0, 0, 0, 0.16) 0px 2px 32px; box-sizing: border-box!important; padding: 0 25px; cursor: pointer!important; @@ -80,11 +80,11 @@ height: 48px; } .launchButtonText { - color: #312927; + color: #fff; display: inline-block!important; font-family: -apple-system,BlinkMacSystemFont,segoe ui,Roboto,Oxygen,Ubuntu,Cantarell,fira sans,droid sans,helvetica neue,sans-serif!important; font-size: 1em; - line-height: 48px; + line-height: 42px; font-weight: 700!important; overflow: hidden!important; text-overflow: ellipsis!important; @@ -226,4 +226,4 @@ .launchButtonNotice:after{ right: 4%; } -} \ No newline at end of file +}