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

View File

@ -1,6 +1,7 @@
<template>
<!-- 蜂箱目录 -->
<view class=" page">
<view class="" style="background-color: #f7f7f7;height: 100vh;">
<view class="page">
<!-- <view class="loading" v-if="showloading">
<view class="loading_box">
<u-loading-icon color='#fff'></u-loading-icon>
@ -31,12 +32,12 @@
</view>
</view>
<!-- listData.length > 0 -->
<view v-if="listData.length > 0 " style="margin-top: 130rpx;">
<view v-if="listData.length > 0" style="margin-top: 130rpx;">
<view class=" group_6">
<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="bianhao-zuo">
@ -203,7 +204,7 @@
</view>
<view class="warm-tip">
- 没有更多了, -
<!-- - 没有更多了, - -->
</view>
</view>
@ -215,7 +216,7 @@
</view>
<!-- 空状态 -->
<view v-else class="konghezi">
<view v-if="listData.length == 0" class="konghezi">
<u-empty mode="list" text="暂无蜂箱">
<view class="tjbutton">
<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>
</view>
</template>
<script>
@ -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;