pull/23/head
630892807@qq.com 4 years ago
commit a3e06fd8ea

@ -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{

@ -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 @@
</style>
</head>
<body>
<div id="app">
<div id="app" class="chatMainPage">
<template>
<el-row :gutter="2">
<el-col :span="6">
@ -116,6 +117,7 @@
<div class="clear"></div>
<el-input type="textarea" class="chatArea" v-model="messageContent" v-on:keyup.enter.native="chatToUser" placeholder="请输入内容"></el-input>
</div>
</div>
</el-col>
<el-col :span="6" class="chatRight">
@ -190,12 +192,29 @@
<i class="el-icon-s-order"></i>&nbsp;<{reply.group_name}>
</template>
<div class="replyItem" @click="messageContent=item.item_content" v-for="item in reply.items" >
<el-tooltip :content="item.item_content" placement="left" effect="light">
<div class="replyItemTitle"><i class="header-icon el-icon-document"></i> <{item.item_name}></div>
</el-tooltip>
<el-popover
placement="left"
width="300"
trigger="hover">
<div v-html="replaceContent(item.item_content)">
</div>
<div class="replyItemTitle" slot="reference"><i class="header-icon el-icon-document"></i> <{item.item_name}></div>
</el-popover>
<el-button @click="editReplyContent('no',item.item_id,item.item_name,item.item_content)" type="text">编辑</el-button>
<el-button @click="deleteReplyContent(item.item_id)" type="text">删除</el-button></div>
<el-button @click="replyContentDialog=true;groupName=reply.group_name;groupId=reply.group_id" type="text">+添加回复内容</el-button>
<el-button @click="deleteReplyGroup(reply.group_id)" type="text">-删除组</el-button>
<el-popover
placement="top"
width="100"
v-model="visible">
<p>确定删除吗?</p>
<div style="text-align: right; margin: 0">
<el-button size="mini" type="text" @click="visible = false">取消</el-button>
<el-button type="primary" size="mini" @click="visible = false;deleteReplyGroup(reply.group_id)">确定</el-button>
</div>
<el-button slot="reference" type="text">-删除组</el-button>
</el-popover>
</el-collapse-item>
</el-collapse>
</div>
@ -270,6 +289,19 @@
<el-button @click="replyContentDialog = false">取 消</el-button>
</span>
</el-dialog>
<el-dialog
title="编辑回复内容"
:visible.sync="editReplyContentDialog"
width="30%"
top="0"
>
<el-input style="margin-bottom: 10px;" placeholder="关键词" v-model="replyTitle"></el-input>
<el-input placeholder="内容" type="textarea" v-model="replyContent"></el-input>
<span slot="footer" class="dialog-footer">
<el-button @click="editReplyContent('yes')">保 存</el-button>
<el-button @click="editReplyContentDialog = false">取 消</el-button>
</span>
</el-dialog>
<!--//回复内容-->
</template>
</div>

@ -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")

@ -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)

@ -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{})
}

@ -84,6 +84,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)

@ -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;}
.clear{clear:both;}

Loading…
Cancel
Save