This commit is contained in:
3321822538@qq.com 2024-06-07 10:34:42 +08:00
parent 1823955f5c
commit e24c96d280

View File

@ -1,5 +1,6 @@
<template> <template>
<!-- 蜂箱目录 --> <!-- 蜂箱目录 -->
<view class="" style="background-color: #f7f7f7;height: 100vh;">
<view class="page"> <view class="page">
<!-- <view class="loading" v-if="showloading"> <!-- <view class="loading" v-if="showloading">
<view class="loading_box"> <view class="loading_box">
@ -36,7 +37,7 @@
<view class=" group_6"> <view class=" group_6">
<view class="space-y-13"> <view class="space-y-13">
<view class="list-item" v-for="(item, index) in listData" :key="index"> <view class="list-item" @scrolltolower="onReachBottom" v-for="(item, index) in listData" :key="index">
<view class="group_7 bianhao-top-yi"> <view class="group_7 bianhao-top-yi">
<view class="bianhao-zuo"> <view class="bianhao-zuo">
@ -203,7 +204,7 @@
</view> </view>
<view class="warm-tip"> <view class="warm-tip">
- 没有更多了, - <!-- - 没有更多了, - -->
</view> </view>
</view> </view>
@ -215,7 +216,7 @@
</view> </view>
<!-- 空状态 --> <!-- 空状态 -->
<view v-else class="konghezi"> <view v-if="listData.length == 0" class="konghezi">
<u-empty mode="list" text="暂无蜂箱"> <u-empty mode="list" text="暂无蜂箱">
<view class="tjbutton"> <view class="tjbutton">
<u-button @click="xinzeng" size="large" shape="circle" text="添 加" color="#23693f"></u-button> <u-button @click="xinzeng" size="large" shape="circle" text="添 加" color="#23693f"></u-button>
@ -246,6 +247,7 @@
<!-- <view class="maskgun" v-if="maskgun"></view> --> <!-- <view class="maskgun" v-if="maskgun"></view> -->
</view> </view>
</view>
</template> </template>
<script> <script>
@ -288,7 +290,9 @@
ewmpic: '', ewmpic: '',
ewmflag: false, ewmflag: false,
disabledflag: 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) { 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: { params: {
page, page,
apiary_id, apiary_id,
qrcode qrcode
} }
}).then(res => { }).then(res => {
uni.hideLoading()
wx.setStorageSync('user_id', res.data.data[0].user_id); wx.setStorageSync('user_id', res.data.data[0].user_id);
this.listData = JSON.parse(JSON.stringify(res.data.data)) // this.listData = JSON.parse(JSON.stringify(res.data.data))
wx.pageScrollTo({ this.total = res.data.total
scrollTop: 0, if (res.data.data.length > 0) {
duration: 300 //
}); this.listData = this.listData.concat(res.data.data)
this.page++
// uni.hideLoading()
}
// wx.pageScrollTo({
// scrollTop: 0,
// duration: 300
// });
// //
wx.stopPullDownRefresh(); wx.stopPullDownRefresh();
// this.$forceUpdate() // this.$forceUpdate()
@ -790,6 +817,8 @@
// this.currentindex= // this.currentindex=
console.log('调用了', event); console.log('调用了', event);
console.log('调用了', this.tabitems); console.log('调用了', this.tabitems);
this.page = 1
this.listData = []
if (event.index = 0) { if (event.index = 0) {
this.checkid = '' this.checkid = ''
this.currentindex = 0 this.currentindex = 0
@ -813,7 +842,6 @@
/deep/ .u-popup__content { /deep/ .u-popup__content {
width: 750rpx; width: 750rpx;
} }
.shuaxin { .shuaxin {
width: 32rpx; width: 32rpx;
height: 32rpx; height: 32rpx;