<template>
|
<view class="steam_monitor">
|
<scroll-view
|
scroll-y="true"
|
class="steam_index_scroll"
|
:scroll-top="scrollTop"
|
refresher-enabled="true"
|
refresher-background="#EAEAEA"
|
:refresher-triggered="triggered"
|
@refresherpulling="refresherrefresh"
|
@scrolltolower="scrolltoLower">
|
<view class="steam_mains">
|
<view class="steam_card_index" v-for="(item,index) in steamMonitorList" :key="index">
|
<view class="steam_card_header">{{index+1}}号</view>
|
<view class="steam_card_main">
|
<view class="steam_card_text">温度:</view>
|
<view class="steam_card_datas">{{item.temperature}}℃</view>
|
</view>
|
<view class="steam_card_main" style="top:65px">
|
<view class="steam_card_text">湿度:</view>
|
<view class="steam_card_datas">{{item.humidity===null?0:item.humidity}}%</view>
|
</view>
|
</view>
|
</view>
|
<u-loadmore :status="status" :icon-type="iconType" :load-text="loadText" />
|
</scroll-view>
|
</view>
|
</template>
|
|
<script>
|
import { throttle } from '../../plugins/public.js';
|
export default{
|
data(){
|
return{
|
pageNum: 1,
|
pageSize: 1000000000,
|
loadPage: 0,
|
steamMonitorList:[],//蒸养监控
|
scrollTop: 0,
|
triggered: true,
|
status: 'loading',
|
loadText: {
|
loading: '努力加载中',
|
nomore: '没有更多数据了'
|
},
|
}
|
},
|
mounted(){
|
this.searchSteamList()
|
},
|
methods:{
|
//查询蒸养监控列表
|
searchSteamList(){
|
this.triggeredBear = true;
|
this.steamMonitorList = [];
|
let params = {
|
pageNum: this.pageNum,
|
pageSize:this.pageSize,
|
}
|
this.$api.reboSystem.searchSteamLists(params).then(res=>{
|
if(res.statusMsg === 'ok'){
|
this.steamMonitorList = res.data.list
|
this.loadPage = res.data.pages;
|
this.triggeredBear = false;
|
this.status = 'nomore';
|
}else{
|
uni.$u.toast(res.statusMsg);
|
}
|
}).catch((err) => {
|
uni.$u.toast('请检查网络服务或联系管理员!')
|
})
|
},
|
//自定义下拉刷新
|
refresherrefresh: throttle(function() {
|
this.status = 'loading';
|
this.pageNum = 1;
|
this.searchSteamList();
|
uni.$u.toast('刷新成功');
|
}, 500),
|
//触底刷新
|
scrolltoLower: throttle(function() {
|
this.status = 'loading';
|
if(this.pageNum >= this.loadPage) {
|
setTimeout(() => {
|
this.status = 'nomore'
|
uni.$u.toast('没有更多数据了');
|
},1000)
|
return
|
} else {
|
this.pageNum+=1
|
let params = {
|
pageNum: this.pageNum,
|
pageSize:this.pageSize,
|
}
|
this.$api.reboSystem.searchSteamLists(params).then(res=>{
|
if(res.statusMsg === 'ok'){
|
this.steamMonitorList.push(...res.data.list)
|
this.loadPage = res.data.pages;
|
this.triggered = false;
|
this.status = 'nomore';
|
}else{
|
uni.$u.toast(res.statusMsg);
|
}
|
}).catch((err) => {
|
uni.$u.toast('请检查网络服务或联系管理员!')
|
})
|
}
|
}, 1500),
|
}
|
}
|
</script>
|
|
<style lang="scss" scoped>
|
.steam_monitor{
|
height: 100vh;
|
padding: 10px 15px;
|
background-color: #fff;
|
|
.steam_index_scroll{
|
height: 90%;
|
|
.steam_mains{
|
display:flex;
|
flex-wrap: wrap;
|
justify-content: space-between;
|
&::after{
|
content: "";
|
width: calc(100%/3.5);
|
}
|
.steam_card_index{
|
width: 100px;
|
height: 100px;
|
margin: 8px 4px;
|
background-color: rgba(25, 119, 255, .12);
|
border-radius: 3px;
|
position: relative;
|
|
.steam_card_header{
|
display: flex;
|
justify-content: center;
|
line-height: 23px;
|
background-color: rgba(25, 119, 255, .72);
|
height: 25px;
|
margin: 0 12px;
|
clip-path: polygon(0 0, 100% 0, 93% 100%, 7% 100%);
|
position: absolute;
|
left: 0;
|
right: 0;
|
color: rgba(255, 255, 255, 1);
|
font-size: 17px;
|
font-weight: 500;
|
}
|
.steam_card_main{
|
position: absolute;
|
top: 40px;
|
left: 0;
|
right: 0;
|
display:flex;
|
justify-content: center;
|
.steam_card_text{
|
color: rgba(51, 51, 51, 1);
|
font-size: 15px;
|
font-weight:500;
|
}
|
.steam_card_datas{
|
color: rgba(25, 119, 255, 1);
|
font-size: 15px;
|
font-weight: 500;
|
|
}
|
}
|
}
|
}
|
}
|
}
|
</style>
|