可以编辑自动回复和修改访客咨询按钮样式

pull/23/head
taoshihan1991 3 years ago
parent 6a1ca738a5
commit 60e2c27f99

@ -2,6 +2,7 @@ var app=new Vue({
el: '#app', el: '#app',
delimiters:["<{","}>"], delimiters:["<{","}>"],
data: { data: {
visible:false,
chatTitleType:"info", chatTitleType:"info",
fullscreenLoading:true, fullscreenLoading:true,
leftTabActive:"first", leftTabActive:"first",
@ -41,12 +42,14 @@ var app=new Vue({
otherKefus:[], otherKefus:[],
replyGroupDialog:false, replyGroupDialog:false,
replyContentDialog:false, replyContentDialog:false,
editReplyContentDialog:false,
replySearch:"", replySearch:"",
replySearchList:[], replySearchList:[],
replySearchListActive:[], replySearchListActive:[],
groupName:"", groupName:"",
groupId:"", groupId:"",
replys:[], replys:[],
replyId:"",
replyContent:"", replyContent:"",
replyTitle:"", replyTitle:"",
ipBlacks:[], ipBlacks:[],
@ -102,6 +105,7 @@ var app=new Vue({
case "userOnline": case "userOnline":
this.addOnlineUser(redata.data); this.addOnlineUser(redata.data);
break; break;
case "userOffline": case "userOffline":
this.removeOfflineUser(redata.data); this.removeOfflineUser(redata.data);
@ -119,6 +123,7 @@ var app=new Vue({
break; break;
} }
if (redata.type == "message") { if (redata.type == "message") {
let msg = redata.data let msg = redata.data
let content = {} let content = {}
@ -148,6 +153,7 @@ var app=new Vue({
name:msg.name, name:msg.name,
body: msg.content, body: msg.content,
icon: msg.avator icon: msg.avator
}); });
_this.alertSound(); _this.alertSound();
_this.chatInputing=""; _this.chatInputing="";
@ -214,6 +220,7 @@ var app=new Vue({
// content.is_kefu = true; // content.is_kefu = true;
// content.time = ''; // content.time = '';
// this.msgList.push(content); // this.msgList.push(content);
_this.sendDisabled=false;
this.scrollBottom(); this.scrollBottom();
}, },
//处理当前在线用户列表 //处理当前在线用户列表
@ -237,6 +244,9 @@ var app=new Vue({
break; break;
} }
} }
if(this.visitor.visitor_id==retData.uid){
this.getVistorInfo(retData.uid)
}
}, },
//处理当前在线用户列表 //处理当前在线用户列表
@ -386,6 +396,9 @@ var app=new Vue({
type: 'error' type: 'error'
}); });
} }
if(data.code==400){
window.location.href="/login";
}
} }
}); });
}, },
@ -500,6 +513,9 @@ var app=new Vue({
} }
}); });
}, },
replaceContent(content){
return replaceContent(content)
},
//滚到底部 //滚到底部
scrollBottom(){ scrollBottom(){
this.$nextTick(() => { this.$nextTick(() => {
@ -747,6 +763,27 @@ var app=new Vue({
_this.getReplys(); _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(){ searchReply(){
var _this=this; var _this=this;
@ -779,6 +816,7 @@ var app=new Vue({
}, },
//划词搜索 //划词搜索
selectText(){ selectText(){
return false;
var _this=this; var _this=this;
$('body').click(function(){ $('body').click(function(){
try{ try{

@ -24,6 +24,7 @@
white-space: nowrap; white-space: nowrap;
color: #999; color: #999;
} }
.chatBoxMe .el-col-3{float: right;text-align: right;} .chatBoxMe .el-col-3{float: right;text-align: right;}
.chatBoxMe .chatUser{text-align: right} .chatBoxMe .chatUser{text-align: right}
.chatBox{width: 100%;height:calc(100% - 175px);;overflow-y: auto;overflow-x: hidden;} .chatBox{width: 100%;height:calc(100% - 175px);;overflow-y: auto;overflow-x: hidden;}
@ -31,7 +32,7 @@
</style> </style>
</head> </head>
<body> <body>
<div id="app"> <div id="app" class="chatMainPage">
<template> <template>
<el-row :gutter="2"> <el-row :gutter="2">
<el-col :span="6"> <el-col :span="6">
@ -116,6 +117,7 @@
<div class="clear"></div> <div class="clear"></div>
<el-input type="textarea" class="chatArea" v-model="messageContent" v-on:keyup.enter.native="chatToUser" placeholder="请输入内容"></el-input> <el-input type="textarea" class="chatArea" v-model="messageContent" v-on:keyup.enter.native="chatToUser" placeholder="请输入内容"></el-input>
</div> </div>
</div> </div>
</el-col> </el-col>
<el-col :span="6" class="chatRight"> <el-col :span="6" class="chatRight">
@ -190,12 +192,29 @@
<i class="el-icon-s-order"></i>&nbsp;<{reply.group_name}> <i class="el-icon-s-order"></i>&nbsp;<{reply.group_name}>
</template> </template>
<div class="replyItem" @click="messageContent=item.item_content" v-for="item in reply.items" > <div class="replyItem" @click="messageContent=item.item_content" v-for="item in reply.items" >
<el-tooltip :content="item.item_content" placement="left" effect="light"> <el-popover
<div class="replyItemTitle"><i class="header-icon el-icon-document"></i> <{item.item_name}></div> placement="left"
</el-tooltip> 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="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="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-item>
</el-collapse> </el-collapse>
</div> </div>
@ -270,6 +289,19 @@
<el-button @click="replyContentDialog = false">取 消</el-button> <el-button @click="replyContentDialog = false">取 消</el-button>
</span> </span>
</el-dialog> </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> </template>
</div> </div>

@ -68,6 +68,24 @@ func PostReplyContent(c *gin.Context) {
"msg": "ok", "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) { func DelReplyContent(c *gin.Context) {
kefuId, _ := c.Get("kefu_name") kefuId, _ := c.Get("kefu_name")
id := c.Query("id") id := c.Query("id")

@ -67,6 +67,13 @@ func CreateReplyContent(groupId string, userId string, content, itemName string)
} }
DB.Create(g) 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) { func DeleteReplyContent(id string, userId string) {
DB.Where("user_id = ? and id = ?", userId, id).Delete(ReplyItem{}) DB.Where("user_id = ? and id = ?", userId, id).Delete(ReplyItem{})
} }

@ -85,6 +85,7 @@ func InitApiRouter(engine *gin.Engine) {
engine.GET("/replys", middleware.JwtApiMiddleware, controller.GetReplys) engine.GET("/replys", middleware.JwtApiMiddleware, controller.GetReplys)
engine.POST("/reply", middleware.JwtApiMiddleware, middleware.RbacAuth, controller.PostReply) engine.POST("/reply", middleware.JwtApiMiddleware, middleware.RbacAuth, controller.PostReply)
engine.POST("/reply_content", middleware.JwtApiMiddleware, middleware.RbacAuth, controller.PostReplyContent) 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_content", middleware.JwtApiMiddleware, middleware.RbacAuth, controller.DelReplyContent)
engine.DELETE("/reply", middleware.JwtApiMiddleware, middleware.RbacAuth, controller.DelReplyGroup) engine.DELETE("/reply", middleware.JwtApiMiddleware, middleware.RbacAuth, controller.DelReplyGroup)
engine.POST("/reply_search", middleware.JwtApiMiddleware, controller.PostReplySearch) engine.POST("/reply_search", middleware.JwtApiMiddleware, controller.PostReplySearch)

@ -321,7 +321,7 @@
line-height: 21px; line-height: 21px;
font-size: 14px; font-size: 14px;
} }
.chatContent a{color: #07a9fe;text-decoration: none;} a{color: #07a9fe;text-decoration: none;}
.chatContent:before,.chatContent:after { .chatContent:before,.chatContent:after {
content: ""; content: "";
display: block; display: block;
@ -439,4 +439,4 @@
cursor: pointer; cursor: pointer;
} }
.iconBtnsBox .kefuSendBtn{margin-right: 4px;float: right;} .iconBtnsBox .kefuSendBtn{margin-right: 4px;float: right;}
.clear{clear:both;} .clear{clear:both;}

@ -1,6 +1,6 @@
.launchButtonBox{ .launchButtonBox{
position: fixed!important; position: fixed!important;
bottom: 10px; bottom: 2px;
right: 20px; right: 20px;
left: auto; left: auto;
z-index: 999999; z-index: 999999;
@ -54,13 +54,13 @@
display: none; display: none;
} }
.launchButton{ .launchButton{
height: 48px; height: 42px;
width: auto; width: auto;
z-index: 10000000000000!important; z-index: 10000000000000!important;
background: #fac917; border-radius: 2px;
border: 0!important; border: 0!important;
border-radius: 20px; background: rgb(18, 122, 202);
box-shadow: 0 3px 15px 0 rgba(0,0,0,.25)!important; 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; box-sizing: border-box!important;
padding: 0 25px; padding: 0 25px;
cursor: pointer!important; cursor: pointer!important;
@ -80,11 +80,11 @@
height: 48px; height: 48px;
} }
.launchButtonText { .launchButtonText {
color: #312927; color: #fff;
display: inline-block!important; 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-family: -apple-system,BlinkMacSystemFont,segoe ui,Roboto,Oxygen,Ubuntu,Cantarell,fira sans,droid sans,helvetica neue,sans-serif!important;
font-size: 1em; font-size: 1em;
line-height: 48px; line-height: 42px;
font-weight: 700!important; font-weight: 700!important;
overflow: hidden!important; overflow: hidden!important;
text-overflow: ellipsis!important; text-overflow: ellipsis!important;
@ -226,4 +226,4 @@
.launchButtonNotice:after{ .launchButtonNotice:after{
right: 4%; right: 4%;
} }
} }

Loading…
Cancel
Save