浇花器
This commit is contained in:
parent
516e9c3da9
commit
f5b6a50aed
|
@ -1,18 +1,18 @@
|
||||||
<template>
|
<template>
|
||||||
<view>
|
<view>
|
||||||
<u-navbar :is-back="true" title='定时管理' title-color="#000" :border-bottom="false" :background="bgc"
|
<u-navbar :is-back="true" title='定时管理' title-color="#000" :border-bottom="false" :background="bgc" id="navbar">
|
||||||
id="navbar">
|
|
||||||
</u-navbar>
|
</u-navbar>
|
||||||
<image class="bj" src="https://api.ccttiot.com/smartmeter/img/static/urqUoIyCCEBykZ2oG8eO" mode=""></image>
|
<image class="bj" src="https://api.ccttiot.com/smartmeter/img/static/urqUoIyCCEBykZ2oG8eO" mode=""></image>
|
||||||
<view class="" v-if="list.length > 0 || list != null">
|
<view class="" v-if="pre == 'WATER'">
|
||||||
<view class="list">
|
<view class="list" v-if="list.length > 0 || list != null">
|
||||||
<view class="list_val" v-for="(values, key, index) in list" :key="key">
|
<view class="list_val" v-for="(values, key, index) in list" :key="key">
|
||||||
<view class="lt" @click="btnitem(key,index,values)">
|
<view class="lt" @click="btnitem(key,index,values)">
|
||||||
<view class="one">{{ formattedTime(values[0], values[1]) }}</view>
|
<view class="one">{{ formattedTime(values[0], values[1]) }}</view>
|
||||||
<view class="two">P{{ index + 1 }} <text></text> {{ formatTime(values[2]) }}</view>
|
<view class="two">P{{ index + 1 }} <text></text> {{ formatTime(values[2]) }}</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="rt">
|
<view class="rt">
|
||||||
<u-switch v-model="values[3]" @change="btnchange(key,index,values)" active-color="#48893B" inactive-color="#BDBCBC"></u-switch>
|
<u-switch v-model="values[3]" @change="btnchange(key,index,values)" active-color="#48893B"
|
||||||
|
inactive-color="#BDBCBC"></u-switch>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
@ -51,7 +51,26 @@
|
||||||
|
|
||||||
<view class="mask" style="z-index: 9999;" v-if="kgflag"></view>
|
<view class="mask" style="z-index: 9999;" v-if="kgflag"></view>
|
||||||
</view>
|
</view>
|
||||||
<view class="" style="width: 100%;padding-top: 80rpx;text-align: center;color: #000;font-size: 36rpx;">
|
|
||||||
|
<view class="choushuiben" v-else>
|
||||||
|
<view class="name">
|
||||||
|
<text>抽水泵启动时间/时:</text> <input type="text" v-model="shi"/>
|
||||||
|
</view>
|
||||||
|
<view class="name">
|
||||||
|
<text>抽水泵启动时间/分:</text><input type="text" v-model="fen"/>
|
||||||
|
</view>
|
||||||
|
<view class="name">
|
||||||
|
<text>抽水泵工作时长/秒:</text><input type="text" v-model="miao"/>
|
||||||
|
</view>
|
||||||
|
<view class="name">
|
||||||
|
<text>抽水泵间隔时间/天:</text><input type="text" v-model="tian"/>
|
||||||
|
</view>
|
||||||
|
<view class="baocun" @click="btnbc">
|
||||||
|
保存
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="" v-if="pre == 'WATER'" style="width: 100%;padding-top: 80rpx;text-align: center;color: #000;font-size: 36rpx;">
|
||||||
没有更多定时浇水啦...
|
没有更多定时浇水啦...
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
@ -99,7 +118,13 @@
|
||||||
devicehour: '',
|
devicehour: '',
|
||||||
deviceminute: '',
|
deviceminute: '',
|
||||||
kgflag: false,
|
kgflag: false,
|
||||||
xctime:''
|
xctime: '',
|
||||||
|
csbobj:{},
|
||||||
|
pre:'',
|
||||||
|
shi:'',
|
||||||
|
fen:'',
|
||||||
|
miao:'',
|
||||||
|
tian:''
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 分享到好友(会话)
|
// 分享到好友(会话)
|
||||||
|
@ -119,7 +144,12 @@
|
||||||
},
|
},
|
||||||
onLoad(option) {
|
onLoad(option) {
|
||||||
xBlufi.listenDeviceMsgEvent(true, this.funListenDeviceMsgEvent)
|
xBlufi.listenDeviceMsgEvent(true, this.funListenDeviceMsgEvent)
|
||||||
if(option.list){ //判断有无数据 有数据直接拿 无数据则发送命令获取数据
|
xBlufi.notifySendCustomData({
|
||||||
|
customData: "11get"
|
||||||
|
})
|
||||||
|
if (option.list.length > 0) { //判断有无数据 有数据直接拿 无数据则发送命令获取数据
|
||||||
|
this.pre = option.pre
|
||||||
|
if (option.pre == 'WATER') {
|
||||||
this.list = JSON.parse(option.list)
|
this.list = JSON.parse(option.list)
|
||||||
for (let key in this.list) {
|
for (let key in this.list) {
|
||||||
if (this.list.hasOwnProperty(key)) {
|
if (this.list.hasOwnProperty(key)) {
|
||||||
|
@ -134,6 +164,13 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
console.log(this.list)
|
console.log(this.list)
|
||||||
|
} else {
|
||||||
|
this.csbobj = JSON.parse(option.list)
|
||||||
|
this.shi = this.csbobj.hour
|
||||||
|
this.fen = this.csbobj.minute
|
||||||
|
this.miao = this.csbobj.second
|
||||||
|
this.tian = this.csbobj.day
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
xBlufi.notifySendCustomData({
|
xBlufi.notifySendCustomData({
|
||||||
customData: "11get"
|
customData: "11get"
|
||||||
|
@ -165,7 +202,8 @@
|
||||||
this.deviceflag = 1
|
this.deviceflag = 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let cucun = '11num' + this.deviceindex + '@' + this.devicehour + '@' + this.deviceminute + '@' + this.devicemiao + '@' + this.deviceflag + '@'
|
let cucun = '11num' + this.deviceindex + '@' + this.devicehour + '@' + this.deviceminute + '@' + this
|
||||||
|
.devicemiao + '@' + this.deviceflag + '@'
|
||||||
xBlufi.notifySendCustomData({
|
xBlufi.notifySendCustomData({
|
||||||
customData: cucun
|
customData: cucun
|
||||||
})
|
})
|
||||||
|
@ -237,6 +275,37 @@
|
||||||
})
|
})
|
||||||
}, 1000)
|
}, 1000)
|
||||||
},
|
},
|
||||||
|
btnbc(){
|
||||||
|
if(this.shi >= 24){
|
||||||
|
uni.showToast({
|
||||||
|
title: '最大值为23时',
|
||||||
|
icon: 'none',
|
||||||
|
duration:2000
|
||||||
|
})
|
||||||
|
}else if(this.fen >= 60){
|
||||||
|
uni.showToast({
|
||||||
|
title: '最大值为59分钟',
|
||||||
|
icon: 'none',
|
||||||
|
duration:2000
|
||||||
|
})
|
||||||
|
}else{
|
||||||
|
this.timeflag = false
|
||||||
|
let cucun = '11num0' + '@' + this.shi + '@' + this.fen + '@' + this.miao + '@' + this.tian + '@'
|
||||||
|
xBlufi.notifySendCustomData({
|
||||||
|
customData: cucun
|
||||||
|
})
|
||||||
|
uni.showToast({
|
||||||
|
title: '保存成功',
|
||||||
|
icon: 'success',
|
||||||
|
duration:2000
|
||||||
|
})
|
||||||
|
setTimeout(() => {
|
||||||
|
xBlufi.notifySendCustomData({
|
||||||
|
customData: "11get"
|
||||||
|
})
|
||||||
|
}, 1000)
|
||||||
|
}
|
||||||
|
},
|
||||||
// 定时浇水时间
|
// 定时浇水时间
|
||||||
confirm(e) {
|
confirm(e) {
|
||||||
this.hour = e.hour
|
this.hour = e.hour
|
||||||
|
@ -263,6 +332,7 @@
|
||||||
console.log("1收到设备发来的自定义数据结果:", options.data)
|
console.log("1收到设备发来的自定义数据结果:", options.data)
|
||||||
const inputString = options.data.slice(0, -1) + ";"
|
const inputString = options.data.slice(0, -1) + ";"
|
||||||
console.log(inputString, '12121212100')
|
console.log(inputString, '12121212100')
|
||||||
|
if (this.pre == 'WATER') {
|
||||||
const pairs = inputString.split(';')
|
const pairs = inputString.split(';')
|
||||||
const showObject = {}
|
const showObject = {}
|
||||||
const pSetObjects = {}
|
const pSetObjects = {}
|
||||||
|
@ -278,6 +348,7 @@
|
||||||
this.list = pSetObjects //六个浇水时间段
|
this.list = pSetObjects //六个浇水时间段
|
||||||
|
|
||||||
const ver_Data = this.list
|
const ver_Data = this.list
|
||||||
|
|
||||||
function secondsToMinutesAndSeconds(seconds) {
|
function secondsToMinutesAndSeconds(seconds) {
|
||||||
const minutes = Math.floor(seconds / 60)
|
const minutes = Math.floor(seconds / 60)
|
||||||
const remainingSeconds = seconds % 60
|
const remainingSeconds = seconds % 60
|
||||||
|
@ -299,7 +370,10 @@
|
||||||
const diffMinutes = Math.floor(diffSeconds / 60)
|
const diffMinutes = Math.floor(diffSeconds / 60)
|
||||||
const diffHours = Math.floor(diffMinutes / 60)
|
const diffHours = Math.floor(diffMinutes / 60)
|
||||||
const remainingMinutes = diffMinutes % 60
|
const remainingMinutes = diffMinutes % 60
|
||||||
return { hours: diffHours, minutes: remainingMinutes }
|
return {
|
||||||
|
hours: diffHours,
|
||||||
|
minutes: remainingMinutes
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// 遍历 ver_Data 对象
|
// 遍历 ver_Data 对象
|
||||||
let nextTimeDiff = null
|
let nextTimeDiff = null
|
||||||
|
@ -315,13 +389,15 @@
|
||||||
const diff = timeDifference(timeDate, now)
|
const diff = timeDifference(timeDate, now)
|
||||||
// 判断是下一次时间还是上一次时间
|
// 判断是下一次时间还是上一次时间
|
||||||
if (timeDate > now) {
|
if (timeDate > now) {
|
||||||
if (!nextTime || diff.hours * 60 + diff.minutes < nextTimeDiff.hours * 60 + nextTimeDiff.minutes) {
|
if (!nextTime || diff.hours * 60 + diff.minutes < nextTimeDiff.hours * 60 +
|
||||||
|
nextTimeDiff.minutes) {
|
||||||
nextTimeDiff = diff
|
nextTimeDiff = diff
|
||||||
nextTime = timeDate
|
nextTime = timeDate
|
||||||
nextWaterDuration = secondsToMinutesAndSeconds(timeArray[2]) // 获取并转换浇水时长
|
nextWaterDuration = secondsToMinutesAndSeconds(timeArray[2]) // 获取并转换浇水时长
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!prevTime || (now.getTime() - timeDate.getTime()) < (now.getTime() - prevTime.getTime())) {
|
if (!prevTime || (now.getTime() - timeDate.getTime()) < (now.getTime() -
|
||||||
|
prevTime.getTime())) {
|
||||||
prevTimeDiff = timeDifference(now, timeDate) // 注意这里要反过来算
|
prevTimeDiff = timeDifference(now, timeDate) // 注意这里要反过来算
|
||||||
prevTime = timeDate
|
prevTime = timeDate
|
||||||
}
|
}
|
||||||
|
@ -342,6 +418,25 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
const input = options.data.slice(0, -1) + ";"
|
||||||
|
// 去除末尾的分号并分割字符串
|
||||||
|
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]) // 天数
|
||||||
|
}
|
||||||
|
console.log(this.csbobj);
|
||||||
|
this.shi = this.csbobj.hour
|
||||||
|
this.fen = this.csbobj.minute
|
||||||
|
this.miao = this.csbobj.second
|
||||||
|
this.tian = this.csbobj.day
|
||||||
|
}
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -353,9 +448,37 @@
|
||||||
/deep/ .u-title {
|
/deep/ .u-title {
|
||||||
margin-bottom: 22rpx;
|
margin-bottom: 22rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
/deep/ .uicon-nav-back {
|
/deep/ .uicon-nav-back {
|
||||||
margin-bottom: 22rpx;
|
margin-bottom: 22rpx;
|
||||||
}
|
}
|
||||||
|
.choushuiben{
|
||||||
|
.baocun{
|
||||||
|
margin: auto;
|
||||||
|
width: 630rpx;
|
||||||
|
height: 100rpx;
|
||||||
|
margin-top: 50rpx;
|
||||||
|
text-align: center;
|
||||||
|
line-height: 100rpx;
|
||||||
|
border-radius: 20rpx;
|
||||||
|
background-color: #7FAD76;
|
||||||
|
color: #fff;
|
||||||
|
font-size: 32rpx;
|
||||||
|
}
|
||||||
|
.name{
|
||||||
|
display: flex;
|
||||||
|
height: 100rpx;
|
||||||
|
line-height: 100rpx;
|
||||||
|
text{
|
||||||
|
width: 300rpx;
|
||||||
|
}
|
||||||
|
input{
|
||||||
|
border-bottom: 1px solid #ccc;
|
||||||
|
height: 100rpx;
|
||||||
|
line-height: 100rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
.jiaoshui {
|
.jiaoshui {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
top: 366rpx;
|
top: 366rpx;
|
||||||
|
@ -366,6 +489,7 @@
|
||||||
background: #FFFFFF;
|
background: #FFFFFF;
|
||||||
border-radius: 24rpx 24rpx 24rpx 24rpx;
|
border-radius: 24rpx 24rpx 24rpx 24rpx;
|
||||||
z-index: 99;
|
z-index: 99;
|
||||||
|
|
||||||
.top {
|
.top {
|
||||||
margin-top: 42rpx;
|
margin-top: 42rpx;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
@ -374,6 +498,7 @@
|
||||||
color: #3D3D3D;
|
color: #3D3D3D;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ts {
|
.ts {
|
||||||
margin-top: 30rpx;
|
margin-top: 30rpx;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
@ -382,6 +507,7 @@
|
||||||
color: #808080;
|
color: #808080;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
}
|
}
|
||||||
|
|
||||||
.shifen {
|
.shifen {
|
||||||
width: 512rpx;
|
width: 512rpx;
|
||||||
height: 128rpx;
|
height: 128rpx;
|
||||||
|
@ -394,12 +520,14 @@
|
||||||
line-height: 128rpx;
|
line-height: 128rpx;
|
||||||
padding: 0 102rpx;
|
padding: 0 102rpx;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
|
|
||||||
text {
|
text {
|
||||||
font-size: 44rpx;
|
font-size: 44rpx;
|
||||||
color: #3D3D3D;
|
color: #3D3D3D;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.jssc {
|
.jssc {
|
||||||
font-size: 32rpx;
|
font-size: 32rpx;
|
||||||
color: #808080;
|
color: #808080;
|
||||||
|
@ -407,12 +535,14 @@
|
||||||
margin-top: 58rpx;
|
margin-top: 58rpx;
|
||||||
margin-left: 96rpx;
|
margin-left: 96rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.anniu {
|
.anniu {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
margin-top: 58rpx;
|
margin-top: 58rpx;
|
||||||
padding: 0 44rpx;
|
padding: 0 44rpx;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
|
|
||||||
.qx {
|
.qx {
|
||||||
width: 278rpx;
|
width: 278rpx;
|
||||||
height: 80rpx;
|
height: 80rpx;
|
||||||
|
@ -424,6 +554,7 @@
|
||||||
line-height: 80rpx;
|
line-height: 80rpx;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.qd {
|
.qd {
|
||||||
width: 278rpx;
|
width: 278rpx;
|
||||||
height: 80rpx;
|
height: 80rpx;
|
||||||
|
@ -437,6 +568,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.mask {
|
.mask {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100vh;
|
height: 100vh;
|
||||||
|
@ -447,6 +579,7 @@
|
||||||
left: 0;
|
left: 0;
|
||||||
z-index: 98;
|
z-index: 98;
|
||||||
}
|
}
|
||||||
|
|
||||||
.list {
|
.list {
|
||||||
.list_val {
|
.list_val {
|
||||||
width: 678rpx;
|
width: 678rpx;
|
||||||
|
@ -461,17 +594,21 @@
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
margin-top: 30rpx;
|
margin-top: 30rpx;
|
||||||
|
|
||||||
.lt {
|
.lt {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|
||||||
.one {
|
.one {
|
||||||
font-size: 72rpx;
|
font-size: 72rpx;
|
||||||
color: #50565A;
|
color: #50565A;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
}
|
}
|
||||||
|
|
||||||
.two {
|
.two {
|
||||||
font-size: 32rpx;
|
font-size: 32rpx;
|
||||||
color: #50565A;
|
color: #50565A;
|
||||||
margin-top: 12rpx;
|
margin-top: 12rpx;
|
||||||
|
|
||||||
text {
|
text {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
width: 1rpx;
|
width: 1rpx;
|
||||||
|
@ -482,18 +619,21 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.rt {
|
.rt {
|
||||||
padding-top: 70rpx;
|
padding-top: 70rpx;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
page {
|
page {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
padding: 20rpx 30rpx;
|
padding: 20rpx 30rpx;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
.bj {
|
.bj {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100vh;
|
height: 100vh;
|
||||||
|
@ -502,5 +642,4 @@
|
||||||
left: 0;
|
left: 0;
|
||||||
z-index: -1;
|
z-index: -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
|
@ -77,7 +77,7 @@
|
||||||
</view>
|
</view>
|
||||||
</view> -->
|
</view> -->
|
||||||
</view>
|
</view>
|
||||||
<view class="deviceweek">
|
<view class="deviceweek" v-if="pre == 'WATER'">
|
||||||
<view class="weeklist">
|
<view class="weeklist">
|
||||||
<view class="kg" v-if="ver_data.p_set0[3] == 0">
|
<view class="kg" v-if="ver_data.p_set0[3] == 0">
|
||||||
OFF
|
OFF
|
||||||
|
@ -193,10 +193,15 @@
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
<view class="" v-else>
|
||||||
|
<view class="">抽水泵启动时间:{{csbobj.hour == undefined ? '--' : csbobj.hour + '时'}}{{csbobj.minute == undefined ? '' : csbobj.minute + '分'}}</view>
|
||||||
|
<view class="">抽水泵工作时长/秒:{{csbobj.second == undefined ? '--' : csbobj.second + '秒'}}</view>
|
||||||
|
<view class="">抽水泵间隔时间/天:{{csbobj.day == undefined ? '--' : csbobj.day + '天'}}</view>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<!-- 开关选择 -->
|
<!-- 开关选择 -->
|
||||||
<view class="switchbox">
|
<view class="switchbox">
|
||||||
<view class="switch_he">
|
<view class="switch_he" v-if="pre == 'WATER'">
|
||||||
<image src="https://api.ccttiot.com/smartmeter/img/static/u7NwkNOoQYYsvHVMkDlu" mode=""></image>
|
<image src="https://api.ccttiot.com/smartmeter/img/static/u7NwkNOoQYYsvHVMkDlu" mode=""></image>
|
||||||
<view class="yushui">
|
<view class="yushui">
|
||||||
雨水感应
|
雨水感应
|
||||||
|
@ -206,7 +211,7 @@
|
||||||
inactive-color="#7FAD76" size="40"></u-switch>
|
inactive-color="#7FAD76" size="40"></u-switch>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="switch_he">
|
<view class="switch_he" v-if="pre == 'WATER'">
|
||||||
<image src="https://api.ccttiot.com/smartmeter/img/static/u7kd92ocUgDN052nhp4R" mode=""></image>
|
<image src="https://api.ccttiot.com/smartmeter/img/static/u7kd92ocUgDN052nhp4R" mode=""></image>
|
||||||
<view class="yushui">
|
<view class="yushui">
|
||||||
儿童锁 <u-switch v-if="etchecked" v-model="two" @change="btnertong" inactive-color="#eee"
|
儿童锁 <u-switch v-if="etchecked" v-model="two" @change="btnertong" inactive-color="#eee"
|
||||||
|
@ -220,7 +225,7 @@
|
||||||
<!-- 定时 -->
|
<!-- 定时 -->
|
||||||
<view class="dingshi_he" @click="btntime">
|
<view class="dingshi_he" @click="btntime">
|
||||||
<view class="naoz">
|
<view class="naoz">
|
||||||
<image src="https://api.ccttiot.com/smartmeter/img/static/uJPgzMejk9gaogWnCO9M" mode=""></image> 6组
|
<image src="https://api.ccttiot.com/smartmeter/img/static/uJPgzMejk9gaogWnCO9M" mode=""></image> <text v-if="pre == 'WATER'">6组</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="dstime">
|
<view class="dstime">
|
||||||
定时管理 <image src="https://api.ccttiot.com/smartmeter/img/static/uagx3wGa7RYvqKqoSymy" mode="">
|
定时管理 <image src="https://api.ccttiot.com/smartmeter/img/static/uagx3wGa7RYvqKqoSymy" mode="">
|
||||||
|
@ -241,7 +246,7 @@
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<!-- 浇水日志 -->
|
<!-- 浇水日志 -->
|
||||||
<view class="wateringlogbox" @click="btnjs">
|
<view class="wateringlogbox" v-if="pre == 'WATER'" @click="btnjs">
|
||||||
<view class="wateringlogtop">
|
<view class="wateringlogtop">
|
||||||
<image src="https://api.ccttiot.com/smartmeter/img/static/uGh3pRM7mMRSHdmvtzv3" mode=""></image>
|
<image src="https://api.ccttiot.com/smartmeter/img/static/uGh3pRM7mMRSHdmvtzv3" mode=""></image>
|
||||||
浇水日志
|
浇水日志
|
||||||
|
@ -363,7 +368,9 @@
|
||||||
devicesarr:[],
|
devicesarr:[],
|
||||||
intervalId: null,
|
intervalId: null,
|
||||||
imgflag:true,
|
imgflag:true,
|
||||||
ver:''
|
ver:'',
|
||||||
|
pre:'',
|
||||||
|
csbobj:{}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 分享到好友(会话)
|
// 分享到好友(会话)
|
||||||
|
@ -497,6 +504,7 @@
|
||||||
this.bjflag = false
|
this.bjflag = false
|
||||||
this.devicelist = res.data
|
this.devicelist = res.data
|
||||||
this.mac = res.data[0].mac
|
this.mac = res.data[0].mac
|
||||||
|
this.pre = res.data[0].pre
|
||||||
this.deviceId = res.data[0].mac.match(/.{2}/g).reverse().join(':')
|
this.deviceId = res.data[0].mac.match(/.{2}/g).reverse().join(':')
|
||||||
this.user = res.data[0]
|
this.user = res.data[0]
|
||||||
this.shebid = res.data[0].deviceId
|
this.shebid = res.data[0].deviceId
|
||||||
|
@ -683,7 +691,7 @@
|
||||||
})
|
})
|
||||||
}else{
|
}else{
|
||||||
uni.navigateTo({
|
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 => {
|
this.$u.get(`/app/getDeviceInfo/${this.shebid}`).then(res => {
|
||||||
if(res.code == 200){
|
if(res.code == 200){
|
||||||
this.mac = res.data.mac
|
this.mac = res.data.mac
|
||||||
|
this.pre = res.data.pre
|
||||||
this.deviceId = res.data.mac.match(/.{2}/g).reverse().join(':')
|
this.deviceId = res.data.mac.match(/.{2}/g).reverse().join(':')
|
||||||
this.user = res.data
|
this.user = res.data
|
||||||
}
|
}
|
||||||
|
@ -899,7 +908,11 @@
|
||||||
console.log("1收到设备发来的自定义数据结果:", options.data,options.data.length)
|
console.log("1收到设备发来的自定义数据结果:", options.data,options.data.length)
|
||||||
this.datalist = options.data.slice(0, -1) + ";"
|
this.datalist = options.data.slice(0, -1) + ";"
|
||||||
this.vardataflag = 3
|
this.vardataflag = 3
|
||||||
|
if(this.pre == 'WATER'){
|
||||||
this.getchuli()
|
this.getchuli()
|
||||||
|
}else{
|
||||||
|
this.getcsbshuju()
|
||||||
|
}
|
||||||
break
|
break
|
||||||
case xBlufi.XBLUFI_TYPE.TYPE_GET_DEVICE_LISTS_START:
|
case xBlufi.XBLUFI_TYPE.TYPE_GET_DEVICE_LISTS_START:
|
||||||
if (!options.result) {
|
if (!options.result) {
|
||||||
|
@ -929,7 +942,23 @@
|
||||||
console.log("定时器已清除");
|
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() {
|
getchuli() {
|
||||||
const inputString = this.datalist
|
const inputString = this.datalist
|
||||||
|
|
Loading…
Reference in New Issue
Block a user