mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/learning-system-portal.git
synced 2025-12-11 11:56:44 +08:00
940 lines
34 KiB
Vue
940 lines
34 KiB
Vue
<template>
|
||
<!--笔记组件-->
|
||
<div class="comments">
|
||
<div v-if="showTop" class="comments-top">
|
||
<div class="comments-top-left portal-title-tow" style="font-size: 18px;">{{total}}条笔记
|
||
<el-checkbox v-if="objType ==2" class="btn" v-model="value" type="primary">只看作者</el-checkbox>
|
||
<el-checkbox v-if="objType ==3" class="btn" v-model="value" type="primary">{{'只看案主'}}</el-checkbox>
|
||
<span v-if="objType ==3" class="anzhu"> @案主可以给他发私信哦</span>
|
||
</div>
|
||
</div>
|
||
<!--列表内容-->
|
||
<div class="comments-items" v-show="listShow">
|
||
<!--一个评论-->
|
||
<div class="zan-wu" v-if="list.length == 0">暂无公开笔记~</div>
|
||
<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.name" :sex="com.sex" :info="com.orgInfo" :sign="com.sign" :aid="com.sysCreateAid"></authorInfo>
|
||
</div>
|
||
</div>
|
||
<div class="comment-body" >
|
||
<div class="comment-info" @mouseover="showButtons(com.id)" @mouseout="hideButtons()">
|
||
<div class="comment-content" @click="cancelReply()">
|
||
<span class="play-time" v-if="com.playTime>0"><img :src="`${webBaseUrl}/images/coteplay.png`" alt=""> {{ getHMS(com.playTime) }}</span>
|
||
<span class="portal-summary-text" style="color: #666666;" v-html="displayAll(com)"></span>
|
||
<span v-if="com.content.length>170 || com.content.split('\n').length>3" @click="changeIsAll(com)">
|
||
{{com.isAll?'收起':'全文'}}
|
||
</span>
|
||
</div>
|
||
<div class="comment-time portal-time">
|
||
<showTime :time="com.sysCreateTime"></showTime>
|
||
<interactBar :type="6" :pageType="1" :pageParams="objId" :shares="false" :data="com" @addAnswers="showReply(com)" :views="false" :comments="false" :answers="true"></interactBar>
|
||
</div>
|
||
<div v-if="replyInfo.parentId==com.id" class="comment-reply" style="padding-bottom: 5px;margin-top: 20px;">
|
||
<div style="width:100%;display:flex;">
|
||
<div style="flex: 1;">
|
||
<el-input class="hideControl" type="textarea" show-word-limit v-model="replyInfo.content" maxlength="800" placeholder="回复内容..."></el-input>
|
||
</div>
|
||
<div style="width: 120px;display: flex;justify-content: flex-end;">
|
||
<el-button @click="submitReply(com)" type="primary">发布回复</el-button>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<!--回复内容-->
|
||
<div v-if="com.replyList && com.replyList.length>0">
|
||
<div class="comment" v-for="(reply,replyIdx) in com.replyList" :key="reply.id" v-if="com.showAll || replyIdx<3" :class="replyIdx===com.replyList.length-1 ? 'comment-last' : ''">
|
||
<div class="comment-top">
|
||
<div class="comment-author">
|
||
<authorInfo :avatar="reply.avatar" :aid="reply.sysCreateAid" :name="reply.sysCreateBy" :sex="reply.sex" :info="reply.orgInfo" :sign="reply.sign"></authorInfo>
|
||
<span style="margin-left: 10px;color: #8590A6;font-size:14px; ">
|
||
<!-- <svg-icon style="font-size: 10px;margin-right: 0;" icon-class="triangle"></svg-icon> -->
|
||
<span>回复了</span>
|
||
</span>
|
||
<span style="margin-left: 6px;font-size:14px;" class="portal-title-tow" >{{reply.replyName || reply.toAname}}</span>
|
||
</div>
|
||
</div>
|
||
<div class="comment-body" @mouseover="showButtons(reply.id)" @mouseout="hideButtons()">
|
||
<div class="comment-info" >
|
||
<div class="comment-content" @click="cancelReply()">
|
||
<span class="portal-summary-text" style="color: #666666;" v-html="displayAll(reply)"></span>
|
||
<span v-if="reply.content.length>170 || com.content.split('\n').length>3" @click="changeIsAll(reply)">
|
||
{{reply.isAll?'收起':'全文'}}
|
||
</span>
|
||
</div>
|
||
<div class="comment-time portal-time">
|
||
<showTime :time="reply.sysCreateTime"></showTime>
|
||
<interactBar :type="60" :pageType="1" :pageParams="objId" :shares="false" :data="reply" @addAnswers="showReply(reply)" :views="false" :favorites="false" :comments="false" :answers="true"></interactBar>
|
||
</div>
|
||
</div>
|
||
<!--发布回复-->
|
||
<div v-if="replyInfo.parentId==reply.id" class="comment-reply" style="padding-bottom: 5px;margin-top: 20px;">
|
||
<div style="width:100%;display:flex;">
|
||
<div style="flex: 1;">
|
||
<el-input show-word-limit class="hideControl" type="textarea" v-model="replyInfo.content" maxlength="100" placeholder="回复内容..."></el-input>
|
||
</div>
|
||
<div style="width: 120px;display: flex;justify-content: flex-end;">
|
||
<el-button @click="submitReplyAdd(com)" type="primary">发布回复</el-button>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div v-if="!com.showAll && com.replyList.length>3" style="padding-left: 45px;padding-bottom: 10px;" @click="loadReplyMore(com)"><span style="color: #9e9e9e;cursor: pointer; border-radius: 5px;border:1px solid #cccccc;padding: 5px 10px;font-size: 14px;">加载更多>></span></div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="pagination-div">
|
||
<!-- v-if="moreState == 1 -->
|
||
<span class="pag-text" @click="loadMore()" v-if="moreState == 1">加载更多</span>
|
||
<span class="pag-text-msg" style="font-size:14px;color: #444444;" v-else-if="list.length !== 0 && moreState == 3">没有更多数据了</span>
|
||
</div>
|
||
<el-dialog title="全部回复内容" width="60%" :visible.sync="replyDiaglog.show" :close-on-click-modal="false" custom-class="g-dialog">
|
||
<div style="padding: 10px;max-height: 500px;overflow-y: auto;">
|
||
<div class="comment" v-for="(reply,rIdx) in replyDiaglog.list" :key="rIdx">
|
||
<div class="comment-top">
|
||
<div class="comment-author">
|
||
<authorInfo :avatar="reply.avatar" :name="reply.sysCreateBy" :sex="reply.sex" :info="reply.orgInfo"></authorInfo>
|
||
<span style="margin-left: 10px;color: #8590A6;font-size:14px; ">回复</span>
|
||
<span style="margin-left: 10px; font-size:14px">{{reply.replyName || reply.toAname}}</span>
|
||
</div>
|
||
<div class="comment-time">
|
||
<showTime :time="reply.sysCreateTime"></showTime>
|
||
</div>
|
||
</div>
|
||
<div class="comment-body" @mouseover="showButtons(reply.id)" @mouseout="hideButtons()">
|
||
<div class="comment-info">
|
||
<div class="comment-content">{{reply.content}}</div>
|
||
<div class="comment-btns"><!--操作还没有加-->
|
||
<div v-show="btnsShowRowId==reply.id">
|
||
<a @click="showDlgReply(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="delDlgReply(reply,rIdx)"><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;">
|
||
<div style="width:100%;display:flex;">
|
||
<div style="flex: 1;">
|
||
<el-input show-word-limit class="hideControl" type="textarea" v-model="replyInfo.content" maxlength="100" placeholder="回复内容..."></el-input>
|
||
</div>
|
||
<div style="width: 120px;display: flex;justify-content: flex-end;">
|
||
<el-button @click="submitDlgReply(com)" type="primary">发布回复</el-button>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div style="padding: 20px 10px;text-align: center;">
|
||
<div v-if="replyDiaglog.pages>replyDiaglog.pageIndex">
|
||
<span class="pag-text" @click="loadMoreReply()">加载更多</span>
|
||
</div>
|
||
<div v-else >
|
||
<span class="pag-text-msg">没有更多数据了</span>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<span slot="footer" class="dialog-footer">
|
||
<el-button @click="replyDiaglog.show= false"> 关 闭 </el-button>
|
||
</span>
|
||
</el-dialog>
|
||
</div>
|
||
</template>
|
||
<script>
|
||
import showTime from '@/components/Portal/datetimeShow.vue'
|
||
import interactBar from "@/components/Portal/interactBar.vue";
|
||
import apiComment from '@/api/modules/comments.js'
|
||
import apiUser from '@/api/system/user.js'
|
||
import authorInfo from '@/components/Portal/commentAuthor.vue';
|
||
import apiNote from '@/api/phase2/note.js';
|
||
import {getHMS} from '@/utils/tools.js';
|
||
// import author from '@/components/Portal/author.vue';
|
||
import { mapGetters } from 'vuex';
|
||
export default {
|
||
props:{
|
||
showTop:{
|
||
type:Boolean,
|
||
default:true
|
||
},
|
||
authorId:{
|
||
type:String,
|
||
},
|
||
objId:{
|
||
type:String,
|
||
required:true
|
||
},
|
||
objType:{
|
||
type:Number,
|
||
required:true
|
||
},
|
||
objTitle:{
|
||
type:String,
|
||
default:''
|
||
},
|
||
toUsers:{
|
||
type:Array,
|
||
},
|
||
|
||
readonly:{
|
||
type:Boolean,
|
||
default:false
|
||
},
|
||
name:{
|
||
type:String,
|
||
default:''
|
||
}
|
||
},
|
||
components:{showTime,authorInfo,interactBar},
|
||
computed: {
|
||
...mapGetters(['userInfo'])
|
||
},
|
||
data() {
|
||
return {
|
||
getHMS,
|
||
replyLoading:false,
|
||
radio:1,
|
||
value:false,
|
||
sex:null,
|
||
author:'',
|
||
moreState:1,
|
||
isAuthor: false,
|
||
authorList:[],//当前页面存储的用户信息,如果已经存在就不再重新请求了
|
||
toUserId: '',
|
||
loadStatus:'more',//more,loading,noMore
|
||
pageSize:10,
|
||
pageIndex:1,
|
||
total:0,
|
||
listShow:true,
|
||
inputValue:'',
|
||
list:[],
|
||
replyParent:{},
|
||
replyShow:false,
|
||
btnsShowRowId:'',
|
||
replyInfo:{
|
||
clevel:2,
|
||
parentId:'',
|
||
replyAid:'',
|
||
commentId:'',
|
||
replyName:'',
|
||
objType:'',
|
||
objId:'',
|
||
content:''
|
||
},
|
||
replyDiaglog:{
|
||
show:false,
|
||
pageIndex:1,
|
||
pageSize:8,
|
||
pages:1,
|
||
count:0,
|
||
commentId:'',
|
||
list:[]
|
||
},
|
||
toUserDig:{
|
||
show:false,
|
||
name:'',
|
||
chooseUserId:'',
|
||
chooseUserName:'',
|
||
list:[]
|
||
},
|
||
visible:false,
|
||
}
|
||
},
|
||
watch:{
|
||
value(newVal,oldVal){
|
||
if(newVal){
|
||
this.author = this.authorId;
|
||
} else {
|
||
this.author = '';
|
||
}
|
||
this.loadData();
|
||
},
|
||
radio(newVal){
|
||
if(newVal == 2){
|
||
this.author = this.authorId;
|
||
} else {
|
||
this.author = '';
|
||
}
|
||
this.loadData();
|
||
},
|
||
inputValue(val,oldVal) {
|
||
let fu = val.substr(-1);
|
||
if(fu == '@'&&!oldVal) {
|
||
this.toUserId = '';
|
||
if(this.toUsers.length == 1 && this.toUsers.length !== 0) {
|
||
this.toUserDig.chooseUserId = this.toUsers[0].aid;
|
||
this.toUserDig.chooseUserName=this.toUsers[0].name;
|
||
this.inputValue+=this.toUsers[0].name;
|
||
}else {
|
||
this.$refs.tag.$el.click();
|
||
}
|
||
}
|
||
}
|
||
},
|
||
mounted() {
|
||
this.author = this.authorId;
|
||
this.loadData(false);
|
||
this.$bus.$on('noteListRefresh',(val)=>{
|
||
this.loadData();
|
||
})
|
||
},
|
||
methods: {
|
||
loadReplyMore(item){
|
||
item.showAll=true;
|
||
},
|
||
loadMore() {
|
||
this.pageIndex +=1;
|
||
this.loadData(true);
|
||
},
|
||
loadAuthorInfo(list,ids){ //加载作者信息,头像,机构信息
|
||
if(ids.length==0){
|
||
return;
|
||
}
|
||
const noReapetIds=[...new Set(ids)]
|
||
apiUser.getByIds(ids).then(res=>{
|
||
if(res.status==200){
|
||
list.forEach((item,index)=>{
|
||
res.result.some(author=>{
|
||
if(author.aid==item.sysCreateAid){
|
||
item.avatar=author.avatar;
|
||
item.orgInfo=author.orgInfo;
|
||
item.sex=author.sex;
|
||
item.name=author.name;
|
||
item.sign=author.sign;
|
||
return true;
|
||
}else{
|
||
return false;
|
||
}
|
||
})
|
||
});
|
||
}else{
|
||
console.log('加载用户头像信息:'+res.error);
|
||
//this.$message.error(res.message);
|
||
}
|
||
});
|
||
},
|
||
// cancelTeacher() {
|
||
// this.inputValue = this.inputValue.substr(0, this.inputValue.length -1);
|
||
// this.visible = false;
|
||
// },
|
||
confirmTeacher() {
|
||
this.toUserDig.chooseUserId = this.toUserId;
|
||
this.toUsers.forEach(item=>{
|
||
if(item.aid == this.toUserId) {
|
||
this.toUserDig.chooseUserName=item.name;
|
||
this.inputValue+=item.name;
|
||
}
|
||
})
|
||
this.visible = false;
|
||
},
|
||
loadData(append){
|
||
let params={
|
||
pageIndex:this.pageIndex,
|
||
pageSize:this.pageSize,
|
||
openType:1,
|
||
courseId:this.objId,
|
||
}
|
||
let $this=this;
|
||
apiNote.coursePage(params).then(res=>{
|
||
if(res.status==200){
|
||
let ids=[];
|
||
let allList=[];
|
||
res.result.list.forEach(item=>{
|
||
item.answers=item.comments;
|
||
item.showAll=false;
|
||
item.title = this.name;
|
||
item.replyList = [];
|
||
item.avatar='';
|
||
item.orgInfo='';
|
||
item.name='';
|
||
item.isAll=false;
|
||
//item.sex=null;
|
||
allList.push(item);
|
||
ids.push(item.sysCreateAid);
|
||
//没有replyList
|
||
if(item.replyList && item.replyList!=''){
|
||
item.replyList.forEach(reply=>{
|
||
reply.answers=reply.replys;
|
||
reply.title=this.name;
|
||
reply.avatar='';
|
||
reply.orgInfo='';
|
||
reply.name='';
|
||
reply.sex=null;
|
||
reply.isAll=false;
|
||
allList.push(reply);
|
||
ids.push(reply.sysCreateAid);
|
||
})
|
||
}
|
||
|
||
let query={
|
||
objType:6,
|
||
objId:item.id
|
||
}
|
||
//console.log(item,'item'); 去读取回复
|
||
//2022-11-2日与产品(润博)确认,笔记回复只显示一级,不显示二级: "value",
|
||
//直接修改后台,查询全部
|
||
apiComment.listQuery(query).then(res2=>{
|
||
if(res2.status == 200 && res2.result.length > 0) {
|
||
let ids = [];
|
||
//let allList=[];
|
||
res2.result.forEach(it=>{
|
||
ids.push(it.sysCreateAid);
|
||
it.answers=it.replys;
|
||
it.replyList = [];
|
||
it.avatar='';
|
||
it.orgInfo='';
|
||
it.name='';
|
||
it.isAll=false;
|
||
//allList.push(it);
|
||
//二级
|
||
|
||
});
|
||
//let ids = res.result.list.map(item=>item.sysCreateAid);
|
||
const noReapetIds=[...new Set(ids)]
|
||
this.loadAuthorInfo(res2.result,noReapetIds);
|
||
//加载回复内容
|
||
item.replyList.push(...res2.result);
|
||
}
|
||
})
|
||
});
|
||
this.loadAuthorInfo(allList,ids);
|
||
this.total=res.result.count;
|
||
if(append){
|
||
res.result.list.forEach(item=>{
|
||
$this.list.push(item);
|
||
});
|
||
}else{
|
||
$this.list=res.result.list;
|
||
}
|
||
if($this.list.length == this.total) {
|
||
this.moreState = 3;
|
||
}
|
||
this.$emit('writeTotal',this.total);
|
||
}else{
|
||
this.$message.error(res.message);
|
||
}
|
||
});
|
||
},
|
||
showList(flag){
|
||
this.listShow=flag;
|
||
},
|
||
submit(){
|
||
if(this.inputValue.trim()!=''){
|
||
let cdata={
|
||
objType:this.objType,
|
||
objId:this.objId,
|
||
parentId:'-1',
|
||
content:this.inputValue.trim(),
|
||
clevel:1,
|
||
toAid:'',
|
||
toAname:'',
|
||
}
|
||
if(this.toUserDig.chooseUserId!=='' && this.toUserDig.chooseUserName!=''){
|
||
cdata.toAid=this.toUserDig.chooseUserId;
|
||
cdata.toAname=this.toUserDig.chooseUserName;
|
||
|
||
}
|
||
|
||
apiComment.add(cdata).then(res=>{
|
||
if(res.status==200){
|
||
// this.list.unshift(res.result);
|
||
// this.sex =
|
||
res.result.title = this.name;
|
||
res.result.sex=null;
|
||
res.result.isAll=false;
|
||
this.list.unshift(res.result);
|
||
this.loadAuthorInfo([res.result],[res.result.sysCreateAid]);
|
||
this.$message.success('发布成功');
|
||
//
|
||
|
||
this.total++;
|
||
this.$emit('success',res.result);
|
||
this.inputValue='';
|
||
this.toUserDig.chooseUserId='';
|
||
this.toUserDig.chooseUserName='';
|
||
}else{
|
||
this.$message.error(res.message);
|
||
}
|
||
});
|
||
|
||
}
|
||
|
||
},
|
||
showButtons(id){
|
||
if(!this.readonly){
|
||
this.btnsShowRowId=id;
|
||
}
|
||
},
|
||
hideButtons(){
|
||
this.btnsShowRowId='';
|
||
},
|
||
//展示全部
|
||
displayAll(item) {
|
||
let content = '';
|
||
content = item.content.replace(/(\n){2,}/,'<br>');
|
||
item.content = content;
|
||
var hlength = item.content.split("\n").length;
|
||
if(!item.isAll && hlength > 3 ) {return item.content.slice(0, 5) + "...";}
|
||
if(!item.isAll && item.content && item.content.length > 150) {
|
||
return item.content.slice(0, 150) + "...";
|
||
}
|
||
return item.content;
|
||
},
|
||
changeIsAll(item) {
|
||
item.isAll=!item.isAll;
|
||
},
|
||
showReply(item){
|
||
this.replyInfo.objType=this.objType;
|
||
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(){
|
||
this.replyInfo.parentId='';
|
||
},
|
||
submitReply(comment){
|
||
if(this.replyLoading) {
|
||
return
|
||
}
|
||
this.replyLoading = true;
|
||
this.replyInfo.content = this.replyInfo.content.trim();
|
||
if(this.replyInfo.content==''){
|
||
return;
|
||
}
|
||
this.replyInfo.content=this.replyInfo.content.replace(/^\s*|\s*$/g,"");
|
||
if(this.replyInfo.content==''){
|
||
return;
|
||
}
|
||
// this.replyInfo.commentId='1037320008252829696';
|
||
// if(comment.replyList==''){
|
||
// comment.replyList=[];
|
||
// }
|
||
this.replyInfo.parentId='-1';
|
||
|
||
apiComment.add(this.replyInfo).then(res=>{
|
||
this.replyLoading = false;
|
||
if(res.status==200){
|
||
res.result.sex = null;
|
||
res.result.isAll=false;
|
||
this.loadAuthorInfo([res.result],[res.result.sysCreateAid]);
|
||
comment.replyList.push(res.result);
|
||
this.replyInfo.parentId='';
|
||
this.replyInfo.content='';
|
||
this.$message.success("发布成功");
|
||
}else{
|
||
this.$message.error(res.message);
|
||
}
|
||
});
|
||
},
|
||
|
||
// 课程笔记评论的回复
|
||
submitReplyAdd(comment){
|
||
if(this.replyLoading) {
|
||
return
|
||
}
|
||
this.replyLoading = true;
|
||
this.replyInfo.content = this.replyInfo.content.trim();
|
||
if(this.replyInfo.content==''){
|
||
return;
|
||
}
|
||
this.replyInfo.content=this.replyInfo.content.replace(/^\s*|\s*$/g,"");
|
||
if(this.replyInfo.content==''){
|
||
return;
|
||
}
|
||
// this.replyInfo.commentId='1037320008252829696';
|
||
// if(comment.replyList==''){
|
||
// comment.replyList=[];
|
||
// }
|
||
|
||
this.replyInfo.commentId=comment.id;
|
||
if(comment.replyList=='' || comment.replyList==null){
|
||
//this.replyInfo.commentId='';
|
||
}else{
|
||
//this.replyInfo.commentId=comment.replyList[0].id;
|
||
this.replyInfo.clevel = 2;
|
||
}
|
||
|
||
|
||
apiComment.reply(this.replyInfo).then(res=>{
|
||
this.replyLoading = false;
|
||
if(res.status==200){
|
||
res.result.sex = null;
|
||
res.result.isAll=false;
|
||
this.loadAuthorInfo([res.result],[res.result.sysCreateAid]);
|
||
comment.replyList.push(res.result);
|
||
this.replyInfo.parentId='';
|
||
this.replyInfo.content='';
|
||
this.$message.success("发布成功");
|
||
}else{
|
||
this.$message.error(res.message);
|
||
}
|
||
});
|
||
},
|
||
|
||
delCommnet(com,idx){
|
||
if(com.replyList!='' && com.replyList.length>0){
|
||
this.$message.error('有回复的评论不能删除');
|
||
return;
|
||
}
|
||
this.$confirm('您确定要删除所选评论吗?', '删除提示', {
|
||
confirmButtonText: '确定',
|
||
cancelButtonText: '取消',
|
||
type: 'warning'
|
||
}).then(() => {
|
||
apiComment.del(com.id,this.userInfo.aid).then(res=>{
|
||
if(res.status==200){
|
||
this.list.splice(idx,1);
|
||
this.total--;
|
||
this.$message.success("删除成功");
|
||
this.$emit('delSuccess');
|
||
}else{
|
||
this.$message.error(res.message);
|
||
}
|
||
});
|
||
});
|
||
|
||
|
||
},
|
||
delReply(com,re,idx){
|
||
// if(com.replyList!='' && com.replyList.length>0){
|
||
// this.$message.error('有回复的评论不能删除');
|
||
// }
|
||
let params={
|
||
id:re.id,
|
||
user:this.userInfo.aid,
|
||
pid:re.parentId
|
||
}
|
||
this.$confirm('您确定要删除所选评论吗?', '删除提示', {
|
||
confirmButtonText: '确定',
|
||
cancelButtonText: '取消',
|
||
type: 'warning'
|
||
}).then(() => {
|
||
apiComment.delReply(params).then(res=>{
|
||
if(res.status==200){
|
||
com.replyList.splice(idx,1);
|
||
this.$message.success("删除成功");
|
||
}else{
|
||
this.$message.error(res.message);
|
||
}
|
||
});
|
||
})
|
||
},
|
||
delDlgReply(re,idx){ //弹出窗口中的删除操作
|
||
let params={
|
||
id:re.id,
|
||
user:this.userInfo.aid,
|
||
pid:re.parentId
|
||
}
|
||
let $this=this;
|
||
this.$confirm('您确定要删除所选评论吗?', '删除提示', {
|
||
confirmButtonText: '确定',
|
||
cancelButtonText: '取消',
|
||
type: 'warning'
|
||
}).then(() => {
|
||
apiComment.delReply(params).then(res=>{
|
||
if(res.status==200){
|
||
$this.replyDiaglog.list.splice(idx,1);
|
||
$this.$message.success("删除成功");
|
||
}else{
|
||
$this.$message.error(res.message);
|
||
}
|
||
}).catch(()=>{
|
||
|
||
})
|
||
})
|
||
},
|
||
showDlgReply(item){
|
||
this.replyInfo.objType=this.objType;
|
||
this.replyInfo.objId=this.objId;
|
||
this.replyInfo.parentId=item.id;
|
||
this.replyInfo.replyAid=item.sysCreateAid;
|
||
this.replyInfo.replyName=item.sysCreateBy;
|
||
this.replyShow=true;
|
||
},
|
||
submitDlgReply(){
|
||
this.replyInfo.content = this.replyInfo.content.trim();
|
||
if(this.replyInfo.content==''){
|
||
return;
|
||
}
|
||
this.replyInfo.content=this.replyInfo.content.replace(/^\s*|\s*$/g,"");
|
||
if(this.replyInfo.content==''){
|
||
return;
|
||
}
|
||
this.replyInfo.commentId=this.replyDiaglog.commentId;
|
||
|
||
apiComment.reply(this.replyInfo).then(res=>{
|
||
if(res.status==200){
|
||
res.result.sex = null;
|
||
res.result.isAll=false;
|
||
this.loadAuthorInfo([res.result],[res.result.sysCreateAid]);
|
||
this.replyDiaglog.list.push(res.result);
|
||
this.replyInfo.parentId='';
|
||
this.replyInfo.content='';
|
||
this.$message.success("发布成功");
|
||
}else{
|
||
this.$message.error(res.message);
|
||
}
|
||
});
|
||
},
|
||
showMoreReply(comment){
|
||
this.replyDiaglog.pages=1;
|
||
this.replyDiaglog.count=0;
|
||
this.replyDiaglog.pageIndex=1;
|
||
this.replyDiaglog.list=[];
|
||
this.replyDiaglog.show=true;
|
||
this.replyDiaglog.commentId=comment.id;
|
||
this.loadAllReplyData(false);
|
||
},
|
||
loadMoreReply(){
|
||
this.replyDiaglog.pageIndex++;
|
||
this.loadAllReplyData(true);
|
||
},
|
||
loadAllReplyData(append){
|
||
let params={
|
||
pageIndex:this.replyDiaglog.pageIndex,
|
||
pageSize:this.replyDiaglog.pageSize,
|
||
type:this.objType,
|
||
commentId:this.replyDiaglog.commentId
|
||
}
|
||
let $this=this;
|
||
apiComment.replyList(params).then(rs=>{
|
||
if(rs.status==200){
|
||
$this.replyDiaglog.count=rs.result.count;
|
||
$this.replyDiaglog.pages=rs.result.totalPages;
|
||
let ids=[];
|
||
if(append){
|
||
rs.result.list.forEach(item=>{
|
||
item.avatar='';
|
||
ids.push(item.sysCreateAid);
|
||
$this.replyDiaglog.list.push(item);
|
||
})
|
||
}else{
|
||
rs.result.list.forEach(item=>{
|
||
item.avatar='';
|
||
ids.push(item.sysCreateAid);
|
||
})
|
||
$this.replyDiaglog.list=rs.result.list;
|
||
}
|
||
this.loadAuthorInfo(rs.result.list,ids);
|
||
}else{
|
||
this.$message.error(rs.message);
|
||
}
|
||
})
|
||
},
|
||
showToUser(){
|
||
this.toUserDig.show=true;
|
||
this.toUserDig.chooseUserId='';
|
||
this.toUserDig.chooseUserName='';
|
||
},
|
||
findUserKeyupEnter(){
|
||
this.findUser();
|
||
},
|
||
findUser(){
|
||
this.toUserDig.list=[];
|
||
var name=this.toUserDig.name;
|
||
if(name==''){
|
||
return;
|
||
}
|
||
apiUser.findByName(name).then(rs=>{
|
||
if(rs.status==200){
|
||
this.toUserDig.list=rs.result;
|
||
}else{
|
||
this.$message.error('查询用户失败');
|
||
}
|
||
})
|
||
|
||
},
|
||
confirmUser(u){
|
||
this.toUserDig.chooseUserId=u.aid;
|
||
this.toUserDig.chooseUserName=u.name;
|
||
this.toUserDig.show=false;
|
||
this.toUserDig.name='';
|
||
}
|
||
}
|
||
}
|
||
</script>
|
||
|
||
<style lang="scss" scoped>
|
||
.anzhu{
|
||
font-size: 14px;
|
||
color: #999;
|
||
}
|
||
::v-deep .el-input--medium .el-input__inner {
|
||
height: 48px;
|
||
}
|
||
|
||
::v-deep .at-min{
|
||
.el-popper[x-placement^=bottom] {
|
||
// left: 0 !important;
|
||
// bottom: 0 !important;
|
||
margin-left: 30px !important;
|
||
}
|
||
.el-popover{
|
||
|
||
}
|
||
}
|
||
.tag-block{
|
||
top:0;
|
||
left: 0;
|
||
position: absolute;
|
||
background-color: #fff;
|
||
border-color: #fff;
|
||
|
||
height: 1px;
|
||
}
|
||
.pag-text{
|
||
border: 1px solid #292828;
|
||
padding: 10px 20px;
|
||
border-radius: 20px;
|
||
background: #fff;
|
||
cursor: pointer;
|
||
}
|
||
.reference-tag{
|
||
display: block;
|
||
// width: 100%;
|
||
.el-radio-button__inner{
|
||
border: 1px solid #fff !important;
|
||
}
|
||
|
||
}
|
||
.svg-btn{
|
||
font-size: 30px;
|
||
line-height: 30px;
|
||
margin-right: 20px;
|
||
cursor: pointer;
|
||
margin-top: 5px;
|
||
}
|
||
.comments{
|
||
margin-top: 10px;
|
||
background-color: #FFFFFF;
|
||
padding: 26px 15px;
|
||
.comment-time{
|
||
display: flex;
|
||
padding-left: 12px;
|
||
justify-content: space-between;
|
||
margin-top: 10px;
|
||
color: #666666;
|
||
font-size: 12px;
|
||
}
|
||
.comments-top{
|
||
display: flex;
|
||
justify-content: space-between;
|
||
padding:10px;
|
||
// border-bottom: 1px solid #f4f4f4;
|
||
font-weight: 500;
|
||
font-size: 1.1em;
|
||
.comments-top-left{
|
||
.btn{
|
||
// width: 68px;
|
||
// height: 32px;
|
||
// background: #3C7EFF;
|
||
border-radius: 6px;
|
||
font-size: 12px;
|
||
padding: 10px;
|
||
margin-left: 24px;
|
||
::v-deep .el-radio__inner{
|
||
border-radius: 0 !important;
|
||
}
|
||
}
|
||
}
|
||
.comments-top-center{
|
||
|
||
}
|
||
.comments-top-right{
|
||
color: #6b6b6b;
|
||
cursor: pointer;
|
||
}
|
||
}
|
||
.comments-input{
|
||
padding: 20px 15px 10px 15px;
|
||
}
|
||
.comments-items{
|
||
padding: 5px 15px;
|
||
.zan-wu{
|
||
text-align: center;
|
||
font-size: 18px;
|
||
color: #6666;
|
||
}
|
||
}
|
||
}
|
||
.comment{
|
||
margin-top: 20px;
|
||
background-color: #FFFFFF;
|
||
margin-bottom: 30px;
|
||
// border-bottom: 1px solid #dddddd;
|
||
.comment-top{
|
||
display: flex;
|
||
justify-content: space-between;
|
||
padding-bottom:10px;
|
||
font-weight: 500;
|
||
line-height: 30px;
|
||
font-size: 1.1em;
|
||
.comment-author{
|
||
display: flex;
|
||
align-items: center;
|
||
height: 30px;
|
||
line-height: 30px;
|
||
}
|
||
}
|
||
.comment-body{
|
||
letter-spacing:1px;
|
||
padding-left: 40px;
|
||
.comment-content{
|
||
padding-bottom: 0px;
|
||
white-space: pre-wrap;
|
||
word-break:break-all;
|
||
padding-left:14px;
|
||
.play-time{
|
||
display: inline-block;
|
||
padding: 2px 8px;
|
||
border-radius: 8px;
|
||
border: 1px solid #3379fb;
|
||
margin-right: 5px;
|
||
img{
|
||
vertical-align: top;
|
||
margin-top: 2px;
|
||
}
|
||
}
|
||
span {
|
||
color: #409eff;
|
||
cursor: pointer;
|
||
// margin-left: 5px;
|
||
}
|
||
}
|
||
.comment-btns{
|
||
// padding: 5px 10px 10px 0px;
|
||
height: 35px;
|
||
line-height: 35px;
|
||
a{
|
||
margin-right:15px;
|
||
span{
|
||
margin-left: 6px;
|
||
color: #8590A6;
|
||
font-size: 14px;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
.comment-replys{
|
||
padding-left: 40px;
|
||
margin-top: 20px;
|
||
}
|
||
}
|
||
.comment-last{
|
||
border-bottom: none;
|
||
}
|
||
::v-deep .hideControl{
|
||
.el-input__count{
|
||
}
|
||
.el-textarea__inner{
|
||
padding-right: 50px;
|
||
}
|
||
}
|
||
</style>
|