海信交通一体化小程序
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.

92 lines
2.1 KiB

<template>
<view>
<view class="text" v-for="(item,index) in data" :key="index">
<view>
<view>{{item.organizationName}}</view>
<view>{{item.statDate}}{{item.statPeriod}}</view>
</view>
</view>
<uni-load-more iconType="circle" :status="status" @clickLoadMore="loadMore" :contentText="contentText"></uni-load-more>
</view>
</template>
<script>
export default {
data() {
return {
data: [],
current: 0,
size: 10,
hasMore: true,
status: '',
query: {
statDateStart: '',
statDateEnd: '',
statPeriod: ''
},
contentText: {
contentdown: "点击查看更多",
contentrefresh: "正在加载...",
contentnomore: "没有更多数据了",
},
}
},
onLoad() {
this.loadMore();
},
onUnload() {
this.hasMore = true;
this.data = [];
},
onPullDownRefresh() {
console.log('onPullDownRefresh');
this.data = [];
this.current = 0;
this.hasMore = true;
this.loadMore();
},
methods: {
loadMore() {
if (this.hasMore) {
this.current = this.current + 1;
this.status = 'loading';
let params = '';
Object.keys(this.query).map(key => {
params = params + '&' + key + '=' + this.query[key]
})
this.$request(getApp().globalData.baseUrl + '/api/biz/highwayParentDataController/list?page=' + this.current +
'&pageSize=' + this.size + '&_t=' + Date.parse(new Date()) + params, {}, 'GET').then(res => {
if (res.code == 200) {
this.data = this.data.concat(res.data.list);
if (res.data.list.length == 0 || res.data.totalCount < this.size) {
this.hasMore = false;
this.status = 'nomore';
} else {
this.status = 'more';
}
uni.stopPullDownRefresh();
} else {
this.status = 'more';
uni.stopPullDownRefresh();
}
}).catch(() => {
this.status = 'more';
uni.stopPullDownRefresh();
})
}
},
}
}
</script>
<style lang="scss" scoped>
.text {
margin: 16rpx 0;
width: 100%;
background-color: #fff;
height: 120rpx;
line-height: 120rpx;
text-align: center;
color: #555;
border-radius: 8rpx;
}
</style>