65 lines
1.9 KiB
Vue
65 lines
1.9 KiB
Vue
<template>
|
|
<view class="timer-box">
|
|
<mescroll-body ref="mescrollRef" top="0" @init="mescrollInit" @down="downCallback" @up="upCallback">
|
|
|
|
</mescroll-body>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import MescrollMixin from "@/components/mescroll-uni/mescroll-mixins.js";
|
|
export default {
|
|
data() {
|
|
return {
|
|
deviceId:"1345220615100102"
|
|
};
|
|
},
|
|
mixins:[MescrollMixin],
|
|
onLoad() {
|
|
console.log("deviceId=6fd75a4262ca4d26a5ff7db064c0f460")
|
|
},
|
|
methods:{
|
|
/*上拉加载的回调*/
|
|
upCallback(page) {
|
|
let pageNum = page.num; // 页码, 默认从1开始
|
|
let pageSize = page.size; // 页长, 默认每页10条
|
|
let obj = {
|
|
pageSize:pageSize,
|
|
pageNum:pageNum,
|
|
// deviceId:this.deviceId,
|
|
// beginTime:this.beginDate,
|
|
// endTime:this.endDate
|
|
}
|
|
this.$get("/iot/timer/"+this.deviceId,obj).then((res)=>{
|
|
console.log(res,"ressssssssssss");
|
|
if (res.rows && res.rows.length>0) {
|
|
// 接口返回的当前页数据列表 (数组)
|
|
let curPageData = res.rows;
|
|
// 接口返回的当前页数据长度 (如列表有26个数据,当前页返回8个,则curPageLen=8)
|
|
let curPageLen = curPageData.length;
|
|
//设置列表数据
|
|
if(pageNum == 1) this.lineRoadList = []; //如果是第一页需手动置空列表
|
|
this.lineRoadList = this.lineRoadList.concat(curPageData); //追加新数据
|
|
this.handleCheck(curPageData);
|
|
this.mescroll.endBySize(curPageLen, res.total); // 推荐
|
|
// this.mescroll.endByPage(curPageLen, res.data.total)
|
|
// this.mescroll.endSuccess(curPageData.length);
|
|
} else{
|
|
this.lineRoadList = [];
|
|
this.mescroll.endErr();
|
|
this.mescroll.showEmpty();
|
|
// this.mescroll.endUpScroll(true);
|
|
}
|
|
}).catch(()=>{
|
|
//联网失败, 结束加载
|
|
this.mescroll.endErr();
|
|
})
|
|
},
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
</style>
|