优化快捷回复搜索

pull/23/head
taoshihan1991 4 years ago
parent eae22546b6
commit f27a682cee

@ -80,8 +80,8 @@ func PostReplySearch(c *gin.Context) {
kefuId, _ := c.Get("kefu_name") kefuId, _ := c.Get("kefu_name")
search := c.PostForm("search") search := c.PostForm("search")
if search == "" { if search == "" {
c.JSON(400, gin.H{ c.JSON(200, gin.H{
"code": 200, "code": 400,
"msg": "参数错误", "msg": "参数错误",
}) })
return return

@ -4,7 +4,7 @@
<meta name="description" content=""> <meta name="description" content="">
<meta name="author" content="陶士涵"> <meta name="author" content="陶士涵">
<title>聊天界面</title> <title>聊天界面</title>
<link rel="stylesheet" href="/static/css/common.css?v=0.3.7"> <link rel="stylesheet" href="/static/css/common.css?v=0.3.8">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/element-ui@2.13.1/lib/theme-chalk/index.css"> <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/element-ui@2.13.1/lib/theme-chalk/index.css">
<script src="/static/js/functions.js"></script> <script src="/static/js/functions.js"></script>
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script> <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
@ -205,7 +205,17 @@
<el-button slot="append" icon="el-icon-search" @click="searchReply"></el-button> <el-button slot="append" icon="el-icon-search" @click="searchReply"></el-button>
</el-input> </el-input>
<div class="replyContent"> <div class="replyContent">
<el-collapse> <el-collapse v-show="replySearchList" v-model="replySearchListActive">
<el-collapse-item v-for="reply in replySearchList" :key="reply.group_id" :title="reply.group_name" :name="reply.group_id">
<template slot="title">
<i class="header-icon el-icon-info"></i>&nbsp;<{reply.group_name}>
</template>
<div class="replyItem" @click="messageContent=item.item_content" v-for="item in reply.items" ><{item.item_content}> &nbsp;&nbsp;<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-collapse-item>
</el-collapse>
<el-collapse v-show="replySearchList.length==0">
<el-collapse-item v-for="reply in replys" :key="reply.group_id" :title="reply.group_name" :name="reply.group_id"> <el-collapse-item v-for="reply in replys" :key="reply.group_id" :title="reply.group_name" :name="reply.group_id">
<template slot="title"> <template slot="title">
<i class="header-icon el-icon-info"></i>&nbsp;<{reply.group_name}> <i class="header-icon el-icon-info"></i>&nbsp;<{reply.group_name}>
@ -290,5 +300,5 @@
</template> </template>
</div> </div>
</body> </body>
<script src="/static/js/chat-main.js?v=0.3.9"></script> <script src="/static/js/chat-main.js?v=0.4.1"></script>
</html> </html>

@ -40,6 +40,8 @@ var app=new Vue({
replyGroupDialog:false, replyGroupDialog:false,
replyContentDialog:false, replyContentDialog:false,
replySearch:"", replySearch:"",
replySearchList:[],
replySearchListActive:[],
groupName:"", groupName:"",
groupId:"", groupId:"",
replys:[], replys:[],
@ -666,8 +668,15 @@ var app=new Vue({
//搜索回复 //搜索回复
searchReply(){ searchReply(){
var _this=this; var _this=this;
_this.replySearchListActive=[];
if(this.replySearch==""){
_this.replySearchList=[];
}
this.sendAjax("/reply_search","post",{search:this.replySearch},function(result){ this.sendAjax("/reply_search","post",{search:this.replySearch},function(result){
_this.replys=result; _this.replySearchList=result;
for (var i in result) {
_this.replySearchListActive.push(result[i].group_id);
}
}); });
}, },
//获取黑名单 //获取黑名单

Loading…
Cancel
Save