You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
70 lines
1.5 KiB
70 lines
1.5 KiB
<template>
|
|
<view class="main">
|
|
<comments :list="list" @changeNav="changeNav"></comments>
|
|
<view style="padding-bottom: 20rpx;" v-if="list.length">
|
|
<u-loadmore :status="status" />
|
|
</view>
|
|
<nodata v-if="!list.length&&status=='nomore'"></nodata>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import comments from '../comments/comments.vue'
|
|
import { getSchoolListComment } from '@/config/api.js'
|
|
export default {
|
|
components: { comments },
|
|
data() {
|
|
return {
|
|
params: {
|
|
pageNo: 1,
|
|
pageSize: 20,
|
|
schoolId: '',
|
|
condition: 0
|
|
},
|
|
total: 20,
|
|
list: [],
|
|
status: 'loading'
|
|
}
|
|
},
|
|
onLoad(options) {
|
|
this.params.schoolId = options.id
|
|
this.getSchoolListCommentFn()
|
|
},
|
|
onPullDownRefresh() {
|
|
this.getSchoolListCommentFn().then(()=>{
|
|
uni.stopPullDownRefresh()
|
|
})
|
|
},
|
|
onReachBottom() {
|
|
if(this.list.length<this.total) this.getSchoolListCommentFn()
|
|
},
|
|
methods: {
|
|
changeNav(val) {
|
|
this.params.condition = val
|
|
this.initList()
|
|
},
|
|
initList() {
|
|
this.params.pageNo = 1
|
|
this.status = 'loading'
|
|
this.list = []
|
|
this.getSchoolListCommentFn()
|
|
},
|
|
async getSchoolListCommentFn() {
|
|
const {data: res} = await getSchoolListComment(this.params)
|
|
this.params.pageNo ++
|
|
let arr = res.list.map(item=>{
|
|
if(item.images) {
|
|
item.images = item.images.split(',')
|
|
}
|
|
return item
|
|
})
|
|
this.list.push(...arr)
|
|
this.total = res.total
|
|
if(this.list.length>=this.total) this.status = 'nomore'
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style>
|
|
</style>
|