mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/learning-system-portal.git
synced 2025-12-13 04:46:44 +08:00
课程评论回复
This commit is contained in:
@@ -15,7 +15,7 @@
|
||||
<div class="comment" v-for="(com,comIdx) in list" :key="com.id">
|
||||
<div class="comment-top">
|
||||
<div class="comment-author">
|
||||
<authorInfo :avatar="com.avatar" :name="com.sysCreateBy" :sex="com.sex" :info="com.orgInfo"></authorInfo>
|
||||
<authorInfo :avatar="com.avatar" :name="com.name" :sex="com.sex" :info="com.orgInfo"></authorInfo>
|
||||
</div>
|
||||
</div>
|
||||
<div class="comment-body" >
|
||||
@@ -30,17 +30,6 @@
|
||||
<showTime :time="com.sysCreateTime"></showTime>
|
||||
<interactBar :type="10" :shares="false" :data="com" @addAnswers="showReply(com)" :favorites="false" :views="false" :comments="false" :answers="true"></interactBar>
|
||||
</div>
|
||||
<!-- <div class="comment-btns"> -->
|
||||
|
||||
<!-- <a><svg-icon icon-class="like"></svg-icon><span>66</span></a> -->
|
||||
<!-- <div v-show="btnsShowRowId==com.id"> -->
|
||||
|
||||
<!-- <a @click="showReply(com)"><svg-icon icon-class="comment" style="margin-right: 0px;font-size: 16px;"></svg-icon><span>回复</span></a> -->
|
||||
<!--必须当前登录人是一个人-->
|
||||
<!-- <a v-if="userInfo.aid==com.sysCreateAid" @click="delCommnet(com,comIdx)"><svg-icon icon-class="remove" style="margin-right: 0px;font-size: 16px;"></svg-icon><span>删除</span></a> -->
|
||||
<!-- <a v-if="com.replyList && com.replyList.length==5" @click="showMoreReply(com)" ><svg-icon icon-class="all" style="margin-right: 0px;font-size: 16px;"></svg-icon><span>全部</span></a> -->
|
||||
<!-- </div> -->
|
||||
<!-- </div> -->
|
||||
<div v-if="replyInfo.parentId==com.id" class="comment-reply" style="padding-bottom: 5px;">
|
||||
<div style="width:100%;display:flex;">
|
||||
<div style="flex: 1;">
|
||||
@@ -76,13 +65,6 @@
|
||||
<showTime :time="reply.sysCreateTime"></showTime>
|
||||
<interactBar :type="10" :shares="false" :data="reply" @addAnswers="showReply(reply)" :favorites="false" :views="false" :comments="false" :answers="true"></interactBar>
|
||||
</div>
|
||||
<!-- <div class="comment-btns"> -->
|
||||
<!-- <a><svg-icon icon-class="like"></svg-icon><span>66</span></a> -->
|
||||
<!-- <div v-show="btnsShowRowId==reply.id">
|
||||
<a @click="showReply(reply)"><svg-icon icon-class="comment" style="margin-right: 0px;font-size: 16px;"></svg-icon><span>回复</span></a>
|
||||
<a v-if="userInfo.aid==reply.sysCreateAid" @click="delReply(com,reply,replyIdx)"><svg-icon icon-class="remove" style="margin-right: 0px;font-size: 16px;"></svg-icon><span>删除</span></a>
|
||||
</div> -->
|
||||
<!-- </div> -->
|
||||
</div>
|
||||
<!--发布回复-->
|
||||
<div v-if="replyInfo.parentId==reply.id" class="comment-reply" style="padding-bottom: 5px;">
|
||||
@@ -163,6 +145,7 @@
|
||||
import apiComment from '@/api/modules/comments.js'
|
||||
import apiUser from '@/api/system/user.js'
|
||||
import authorInfo from '@/components/Portal/authorInfo.vue';
|
||||
import apiNote from '@/api/phase2/note.js';
|
||||
// import author from '@/components/Portal/author.vue';
|
||||
import { mapGetters } from 'vuex';
|
||||
export default {
|
||||
@@ -209,14 +192,14 @@
|
||||
isAuthor: false,
|
||||
authorList:[],//当前页面存储的用户信息,如果已经存在就不再重新请求了
|
||||
toUserId: '',
|
||||
loadStatus:'more',//more,loading,noMore
|
||||
pageSize:10,
|
||||
pageIndex:1,
|
||||
loadStatus:'more',//more,loading,noMore
|
||||
pageSize:10,
|
||||
pageIndex:1,
|
||||
total:0,
|
||||
listShow:true,
|
||||
inputValue:'',
|
||||
list:[],
|
||||
replyParent:{},
|
||||
inputValue:'',
|
||||
list:[],
|
||||
replyParent:{},
|
||||
replyShow:false,
|
||||
btnsShowRowId:'',
|
||||
replyInfo:{
|
||||
@@ -282,31 +265,13 @@
|
||||
mounted() {
|
||||
this.author = this.authorId;
|
||||
this.loadData(false);
|
||||
//在中文输入法状态下输入光标不在文字最后,同时会被遮挡两个文字大小的长度
|
||||
// let vm=document.querySelector('.hideControl input')
|
||||
// vm.addEventListener('compositionstart',(e)=>{
|
||||
// vm.style.padding='0 63px 0 0'
|
||||
// vm.size=100
|
||||
//以上两种方式都未解决
|
||||
// })
|
||||
},
|
||||
methods: {
|
||||
loadMore() {
|
||||
this.pageIndex +=1;
|
||||
this.loadData(true);
|
||||
},
|
||||
// lookYourself() {// 只看作者
|
||||
// this.pageIndex =1;
|
||||
// this.isAuthor = !this.isAuthor;
|
||||
// if(this.isAuthor){
|
||||
// this.author = this.authorId;
|
||||
// } else{
|
||||
// this.author = '';
|
||||
// }
|
||||
// this.loadData();
|
||||
// },
|
||||
loadAuthorInfo(list,ids){ //加载作者信息,头像,机构信息
|
||||
// console.log(list,ids)
|
||||
if(ids.length==0){
|
||||
return;
|
||||
}
|
||||
@@ -319,6 +284,7 @@
|
||||
item.avatar=author.avatar;
|
||||
item.orgInfo=author.orgInfo;
|
||||
item.sex=author.sex;
|
||||
item.name=author.name;
|
||||
return true;
|
||||
}else{
|
||||
return false;
|
||||
@@ -349,18 +315,19 @@
|
||||
let params={
|
||||
pageIndex:this.pageIndex,
|
||||
pageSize:this.pageSize,
|
||||
type:this.objType,
|
||||
id:this.objId,
|
||||
author: this.author,
|
||||
openType:1,
|
||||
courseId:this.objId,
|
||||
}
|
||||
let $this=this;
|
||||
apiComment.pageQuery(params).then(res=>{
|
||||
apiNote.coursePage(params).then(res=>{
|
||||
if(res.status==200){
|
||||
let ids=[];
|
||||
let allList=[];
|
||||
res.result.list.forEach(item=>{
|
||||
item.replyList = [];
|
||||
item.avatar='';
|
||||
item.orgInfo='';
|
||||
item.name='';
|
||||
item.isAll=false;
|
||||
//item.sex=null;
|
||||
allList.push(item);
|
||||
@@ -369,12 +336,39 @@
|
||||
item.replyList.forEach(reply=>{
|
||||
reply.avatar='';
|
||||
reply.orgInfo='';
|
||||
reply.name='';
|
||||
reply.sex=null;
|
||||
reply.isAll=false;
|
||||
allList.push(reply);
|
||||
ids.push(reply.sysCreateAid);
|
||||
})
|
||||
}
|
||||
|
||||
let query={
|
||||
pageIndex:this.pageIndex,
|
||||
pageSize:this.pageSize,
|
||||
type:6,
|
||||
id:item.id,
|
||||
// author: this.author,
|
||||
}
|
||||
// console.log(item,'item');
|
||||
apiComment.pageQuery(query).then(res=>{
|
||||
if(res.status == 200 && res.result.list.length > 0) {
|
||||
let ids = [];
|
||||
res.result.list.forEach(it=>{
|
||||
ids.push(item.sysCreateAid);
|
||||
it.replyList = [];
|
||||
it.avatar='';
|
||||
it.orgInfo='';
|
||||
it.name='';
|
||||
it.isAll=false;
|
||||
})
|
||||
// let ids = res.result.list.map(item=>item.sysCreateAid);
|
||||
const noReapetIds=[...new Set(ids)]
|
||||
this.loadAuthorInfo(res.result.list,noReapetIds);
|
||||
item.replyList.push(...res.result.list);
|
||||
}
|
||||
})
|
||||
});
|
||||
this.loadAuthorInfo(allList,ids);
|
||||
this.total=res.result.count;
|
||||
@@ -460,12 +454,14 @@
|
||||
item.isAll=!item.isAll;
|
||||
},
|
||||
showReply(item){
|
||||
console.log("9999999999");
|
||||
this.replyInfo.objType=this.objType;
|
||||
this.replyInfo.objId=this.objId;
|
||||
this.replyInfo.objId=item.id;
|
||||
this.replyInfo.parentId=item.id;
|
||||
this.replyInfo.replyAid=item.sysCreateAid;
|
||||
this.replyInfo.replyName=item.sysCreateBy;
|
||||
this.replyInfo.toAid='';
|
||||
this.replyInfo.toAname='';
|
||||
this.replyInfo.clevel=1;
|
||||
this.replyShow=true;
|
||||
},
|
||||
cancelReply(){
|
||||
@@ -480,11 +476,11 @@
|
||||
if(this.replyInfo.content==''){
|
||||
return;
|
||||
}
|
||||
this.replyInfo.commentId=comment.id;
|
||||
if(comment.replyList==''){
|
||||
comment.replyList=[];
|
||||
}
|
||||
apiComment.reply(this.replyInfo).then(res=>{
|
||||
// this.replyInfo.commentId=comment.id;
|
||||
// if(comment.replyList==''){
|
||||
// comment.replyList=[];
|
||||
// }
|
||||
apiComment.add(this.replyInfo).then(res=>{
|
||||
if(res.status==200){
|
||||
res.result.sex = null;
|
||||
res.result.isAll=false;
|
||||
|
||||
Reference in New Issue
Block a user