From f5b6a50aed1ce8270cd72c066f58cc204619dbd8 Mon Sep 17 00:00:00 2001 From: "3321822538@qq.com" <3321822538@qq.com> Date: Thu, 20 Feb 2025 11:29:45 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=87=E8=8A=B1=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- page_user/dingshi.vue | 817 ++++++++++++++++++++++++------------------ pages/index/index.vue | 49 ++- 2 files changed, 517 insertions(+), 349 deletions(-) diff --git a/page_user/dingshi.vue b/page_user/dingshi.vue index cb30d51..e8506c0 100644 --- a/page_user/dingshi.vue +++ b/page_user/dingshi.vue @@ -1,362 +1,485 @@ \ No newline at end of file diff --git a/pages/index/index.vue b/pages/index/index.vue index d383913..81c769a 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -77,7 +77,7 @@ --> - + OFF @@ -193,10 +193,15 @@ + + 抽水泵启动时间:{{csbobj.hour == undefined ? '--' : csbobj.hour + '时'}}{{csbobj.minute == undefined ? '' : csbobj.minute + '分'}} + 抽水泵工作时长/秒:{{csbobj.second == undefined ? '--' : csbobj.second + '秒'}} + 抽水泵间隔时间/天:{{csbobj.day == undefined ? '--' : csbobj.day + '天'}} + - + 雨水感应 @@ -206,7 +211,7 @@ inactive-color="#7FAD76" size="40"> - + 儿童锁 - 6组 + 6组 定时管理 @@ -241,13 +246,13 @@ - + 浇水日志 - + 距离下次:{{xctime}} 下次浇水时长:{{xctimesc}} 上次浇水:{{sctimejs}} @@ -363,7 +368,9 @@ devicesarr:[], intervalId: null, imgflag:true, - ver:'' + ver:'', + pre:'', + csbobj:{} } }, // 分享到好友(会话) @@ -497,6 +504,7 @@ this.bjflag = false this.devicelist = res.data this.mac = res.data[0].mac + this.pre = res.data[0].pre this.deviceId = res.data[0].mac.match(/.{2}/g).reverse().join(':') this.user = res.data[0] this.shebid = res.data[0].deviceId @@ -683,7 +691,7 @@ }) }else{ uni.navigateTo({ - url: '/page_user/dingshi?list=' + JSON.stringify(this.ver_data) + url: '/page_user/dingshi?list=' + JSON.stringify(this.ver_data) + '&pre=' + this.pre }) } }, @@ -845,6 +853,7 @@ this.$u.get(`/app/getDeviceInfo/${this.shebid}`).then(res => { if(res.code == 200){ this.mac = res.data.mac + this.pre = res.data.pre this.deviceId = res.data.mac.match(/.{2}/g).reverse().join(':') this.user = res.data } @@ -899,7 +908,11 @@ console.log("1收到设备发来的自定义数据结果:", options.data,options.data.length) this.datalist = options.data.slice(0, -1) + ";" this.vardataflag = 3 - this.getchuli() + if(this.pre == 'WATER'){ + this.getchuli() + }else{ + this.getcsbshuju() + } break case xBlufi.XBLUFI_TYPE.TYPE_GET_DEVICE_LISTS_START: if (!options.result) { @@ -929,7 +942,23 @@ console.log("定时器已清除"); } }, - + // 处理抽水泵接收数据 + getcsbshuju(){ + const input = this.datalist + // 去除末尾的分号并分割字符串 + const parts = input.replace(";", "").split(":") + // 获取时间部分并分割 + const timeParts = parts[1].split(",") + // 解析为对象 + this.csbobj = { + hour: parseInt(timeParts[0]), // 小时 + minute: parseInt(timeParts[1]), // 分钟 + second: parseInt(timeParts[2]), // 秒 + day: parseInt(timeParts[3]) // 天数 + } + this.ver_data = this.csbobj + console.log(this.csbobj); + }, // 处理从设备接收数据 getchuli() { const inputString = this.datalist