Merge branch 'feature/comment-0624-ch' into msb_test

fix/comment-0701
ch 2 years ago
commit 33f83236a7

@ -2,7 +2,7 @@
* @Author: ch * @Author: ch
* @Date: 2022-06-23 10:40:04 * @Date: 2022-06-23 10:40:04
* @LastEditors: ch * @LastEditors: ch
* @LastEditTime: 2022-06-30 21:30:31 * @LastEditTime: 2022-06-30 22:11:19
* @Description: file content * @Description: file content
--> -->
<template> <template>
@ -33,7 +33,6 @@ export default {
const day = Math.floor((followTime - commentTime) / (24 * 60 * 60 * 1000)); const day = Math.floor((followTime - commentTime) / (24 * 60 * 60 * 1000));
return day > 0 ? `${day}天后` : `当天`; return day > 0 ? `${day}天后` : `当天`;
}, },
imgs (){ imgs (){
let urls = this.followComment.pictureUrl || ''; let urls = this.followComment.pictureUrl || '';
return urls ? urls.split(',') : []; return urls ? urls.split(',') : [];

@ -2,7 +2,7 @@
* @Author: ch * @Author: ch
* @Date: 2022-06-24 14:39:38 * @Date: 2022-06-24 14:39:38
* @LastEditors: ch * @LastEditors: ch
* @LastEditTime: 2022-06-30 20:59:26 * @LastEditTime: 2022-06-30 22:37:34
* @Description: file content * @Description: file content
--> -->
<template> <template>
@ -20,29 +20,32 @@
</div> </div>
</div> </div>
<div class="ctx"> <div class="ctx">
<UiEmpty v-if="!list.length" :icon="require('@/assets/img/comment/empty.png')" desc="暂时没有评论"/>
<template v-else>
<div class="ctx--top"> <div class="ctx--top">
<div class="ctx--top-rate" v-if="productRate"> <div class="ctx--top-rate" v-if="productRate">
<b>商品满意度</b> <b>商品满意度</b>
<p>{{productRate}}</p> <p>{{productRate}}</p>
<el-rate :value="productRate" disabled size="16px"></el-rate> <el-rate :value="productRate" disabled size="16px"></el-rate>
</div> </div>
<div class="ctx--top-tabs" v-if="tabs.length > 1"> <div class="ctx--top-tabs" v-if="tabs.length > 1">
<span v-for="i in tabs" :key="i.labelType" @click="handleTabChanage(i)" <span v-for="i in tabs" :key="i.labelType" @click="handleTabChanage(i)"
:class="{'active':i.labelType == tabActive}"> :class="{'active':i.labelType == tabActive}">
{{i.labelName}}({{i.commentCount}}) {{i.labelName}}({{i.commentCount}})
</span> </span>
</div>
</div> </div>
</div>
<UiEmpty v-if="!list.length && loading=='finish'" :icon="require('@/assets/img/comment/empty.png')" desc="暂时没有评论"/>
<template v-else>
<BsCommentInfo v-for="item in list" :key="item.id" :commentDetail="item" source="detail"/> <BsCommentInfo v-for="item in list" :key="item.id" :commentDetail="item" source="detail"/>
</template> </template>
<div v-if="loading === 'loading'" class="loading">....</div>
<div v-if="loading === 'finish'" class="more" @click="next">></div>
</div> </div>
<el-pagination class="pagination flex flex-right" layout="prev, pager, next" <!-- <el-pagination class="pagination flex flex-right" layout="prev, pager, next"
@current-change="handleCurrentChange" :current-page.sync="pageIndex" @current-change="handleCurrentChange" :current-page.sync="pageIndex"
:page-size="pageSize" :total="total"></el-pagination> :page-size="pageSize" :total="total"></el-pagination> -->
</div> </div>
</template> </template>
<script> <script>
@ -87,7 +90,7 @@ export default {
], ],
pageSize : 10, pageSize : 10,
list : [], list : [],
loading : false loading : 'finish'
} }
}, },
mounted(){ mounted(){
@ -98,7 +101,10 @@ export default {
}, },
methods:{ methods:{
async getList(){ async getList(){
this.loading = true; if(this.loading === 'loading'){
return false;
}
this.loading = 'loading';
const {error, result} = await ApiGetCommentList({ const {error, result} = await ApiGetCommentList({
pageIndex : this.pageIndex, pageIndex : this.pageIndex,
length : this.pageSize, length : this.pageSize,
@ -107,12 +113,22 @@ export default {
sortType : this.sortActive.val, sortType : this.sortActive.val,
isContent : this.isContent || null isContent : this.isContent || null
}); });
this.loading = false this.loading = 'finish';
if(error){ if(error){
return false; return false;
} }
this.list = result.records; this.list = this.list.concat(result.records);
this.total = result.total if(result.records.length == 0 && this.pageIndex < result.pages){
this.next();
}
if(this.pageIndex === result.pages){
this.loading = 'nomore'
}
// this.total = result.total
},
next(){
this.pageIndex++;
this.getList();
}, },
async getTabCount (){ async getTabCount (){
const {error, result} = await ApiGetCommentTabCount({ const {error, result} = await ApiGetCommentTabCount({
@ -121,7 +137,6 @@ export default {
if(error){ if(error){
return false; return false;
} }
// this.list = result.records;
this.tabs = this.tabs.concat(result.filter(i => i.commentCount > 0)); this.tabs = this.tabs.concat(result.filter(i => i.commentCount > 0));
}, },
@ -153,15 +168,19 @@ export default {
return false return false
} }
this.tabActive = i.labelType; this.tabActive = i.labelType;
this.pageIndex = 1;
this.list = [];
this.getList(); this.getList();
}, },
handleCommand(val){ handleCommand(val){
this.sortActive = val; this.sortActive = val;
this.pageIndex = 1; this.pageIndex = 1;
this.list = [];
this.getList(); this.getList();
}, },
handledContent(){ handledContent(){
this.pageIndex = 1; this.pageIndex = 1;
this.list = [];
this.getList(); this.getList();
} }
@ -195,6 +214,7 @@ export default {
border: 1px solid #f2f2f2; border: 1px solid #f2f2f2;
border-top: 0; border-top: 0;
overflow: hidden; overflow: hidden;
margin-bottom: 40px;
&--top{ &--top{
display: flex; display: flex;
&-rate{ &-rate{
@ -256,6 +276,14 @@ export default {
} }
} }
} }
.loading,.more{
color: #999;
text-align: center;
margin-bottom: 40px;
}
.more{
cursor: pointer;
}
.pagination { .pagination {
margin: 50px 0; margin: 50px 0;

Loading…
Cancel
Save