|
@@ -109,12 +109,34 @@ const getMyCommnet=async ()=>{
|
|
|
})
|
|
|
if(res.code===200){
|
|
|
myCommentList.value=res.data.list||[]
|
|
|
- if(route.query.frompage==='message'){
|
|
|
- await nextTick()
|
|
|
- const h=$('.comment-list-wrap').offset().top
|
|
|
- console.log(h);
|
|
|
- $('body,html').animate({scrollTop:h}, 300, 'swing');
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+//获取精选留言
|
|
|
+let hotCommentList=reactive({
|
|
|
+ list:[],
|
|
|
+ page:1,
|
|
|
+ pageSize:20,
|
|
|
+ finished:false,
|
|
|
+ loading:false
|
|
|
+})
|
|
|
+const getHotCommentList=async ()=>{
|
|
|
+ hotCommentList.loading=true
|
|
|
+ const res=await apiReportHotCommentList({
|
|
|
+ report_id:Number(props.data.report_id),
|
|
|
+ report_chapter_id:Number(props.data.report_chapter_id),
|
|
|
+ old_report_id:Number(props.data.old_report_id),
|
|
|
+ old_report_chapter_id:Number(props.data.old_report_chapter_id),
|
|
|
+ current_index:hotCommentList.page,
|
|
|
+ page_size:hotCommentList.pageSize
|
|
|
+ })
|
|
|
+ hotCommentList.loading=false
|
|
|
+ if(res.code===200){
|
|
|
+ if(res.data.paging.is_end){
|
|
|
+ hotCommentList.finished=true
|
|
|
}
|
|
|
+ const arr=res.data.list||[]
|
|
|
+ hotCommentList.list=[...hotCommentList.list,...arr]
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -137,7 +159,7 @@ const handleDelMyComment=(item)=>{
|
|
|
}).then(res=>{
|
|
|
if(res.code===200){
|
|
|
ElMessage.success('删除成功')
|
|
|
- getMyCommnet()
|
|
|
+ formatCommentList(item.comment_id)
|
|
|
}
|
|
|
})
|
|
|
}).catch(()=>{
|
|
@@ -145,31 +167,20 @@ const handleDelMyComment=(item)=>{
|
|
|
})
|
|
|
}
|
|
|
|
|
|
-//获取精选留言
|
|
|
-let hotCommentList=reactive({
|
|
|
- list:[],
|
|
|
- page:1,
|
|
|
- pageSize:20,
|
|
|
- finished:false,
|
|
|
- loading:false
|
|
|
-})
|
|
|
-const getHotCommentList=async ()=>{
|
|
|
- hotCommentList.loading=true
|
|
|
- const res=await apiReportHotCommentList({
|
|
|
- report_id:Number(props.data.report_id),
|
|
|
- report_chapter_id:Number(props.data.report_chapter_id),
|
|
|
- old_report_id:Number(props.data.old_report_id),
|
|
|
- old_report_chapter_id:Number(props.data.old_report_chapter_id),
|
|
|
- current_index:hotCommentList.page,
|
|
|
- page_size:hotCommentList.pageSize
|
|
|
- })
|
|
|
- hotCommentList.loading=false
|
|
|
- if(res.code===200){
|
|
|
- if(res.data.paging.is_end){
|
|
|
- hotCommentList.finished=true
|
|
|
- }
|
|
|
- const arr=res.data.list||[]
|
|
|
- hotCommentList.list=[...hotCommentList.list,...arr]
|
|
|
+//删除留言后 更新我的留言和精选留言数据
|
|
|
+const formatCommentList=(id)=>{
|
|
|
+ // 我的留言列表
|
|
|
+ if(myCommentList.value.length>0){
|
|
|
+ myCommentList.value=myCommentList.value.filter(item=>{
|
|
|
+ return item.comment_id!=id
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ // 精选留言
|
|
|
+ if(hotCommentList.list.length>0){
|
|
|
+ hotCommentList.list=hotCommentList.list.filter(item=>{
|
|
|
+ return item.comment_id!=id
|
|
|
+ })
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -256,7 +267,7 @@ onMounted(() => {
|
|
|
<template v-if="hotCommentList.list.length>0">
|
|
|
<ul class="comment-list-box hot-comment-box">
|
|
|
<p class="label">精选留言</p>
|
|
|
- <li class="flex comment-item" v-for="item in hotCommentList.list" :key="item.comment_id">
|
|
|
+ <li class="flex comment-item" v-for="(item,index) in hotCommentList.list" :key="item.comment_id">
|
|
|
<el-image
|
|
|
class="avatar"
|
|
|
style="width: 46px; height: 46px"
|
|
@@ -264,6 +275,9 @@ onMounted(() => {
|
|
|
fit="cover"
|
|
|
/>
|
|
|
<div class="comment-con">
|
|
|
+ <div class="right-box" v-if="item.user_id==$store.state.userInfo.user_id">
|
|
|
+ <span class="del-btn2" @click="handleDelMyComment(item,index)">删除</span>
|
|
|
+ </div>
|
|
|
<div :class="['user-name',item.IsTop==1&&'is-top']">{{item.user_name}}</div>
|
|
|
<div class="commment-msg">{{item.content}}</div>
|
|
|
<ul>
|
|
@@ -422,7 +436,7 @@ onMounted(() => {
|
|
|
color: #999;
|
|
|
}
|
|
|
}
|
|
|
- .del-btn{
|
|
|
+ .del-btn,.del-btn2{
|
|
|
display: none;
|
|
|
cursor: pointer;
|
|
|
color: #F3A52F;
|
|
@@ -435,6 +449,9 @@ onMounted(() => {
|
|
|
margin-right: 5px;
|
|
|
}
|
|
|
}
|
|
|
+ &:hover .del-btn2{
|
|
|
+ display: inline-block;
|
|
|
+ }
|
|
|
.user-name{
|
|
|
font-size: 18px;
|
|
|
color: #999;
|