109 lines
3.1 KiB
Vue
109 lines
3.1 KiB
Vue
<template>
|
|
<app-layout title="我的评价">
|
|
<view class="appraise-container">
|
|
<app-appraise-section
|
|
:total="appraise.total"
|
|
:tags="appraise.tags"
|
|
:cate="appraise.cate"
|
|
@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 {
|
|
currentCate: {},
|
|
appraise: {
|
|
total: 0,
|
|
tags: [],
|
|
cate: [],
|
|
},
|
|
};
|
|
},
|
|
components: {
|
|
AppLayout,
|
|
AppAppraiseSection,
|
|
AppLoadMore,
|
|
},
|
|
async onLoad() {
|
|
// 评价
|
|
await this.$models.user.appraise.count().then((data) => {
|
|
data.tags.forEach((item) => {
|
|
this.appraise.tags.push({
|
|
count: item.count,
|
|
name: item.name,
|
|
});
|
|
});
|
|
data.cate.forEach((item) => {
|
|
this.appraise.cate.push({
|
|
name: item.name,
|
|
count: item.count,
|
|
status: item.status,
|
|
page: 1,
|
|
more: true,
|
|
list: [],
|
|
});
|
|
});
|
|
this.appraise.total = this.appraise.cate[0].count;
|
|
this.changeAppraiseCate(this.appraise.cate[0], 0);
|
|
});
|
|
},
|
|
onShow() {},
|
|
onReady() {},
|
|
onHide() {},
|
|
onReachBottom() {
|
|
this.loadAppraiseData();
|
|
},
|
|
onPullDownRefresh() {},
|
|
methods: {
|
|
/**
|
|
* 切换评价分类
|
|
*/
|
|
changeAppraiseCate(currentCate) {
|
|
currentCate.more = true;
|
|
currentCate.page = 1;
|
|
this.currentCate = currentCate;
|
|
this.loadAppraiseData();
|
|
},
|
|
/**
|
|
* 加载评价数据
|
|
*/
|
|
loadAppraiseData() {
|
|
if (!this.currentCate.more) return;
|
|
this.$models.user.appraise
|
|
.list({
|
|
status: this.currentCate.status,
|
|
page: this.currentCate.page,
|
|
})
|
|
.then((list) => {
|
|
if (list.length > 0) {
|
|
if (this.currentCate.page == 1) {
|
|
this.currentCate.list = list;
|
|
} else {
|
|
this.currentCate.list = this.currentCate.list.concat(list);
|
|
}
|
|
this.currentCate.page++;
|
|
} else {
|
|
this.currentCate.more = false;
|
|
}
|
|
});
|
|
},
|
|
},
|
|
};
|
|
</script>
|
|
|
|
<style lang="less" scoped>
|
|
.loadmore-box {
|
|
padding: 40rpx 0;
|
|
}
|
|
</style> |