| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- <template>
- <view :class="$isEmpty(deviceList) ? 'bg-white':''">
- <mescroll-body ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback" :down="downOption" :up="upOption">
- <device-card :list="deviceList" ></device-card>
- </mescroll-body>
- <view class="footer-fixed">
- <view class="margin">
- <u-button type="primary" shape="circle" @click="subscribeMessage">订阅设备告警通知</u-button>
- </view>
- </view>
- </view>
- </template>
- <script>
- var app = getApp();
- import MescrollMixin from "@/comps/mescroll-body/mescroll-mixins.js";
- import DeviceCard from "@/comps/device-card.vue";
- import DtEmpty from '@/comps/dt_empty.vue';
- export default {
- mixins: [MescrollMixin], // 使用mixin
- components:{
- DeviceCard,DtEmpty
- },
- data() {
- return {
- deviceList:[],
- }
- },
- onLoad() {
-
- },
- methods: {
- //订阅消息通知
- subscribeMessage() {
- this.$util.subscribe(["nSBYQTAe7wtQFPyHLXkacYF3IxwkYKjzWxsiVMzx-xM"]);
- },
- downCallback(mescroll) {
- setTimeout(() => {
- this.mescroll.resetUpScroll()
- },1500)
- },
- upCallback(mescroll) {
- let that = this;
- let params = {
- memberId: app.globalData.member.id,
- residentialId: uni.getStorageSync("residentialId")
- };
- // let operation = 'device/list';
- try {
- that.$http.iotDeviceList(params).then(res=>{
- let data = res.data.iotDevices;
- // let total = res.data.carPage.total;
- // mescroll.endBySize(data.length, total);
- mescroll.endSuccess(data.length);
- if (mescroll.num == 1) {
- that.deviceList = []; //如果是第一页需手动制空列表
- }
- that.deviceList = that.deviceList.concat(data); //追加新数据
- });
-
- } catch(e) {
- this.mescroll.endErr()
- }
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- </style>
|