Commit 73a4d1be authored by liwei's avatar liwei

增加了公告列表的分页

parent d7aed10a
...@@ -68,7 +68,8 @@ export default { ...@@ -68,7 +68,8 @@ export default {
const query = { const query = {
page:pageNo, page:pageNo,
rows:pageSize, rows:pageSize,
publishStatus:'1' publishStatus:'1',
flag:'1'
} }
activityList(query).then(res =>{ activityList(query).then(res =>{
this.activityList = res.data.data this.activityList = res.data.data
......
...@@ -141,7 +141,8 @@ ...@@ -141,7 +141,8 @@
getBannerList() { getBannerList() {
const query = { const query = {
page: this.queryParam.page, page: this.queryParam.page,
rows: this.queryParam.rows rows: this.queryParam.rows,
flag:'1'
} }
bannerList(query).then(res =>{ bannerList(query).then(res =>{
let imgList = [] let imgList = []
...@@ -163,7 +164,8 @@ ...@@ -163,7 +164,8 @@
getNoticeList() { getNoticeList() {
const query = { const query = {
page: this.queryParam.page, page: this.queryParam.page,
rows: this.queryParam.rows rows: this.queryParam.rows,
flag:'1'
} }
noticeList(query).then(res =>{ noticeList(query).then(res =>{
this.notice = res.data.data[0] this.notice = res.data.data[0]
......
<template> <template>
<view class="announcement"> <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="toptitle">{{item.title}}</view> <view class="card" v-for="item in dataList" @click="gotopage(item)">
<view class="bottom"> <view class="toptitle">{{item.title}}</view>
<view class="time">{{item.publishDate}}</view> <view class="bottom">
<!-- <view style="display: flex;align-items: center;">--> <view class="time">{{item.publishDate}}</view>
<!-- <image class="image" src=""/>--> </view>
<!-- <view class="num" v-if="item.viewNum">{{item.viewNum}}次浏览</view>--> </view>
<!-- <view class="num" v-else>0次浏览</view>--> </z-paging>
<!-- </view>-->
</view>
</view>
</view> </view>
</template> </template>
...@@ -20,46 +17,28 @@ ...@@ -20,46 +17,28 @@
export default { export default {
data() { data() {
return { return {
queryParam:{ dataList:[],
page: 1,
rows: 10
},
noticeList: [], noticeList: [],
} }
}, },
onLoad(){ 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: { methods: {
getList() { //分页查询
queryList(pageNo, pageSize) {
const query = { const query = {
page:this.queryParam.page, page:pageNo,
rows:this.queryParam.rows rows:pageSize,
flag:'1'
} }
noticeList(query).then(res =>{ noticeList(query).then(res =>{
this.noticeList = res.data.data this.noticeList = res.data.data
this.$refs.paging.completeByTotal(this.noticeList,res.data.total);
}).catch(e => { }).catch(e => {
console.log(e) console.log(e)
}) })
}, },
gotopage(item){ gotopage(item){
uni.navigateTo({ uni.navigateTo({
url: '/pagesNotice/detail?id='+item.businessId url: '/pagesNotice/detail?id='+item.businessId
...@@ -71,20 +50,6 @@ ...@@ -71,20 +50,6 @@
<style lang="scss" scoped> <style lang="scss" scoped>
.announcement{ .announcement{
padding: 36rpx;
.noData{
.nodataImage{
height: 100vh;
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
.nodataImageClass{
width: 200rpx;
height: 200rpx;
}
}
}
.card{ .card{
padding: 34rpx; padding: 34rpx;
height: 234rpx; height: 234rpx;
...@@ -105,23 +70,6 @@ ...@@ -105,23 +70,6 @@
padding-top: 26rpx; padding-top: 26rpx;
display: flex; display: flex;
justify-content: flex-end; 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