diff --git a/pages/fengxiang/index.vue b/pages/fengxiang/index.vue index 50840f9..c804d63 100644 --- a/pages/fengxiang/index.vue +++ b/pages/fengxiang/index.vue @@ -1,250 +1,252 @@ @@ -288,7 +290,9 @@ ewmpic: '', ewmflag: false, disabledflag: false, - tokenflag: false + tokenflag: false, + total:0, + showflag:false }; }, @@ -726,21 +730,44 @@ }) }, + onReachBottom() { + let sum = this.total / 15 + if (this.page - 1 < sum) { + this.pageData(); // 上拉加载更多 + } else { + uni.showToast({ + title: '没有更多蜂箱了', + icon: 'none', + duration: 1000 + }); + } + }, // 发请求拿数据 async pageData(page, apiary_id, qrcode) { - await request.get('/api/beehive/index', { + uni.showLoading({ + title: '加载中...', + }) + await request.get('/api/beehive/index?page=' + this.page, { params: { page, apiary_id, qrcode } }).then(res => { + uni.hideLoading() wx.setStorageSync('user_id', res.data.data[0].user_id); - this.listData = JSON.parse(JSON.stringify(res.data.data)) - wx.pageScrollTo({ - scrollTop: 0, - duration: 300 - }); + // this.listData = JSON.parse(JSON.stringify(res.data.data)) + this.total = res.data.total + if (res.data.data.length > 0) { + // 有数据,追加到列表 + this.listData = this.listData.concat(res.data.data) + this.page++ + // uni.hideLoading() + } + // wx.pageScrollTo({ + // scrollTop: 0, + // duration: 300 + // }); // 停止下拉刷新状态 wx.stopPullDownRefresh(); // this.$forceUpdate() @@ -790,6 +817,8 @@ // this.currentindex= console.log('调用了', event); console.log('调用了', this.tabitems); + this.page = 1 + this.listData = [] if (event.index = 0) { this.checkid = '' this.currentindex = 0 @@ -813,7 +842,6 @@ /deep/ .u-popup__content { width: 750rpx; } - .shuaxin { width: 32rpx; height: 32rpx; @@ -823,7 +851,7 @@ height: 100%; } } - + .maskgun { width: 100%; height: 100vh;