优化评价页面
This commit is contained in:
parent
a38ced69a7
commit
c7cf0a33e7
|
@ -67,6 +67,9 @@
|
|||
:cate="appraise.cate"
|
||||
@changeCate="changeAppraiseCate"
|
||||
/>
|
||||
<view class="loadmore-box">
|
||||
<app-load-more :hasMore="currentAppraiseCate.more" @loadmore="loadAppraiseData" />
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
@ -76,6 +79,7 @@
|
|||
<script>
|
||||
import AppLayout from "@/components/layout/layout";
|
||||
import AppAppraiseSection from "@/components/appraise/section";
|
||||
import AppLoadMore from "@/components/widgets/loadmore";
|
||||
export default {
|
||||
name: "service-detail",
|
||||
data() {
|
||||
|
@ -93,7 +97,7 @@ export default {
|
|||
content: "",
|
||||
price: 0,
|
||||
},
|
||||
currentAppraiseCateIndex: 0,
|
||||
currentAppraiseCate: {},
|
||||
appraise: {
|
||||
total: 0,
|
||||
tags: [],
|
||||
|
@ -104,6 +108,7 @@ export default {
|
|||
components: {
|
||||
AppLayout,
|
||||
AppAppraiseSection,
|
||||
AppLoadMore,
|
||||
},
|
||||
async onLoad(e) {
|
||||
this.pageConfig = getApp().globalData.pageConfig;
|
||||
|
@ -152,10 +157,7 @@ export default {
|
|||
onReady() {},
|
||||
onReachBottom() {
|
||||
if (this.tabIndex == 0) return;
|
||||
let currentCate = this.appraise.cate[this.currentAppraiseCateIndex];
|
||||
if (currentCate.more) {
|
||||
this.loadAppraiseData(currentCate);
|
||||
}
|
||||
this.loadAppraiseData();
|
||||
},
|
||||
onPullDownRefresh() {},
|
||||
methods: {
|
||||
|
@ -203,29 +205,30 @@ export default {
|
|||
/**
|
||||
* 切换评价分类
|
||||
*/
|
||||
changeAppraiseCate(currentCate, index) {
|
||||
this.currentAppraiseCateIndex = index;
|
||||
currentCate.list = [];
|
||||
currentCate.more = true;
|
||||
currentCate.page = 1;
|
||||
this.loadAppraiseData(currentCate);
|
||||
changeAppraiseCate(currentAppraiseCate, index) {
|
||||
currentAppraiseCate.list = [];
|
||||
currentAppraiseCate.more = true;
|
||||
currentAppraiseCate.page = 1;
|
||||
this.currentAppraiseCate = currentAppraiseCate;
|
||||
this.loadAppraiseData();
|
||||
},
|
||||
/**
|
||||
* 加载评价数据
|
||||
*/
|
||||
loadAppraiseData(currentCate) {
|
||||
loadAppraiseData() {
|
||||
if (!this.currentAppraiseCate.more) return;
|
||||
this.$models.appraise.list
|
||||
.service({
|
||||
id: this.id,
|
||||
status: currentCate.status,
|
||||
page: currentCate.page,
|
||||
status: this.currentAppraiseCate.status,
|
||||
page: this.currentAppraiseCate.page,
|
||||
})
|
||||
.then((list) => {
|
||||
if (list.length > 0) {
|
||||
currentCate.page++;
|
||||
currentCate.list = currentCate.list.concat(list);
|
||||
this.currentAppraiseCate.page++;
|
||||
this.currentAppraiseCate.list = this.currentAppraiseCate.list.concat(list);
|
||||
} else {
|
||||
currentCate.more = false;
|
||||
this.currentAppraiseCate.more = false;
|
||||
}
|
||||
});
|
||||
},
|
||||
|
@ -385,5 +388,8 @@ export default {
|
|||
.reviews {
|
||||
width: 100%;
|
||||
height: auto;
|
||||
.loadmore-box {
|
||||
padding: 40rpx 0;
|
||||
}
|
||||
}
|
||||
</style>
|
|
@ -35,6 +35,9 @@
|
|||
:cate="appraise.cate"
|
||||
@changeCate="changeAppraiseCate"
|
||||
/>
|
||||
<view class="loadmore-box">
|
||||
<app-load-more :hasMore="currentAppraiseCate.more" @loadmore="loadAppraiseData" />
|
||||
</view>
|
||||
</view>
|
||||
</app-layout>
|
||||
</template>
|
||||
|
@ -42,6 +45,7 @@
|
|||
<script>
|
||||
import AppLayout from "@/components/layout/layout";
|
||||
import AppAppraiseSection from "@/components/appraise/section";
|
||||
import AppLoadMore from "@/components/widgets/loadmore";
|
||||
export default {
|
||||
name: "worker-detail",
|
||||
data() {
|
||||
|
@ -61,7 +65,7 @@ export default {
|
|||
avatar: "",
|
||||
},
|
||||
},
|
||||
currentAppraiseCateIndex: 0,
|
||||
currentAppraiseCate: {},
|
||||
appraise: {
|
||||
total: 0,
|
||||
tags: [],
|
||||
|
@ -72,6 +76,7 @@ export default {
|
|||
components: {
|
||||
AppLayout,
|
||||
AppAppraiseSection,
|
||||
AppLoadMore,
|
||||
},
|
||||
async onLoad(e) {
|
||||
if (!e.id) {
|
||||
|
@ -110,39 +115,37 @@ export default {
|
|||
onShow() {},
|
||||
onReady() {},
|
||||
onReachBottom() {
|
||||
let currentCate = this.appraise.cate[this.currentAppraiseCateIndex];
|
||||
if (currentCate.more) {
|
||||
this.loadAppraiseData(currentCate);
|
||||
}
|
||||
this.loadAppraiseData();
|
||||
},
|
||||
onPullDownRefresh() {},
|
||||
methods: {
|
||||
/**
|
||||
* 切换评价分类
|
||||
*/
|
||||
changeAppraiseCate(currentCate, index) {
|
||||
this.currentAppraiseCateIndex = index;
|
||||
currentCate.list = [];
|
||||
currentCate.more = true;
|
||||
currentCate.page = 1;
|
||||
this.loadAppraiseData(currentCate);
|
||||
changeAppraiseCate(currentAppraiseCate, index) {
|
||||
currentAppraiseCate.list = [];
|
||||
currentAppraiseCate.more = true;
|
||||
currentAppraiseCate.page = 1;
|
||||
this.currentAppraiseCate = currentAppraiseCate;
|
||||
this.loadAppraiseData();
|
||||
},
|
||||
/**
|
||||
* 加载评价数据
|
||||
*/
|
||||
loadAppraiseData(currentCate) {
|
||||
loadAppraiseData() {
|
||||
if (!this.currentAppraiseCate.more) return;
|
||||
this.$models.appraise.list
|
||||
.worker({
|
||||
id: this.id,
|
||||
status: currentCate.status,
|
||||
page: currentCate.page,
|
||||
status: this.currentAppraiseCate.status,
|
||||
page: this.currentAppraiseCate.page,
|
||||
})
|
||||
.then((list) => {
|
||||
if (list.length > 0) {
|
||||
currentCate.page++;
|
||||
currentCate.list = currentCate.list.concat(list);
|
||||
this.currentAppraiseCate.page++;
|
||||
this.currentAppraiseCate.list = this.currentAppraiseCate.list.concat(list);
|
||||
} else {
|
||||
currentCate.more = false;
|
||||
this.currentAppraiseCate.more = false;
|
||||
}
|
||||
});
|
||||
},
|
||||
|
@ -205,4 +208,10 @@ export default {
|
|||
color: #999999;
|
||||
}
|
||||
}
|
||||
.appraise-body {
|
||||
width: 100%;
|
||||
.loadmore-box {
|
||||
padding: 40rpx 0;
|
||||
}
|
||||
}
|
||||
</style>
|
Loading…
Reference in New Issue