Commit 73a4d1be authored by liwei's avatar liwei

增加了公告列表的分页

parent d7aed10a
......@@ -68,7 +68,8 @@ export default {
const query = {
page:pageNo,
rows:pageSize,
publishStatus:'1'
publishStatus:'1',
flag:'1'
}
activityList(query).then(res =>{
this.activityList = res.data.data
......
......@@ -141,7 +141,8 @@
getBannerList() {
const query = {
page: this.queryParam.page,
rows: this.queryParam.rows
rows: this.queryParam.rows,
flag:'1'
}
bannerList(query).then(res =>{
let imgList = []
......@@ -163,7 +164,8 @@
getNoticeList() {
const query = {
page: this.queryParam.page,
rows: this.queryParam.rows
rows: this.queryParam.rows,
flag:'1'
}
noticeList(query).then(res =>{
this.notice = res.data.data[0]
......
<template>
<view class="announcement">
<view class="card" v-for="item in noticeList" @click="gotopage(item)">
<z-paging ref="paging" v-model="dataList" @query="queryList" :fixed="true" :auto-show-back-to-top="true" :back-to-top-with-animate="false">
<view class="card" v-for="item in dataList" @click="gotopage(item)">
<view class="toptitle">{{item.title}}</view>
<view class="bottom">
<view class="time">{{item.publishDate}}</view>
<!-- <view style="display: flex;align-items: center;">-->
<!-- <image class="image" src=""/>-->
<!-- <view class="num" v-if="item.viewNum">{{item.viewNum}}次浏览</view>-->
<!-- <view class="num" v-else>0次浏览</view>-->
<!-- </view>-->
</view>
</view>
</z-paging>
</view>
</template>
......@@ -20,42 +17,24 @@
export default {
data() {
return {
queryParam:{
page: 1,
rows: 10
},
dataList:[],
noticeList: [],
}
},
onLoad(){
},
onShow() {
this.getList()
},
// 触底加载
onReachBottom() {
console.log("触底加载")
// 触底的时候请求数据,即为上拉加载更多
var allTotal = this.queryParam.page * this.queryParam.rows
//this.page为加载次数,this.pageSize为每一次加载的数据条数
if(allTotal < this.total){
//this.total为请求数据的总条数。只要现有条数小于总条数就就执行一下代码
this.queryParam.page ++;
//加载次数递加
this.getList() //请求更多数据列表
}else{
console.log('已加载全部数据')
}
},
methods: {
getList() {
//分页查询
queryList(pageNo, pageSize) {
const query = {
page:this.queryParam.page,
rows:this.queryParam.rows
page:pageNo,
rows:pageSize,
flag:'1'
}
noticeList(query).then(res =>{
this.noticeList = res.data.data
this.$refs.paging.completeByTotal(this.noticeList,res.data.total);
}).catch(e => {
console.log(e)
})
......@@ -71,20 +50,6 @@
<style lang="scss" scoped>
.announcement{
padding: 36rpx;
.noData{
.nodataImage{
height: 100vh;
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
.nodataImageClass{
width: 200rpx;
height: 200rpx;
}
}
}
.card{
padding: 34rpx;
height: 234rpx;
......@@ -105,23 +70,6 @@
padding-top: 26rpx;
display: flex;
justify-content: flex-end;
//.time{
// font-size: 16px;
// font-family: Source Han Sans CN-Regular, Source Han Sans CN;
// font-weight: 400;
// color: #666666;
//}
//.image{
// width: 36rpx;
// height: 36rpx;
// margin-right: 16rpx;
//}
//.num {
// font-size: 14px;
// font-family: Source Han Sans CN-Regular, Source Han Sans CN;
// font-weight: 400;
// color: #666666;
//}
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment