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

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

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

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

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

@ -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;}

@ -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%;
}
}
}

Loading…
Cancel
Save