mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/learning-system-portal.git
synced 2025-12-23 01:36:44 +08:00
留言
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
<!--评论组件-->
|
||||
<div class="leaving-message">
|
||||
<div>
|
||||
<el-input type="textarea" :rows="4" placeholder="请输入内容" v-model="textarea"></el-input>
|
||||
<el-input type="textarea" :rows="4" placeholder="请输入内容" v-model="textarea" maxlength="200" show-word-limit></el-input>
|
||||
<el-button class="lea-btn" type="primary" @click="add()">发布</el-button>
|
||||
</div>
|
||||
<h6 class="lea-num">{{count}}条留言</h6>
|
||||
@@ -21,22 +21,26 @@
|
||||
<div class="li-right">
|
||||
<div class="replys-icon" @click="isReplys(item, idx)"><svg-icon style="margin-right: 4px;font-size: 14px;" icon-class="comment"></svg-icon>回复</div>
|
||||
<interactBar :type="7" :data="item" :comments="false" :shares="false" :views="false" :favorites="false"></interactBar>
|
||||
<div class="replys-icon" style="margin-right:0px;margin-left:10px" v-if="userInfo.aid == item.aid || pageId == item.aid" @click="delReply(item)"><svg-icon icon-class="notedel" style="margin-right: 4px;font-size: 14px;"></svg-icon>删除</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 回复框 -->
|
||||
<div class="replys-input" style="padding-left: 60px;margin:10px 0" v-if="item.isReplys">
|
||||
<el-input type="textarea" :rows="2" placeholder="请输入内容" v-model="replysContent"></el-input>
|
||||
<el-input type="textarea" :rows="2" placeholder="请输入内容" v-model="replysContent" maxlength="200" show-word-limit></el-input>
|
||||
<el-button class="lea-btn" type="primary" @click="addReplys()">回复</el-button>
|
||||
</div>
|
||||
<!-- 回复框 -->
|
||||
<div class="lev-li-tow" style="display:none">
|
||||
<div class="lev-li-tow" v-for="(rep,index) in item.replysList" :key="index">
|
||||
<div class="lev-li">
|
||||
<div class="li-img"><img src="/images/Avatarman.png"/></div>
|
||||
<div class="li-img"><author-img :avatar="rep.authorInfo.avatar" :aid="rep.authorInfo.aid" :sex="rep.authorInfo.sex"></author-img></div>
|
||||
<div class="li-text">
|
||||
<p class="portal-title-tow">小张 <span class="portal-summary-text">个性签名:不要期待,不要假想</span></p>
|
||||
<p>在学习课程的过程中,我常常惊叹于老师的知识面之广、对技术的理解之深。这么多的知识点,老师都能讲得驾轻就熟,把复这么多的知识驾轻就熟,把复这么多的知点,老杂的知识概念解释得通俗的知识面之广、对技术的理解之深。这么多的易懂。</p>
|
||||
<p class="portal-title-tow">{{rep.authorInfo.name}} <span class="portal-summary-text">个性签名:不要期待,不要假想</span></p>
|
||||
<p>{{rep.content}}</p>
|
||||
</div>
|
||||
<div class="li-right">
|
||||
<interactBar :type="7" :data="rep" :comments="false" :shares="false" :views="false" :favorites="false"></interactBar>
|
||||
<div class="replys-icon" style="margin-right:0px;margin-left:10px" v-if="userInfo.aid == item.aid || pageId == item.aid" @click="delReplySon(item,index)"><svg-icon icon-class="notedel" style="margin-right: 4px;font-size: 14px;"></svg-icon>删除</div>
|
||||
</div>
|
||||
<div class="li-right"><interactBar :type="7" :comments="false" :shares="false" :views="false" :favorites="false"></interactBar></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -85,7 +89,7 @@
|
||||
pageSize:10,
|
||||
aid:''
|
||||
},
|
||||
replys:{
|
||||
replysData:{
|
||||
id:'',
|
||||
reply:[],
|
||||
}
|
||||
@@ -100,19 +104,52 @@
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
delReplySon(item,index) { //子级的删除手动删掉,调用保存接口
|
||||
item.replysList.splice(index,1);
|
||||
let replysData = {
|
||||
id:item.id,
|
||||
reply:JSON.stringify(item.replysList)
|
||||
}
|
||||
apiGuestbook.answer(replysData).then(res=>{
|
||||
if(res.status == 200) {
|
||||
this.$message.success('删除留言成功');
|
||||
}
|
||||
})
|
||||
},
|
||||
delReply(item) {
|
||||
this.$confirm('此操作将永久删除该留言, 是否继续?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
apiGuestbook.del(item.id).then(res=>{
|
||||
if(res.status == 200) {
|
||||
this.getList();
|
||||
this.$message({type: 'success',message: '删除成功!' });
|
||||
}
|
||||
})
|
||||
}).catch(() => {
|
||||
this.$message({type: 'info', message: '已取消删除'});
|
||||
});
|
||||
},
|
||||
isReplys(item,idx) {
|
||||
item.isReplys = true;
|
||||
this.replys.id = item.id;
|
||||
this.replysData.id = item.id;
|
||||
this.replysData.reply = item.replysList;
|
||||
},
|
||||
addReplys() {
|
||||
this.replys.reply.content = this.replysContent;
|
||||
this.replys.reply.push({
|
||||
this.replysData.reply.push({
|
||||
content: this.replysContent,
|
||||
aid:this.userInfo.aid
|
||||
authorInfo:this.userInfo
|
||||
})
|
||||
this.replys.reply = JSON.stringify(this.replys.reply);
|
||||
apiGuestbook.answer(this.replys).then(res=>{
|
||||
|
||||
this.replysData.reply = JSON.stringify(this.replysData.reply);
|
||||
apiGuestbook.answer(this.replysData).then(res=>{
|
||||
if(res.status == 200) {
|
||||
this.$message.success('留言发布成功');
|
||||
this.leavingList.forEach(item=>{
|
||||
item.isReplys = false;
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
getList() {
|
||||
@@ -121,14 +158,15 @@
|
||||
if(res.status == 200) {
|
||||
this.count = res.result.count;
|
||||
res.result.list.forEach(item=>{
|
||||
// item.replysList = [];
|
||||
// item.replys = JSON.parse(item.replys);
|
||||
item.replysList = [];
|
||||
item.isReplys = false;
|
||||
item.authorInfo = { aid: "",name: "",orgInfo: "",avatar: "",sex: null }
|
||||
if(item.replys != '') {
|
||||
item.replysList = JSON.parse(item.replys);
|
||||
}
|
||||
})
|
||||
this.leavingList = res.result.list;
|
||||
this.getUserData(res.result.list);
|
||||
console.log(this.leavingList,'this.leavingList ');
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user