添加回复

pull/23/head
taoshihan1991 4 years ago
parent f7c97ca12e
commit 7a7a56b9e7

@ -10,8 +10,9 @@ type ReplyForm struct {
GroupName string `form:"group_name" binding:"required"`
}
type ReplyContentForm struct {
GroupId string `form:"group_id" binding:"required"`
Content string `form:"content" binding:"required"`
GroupId string `form:"group_id" binding:"required"`
Content string `form:"content" binding:"required"`
ItemName string `form:"item_name" binding:"required"`
}
func GetReplys(c *gin.Context) {
@ -52,7 +53,7 @@ func PostReplyContent(c *gin.Context) {
})
return
}
models.CreateReplyContent(replyContentForm.GroupId, kefuId.(string), replyContentForm.Content)
models.CreateReplyContent(replyContentForm.GroupId, kefuId.(string), replyContentForm.Content, replyContentForm.ItemName)
c.JSON(200, gin.H{
"code": 200,
"msg": "ok",

@ -42,12 +42,12 @@ func CreateReplyGroup(groupName string, userId string) {
}
DB.Create(g)
}
func CreateReplyContent(groupId string, userId string, content string) {
func CreateReplyContent(groupId string, userId string, content, itemName string) {
g := &ReplyItem{
GroupId: groupId,
UserId: userId,
Content: content,
ItemName: "",
ItemName: itemName,
}
DB.Create(g)
}

@ -85,8 +85,8 @@ func InitApiRouter(engine *gin.Engine) {
engine.POST("/config", middleware.JwtApiMiddleware, middleware.RbacAuth, controller.PostConfig)
engine.GET("/config", controller.GetConfig)
engine.GET("/replys", middleware.JwtApiMiddleware, controller.GetReplys)
engine.POST("/reply", middleware.JwtApiMiddleware, controller.PostReply)
engine.POST("/reply_content", middleware.JwtApiMiddleware, controller.PostReplyContent)
engine.POST("/reply", middleware.JwtApiMiddleware, middleware.RbacAuth, controller.PostReply)
engine.POST("/reply_content", middleware.JwtApiMiddleware, middleware.RbacAuth, controller.PostReplyContent)
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)

@ -196,7 +196,10 @@
<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>
<div class="replyItem" @click="messageContent=item.item_content" v-for="item in reply.items" >
<div class="replyItemTitle">关键词: <{item.item_name}></div>
<div class="replyItemContent">回复内容: <{item.item_content}></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="deleteReplyGroup(reply.group_id)" type="text">-删除组</el-button>
</el-collapse-item>
@ -266,7 +269,8 @@
width="30%"
top="0"
>
<el-input type="textarea" v-model="replyContent"></el-input>
<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="addReplyContent">保 存</el-button>
<el-button @click="replyContentDialog = false">取 消</el-button>

@ -48,6 +48,7 @@ var app=new Vue({
groupId:"",
replys:[],
replyContent:"",
replyTitle:"",
ipBlacks:[],
sendDisabled:false,
},
@ -705,7 +706,7 @@ var app=new Vue({
//添加回复内容
addReplyContent(){
var _this=this;
this.sendAjax("/reply_content","post",{group_id:_this.groupId,content:_this.replyContent},function(result){
this.sendAjax("/reply_content","post",{group_id:_this.groupId,item_name:_this.replyTitle,content:_this.replyContent},function(result){
//_this.otherKefus=result;
_this.replyContentDialog = false
_this.replyContent="";

Loading…
Cancel
Save