From fce2f2ebcf031d9ba5095a2957eb80cae625b25a Mon Sep 17 00:00:00 2001 From: liub Date: Wed, 24 Dec 2025 11:40:36 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A6=96=E9=A1=B5=E4=BF=AE=E6=94=B9=EF=BC=8C?= =?UTF-8?q?=E5=88=A0=E9=99=A4=E3=80=81=E9=87=8D=E5=91=BD=E5=90=8D=E6=88=90?= =?UTF-8?q?=E5=8A=9F=E5=90=8E=EF=BC=8C=E5=89=8D=E7=AB=AF=E7=9B=B4=E6=8E=A5?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=95=B0=E6=8D=AE=E6=BA=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/common/aboutUs/ContactUs.vue | 4 +- pages/common/index/index.vue | 82 +++++++++++++----------------- 2 files changed, 35 insertions(+), 51 deletions(-) diff --git a/pages/common/aboutUs/ContactUs.vue b/pages/common/aboutUs/ContactUs.vue index 6426afb..0e6d412 100644 --- a/pages/common/aboutUs/ContactUs.vue +++ b/pages/common/aboutUs/ContactUs.vue @@ -88,9 +88,7 @@ }); this.txt=""; hideLoading(this); - },800); - - + },800); }, closePop: function() { diff --git a/pages/common/index/index.vue b/pages/common/index/index.vue index df98d28..9847586 100644 --- a/pages/common/index/index.vue +++ b/pages/common/index/index.vue @@ -223,7 +223,7 @@ textNoMore: '没有更多数据了' }, mescrollHeight: 0, - page: 0, // 当前页码 + size: 10, // 每页条数 total: 0, // 总数据量 @@ -250,44 +250,28 @@ }, // 下拉刷新 downCallback() { - debugger; - console.log("下拉加载") - this.mescroll && this.mescroll.resetUpScroll(false); - // 重置分页参数 - - + console.log("下拉加载") + if(this.mescroll){ + this.mescroll.resetUpScroll(false); + this.mescroll.scrollTo(0,0); + } this.getData(); }, // 上拉加载 upCallback() { - debugger; - - + console.log("上拉加载") - this.page += 1; + this.getData(); }, bleStateRecovery() { console.log("蓝牙适配器恢复可用,重连断开的设备"); ble.linkAllDevices(); - // if (ble.data && ble.data.LinkedList) { - // for (var i = 0; i < this.deviceList.length; i++) { - // if (this.deviceList[i].communicationMode !== '0' || this.deviceList[i].communicationMode !== 0) { - // ble.data.LinkedList.find(v => { - - // if (v.macAddress && v.device && v.device.id && v.device.id == this.deviceList[i] - // .id) { - // ble.LinkBlue(v.deviceId); - // return true; - // } - // }); - // } - // } - // } + }, bleBreak(res) { console.log("蓝牙断开连接", res); @@ -356,7 +340,7 @@ }, // 点击弹框外的区域关闭 closePopup(type) { - debugger; + if (type === 'delete') { this.deleteShow = false; uni.showTabBar(); // 显示TabBar @@ -390,10 +374,10 @@ this.deviceList = []; this.activeTab = index; this.activeTabInfo = tab - this.page = 1; // 重置页码 + - this.getData(); + this.downCallback(); }, // 获取设备列表 getData() { @@ -452,10 +436,7 @@ //防止下拉刷新的同时会调用一次上拉加载的问题 timeout = setTimeout(task, 50); }, - // 滚动触底事件处理 - onScrollToLower() { - this.getData(); - }, + // 添加扫一扫图标 scan() { this.showTooltip = !this.showTooltip; @@ -520,9 +501,7 @@ }, // 右滑点击事件处理 handleSwipeClick(e, item, index) { - const { - content - } = e + const {content} = e setTimeout(() => { console.log(item, 'eeeee'); switch (e.content.text) { @@ -557,10 +536,14 @@ icon: 'none', duration: 1000 }); - setTimeout(() => { - this.onIntall(); - this.getTab() - }, 500); + + this.deviceList.find((v,i)=>{ + if(v.id==data.id){ + this.deviceList.splice(i,1); + return true; + } + return false; + }); this.deleteShow = false // 关闭所有滑动项 this.$refs.swipeAction.closeAll(); @@ -594,9 +577,14 @@ icon: 'none', duration: 1000 }); - setTimeout(() => { - this.onIntall(); - }, 500); + + this.deviceList.find((v,i)=>{ + if(v.id===data.id){ + this.$set(this.deviceList[i],'deviceName',data.deviceName); + return true; + } + return false; + }); this.RenameModel = false this.deviceName = '' // 关闭所有滑动项 @@ -685,9 +673,7 @@ } }) }, - onIntall() { - this.downCallback(); - }, + updateDeviceStatus(data) { this.deviceList = this.deviceList .map(item => { @@ -716,16 +702,16 @@ onLoad() { console.error("首页加载"); this.getTab() - this.onIntall() + this.downCallback(); // 绑定页面做了监听,新增成功,刷新页面 uni.$on('refreshDeviceList', () => { this.getTab() // 刷新数据 - this.onIntall() + this.downCallback(); }); // 监听设备状态更新事件 uni.$on('deviceStatusUpdate', (data) => { console.log('列表收到消息了么'); - this.onIntall() + this.downCallback(); }); ble = BleHelper.getBleTool();