优化评价页面

This commit is contained in:
TOP糯米 2023-03-29 23:25:56 +08:00
parent 617ef9d3c2
commit 2cadcf1be5
1 changed files with 22 additions and 15 deletions

View File

@ -8,17 +8,21 @@
@changeCate="changeAppraiseCate"
/>
</view>
<view class="loadmore-box">
<app-load-more :hasMore="currentCate.more" @loadmore="loadAppraiseData" />
</view>
</app-layout>
</template>
<script>
import AppLayout from "@/components/layout/layout";
import AppAppraiseSection from "@/components/appraise/section";
import AppLoadMore from "@/components/widgets/loadmore";
export default {
name: "member-appraise",
data() {
return {
currentAppraiseCateIndex: 0,
currentCate: {},
appraise: {
total: 0,
tags: [],
@ -29,6 +33,7 @@ export default {
components: {
AppLayout,
AppAppraiseSection,
AppLoadMore,
},
async onLoad() {
//
@ -57,38 +62,36 @@ export default {
onReady() {},
onHide() {},
onReachBottom() {
let currentCate = this.appraise.cate[this.currentAppraiseCateIndex];
if (currentCate.more) {
this.loadAppraiseData(currentCate);
}
this.loadAppraiseData();
},
onPullDownRefresh() {},
methods: {
/**
* 切换评价分类
*/
changeAppraiseCate(currentCate, index) {
this.currentAppraiseCateIndex = index;
changeAppraiseCate(currentCate) {
currentCate.list = [];
currentCate.more = true;
currentCate.page = 1;
this.loadAppraiseData(currentCate);
this.currentCate = currentCate;
this.loadAppraiseData();
},
/**
* 加载评价数据
*/
loadAppraiseData(currentCate) {
loadAppraiseData() {
if (!this.currentCate.more) return;
this.$models.user.appraise
.list({
status: currentCate.status,
page: currentCate.page,
status: this.currentCate.status,
page: this.currentCate.page,
})
.then((list) => {
if (list.length > 0) {
currentCate.page++;
currentCate.list = currentCate.list.concat(list);
this.currentCate.page++;
this.currentCate.list = this.currentCate.list.concat(list);
} else {
currentCate.more = false;
this.currentCate.more = false;
}
});
},
@ -96,4 +99,8 @@ export default {
};
</script>
<style lang="less" scoped></style>
<style lang="less" scoped>
.loadmore-box {
padding: 40rpx 0;
}
</style>