浇花器
This commit is contained in:
parent
50ee64fd4b
commit
39f3134e6b
|
@ -90,7 +90,7 @@
|
|||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="baocun" @click="btnbc">
|
||||
<view class="baocun" v-if="pre != 'WATER'" @click="btnbc">
|
||||
保存
|
||||
</view>
|
||||
<u-picker v-model="showtime" mode="time" :params="paramstime" :default-time="00" @confirm='confirmtime'></u-picker>
|
||||
|
@ -281,21 +281,21 @@
|
|||
// 点击开关是否开启
|
||||
async btnchange(key, index, values) {
|
||||
try {
|
||||
this.showLoading();
|
||||
this.kgflag = true;
|
||||
this.btnitem(key, index, values);
|
||||
this.btnqx();
|
||||
this.deviceindex = index;
|
||||
this.devicehour = values[0] || 0; // 添加默认值
|
||||
this.deviceminute = values[1] || 0;
|
||||
this.devicemiao = values[2] || 0;
|
||||
this.showLoading()
|
||||
// this.kgflag = true
|
||||
this.btnitem(key, index, values)
|
||||
this.btnqx()
|
||||
this.deviceindex = index
|
||||
this.devicehour = values[0] || 0 // 添加默认值
|
||||
this.deviceminute = values[1] || 0
|
||||
this.devicemiao = values[2] || 0
|
||||
|
||||
if (this.list.hasOwnProperty(key)) {
|
||||
const array = this.list[key];
|
||||
const lastIndex = array.length - 1;
|
||||
const lastElement = array[lastIndex];
|
||||
array[lastIndex] = !lastElement;
|
||||
this.deviceflag = lastElement ? 0 : 1;
|
||||
const array = this.list[key]
|
||||
const lastIndex = array.length - 1
|
||||
const lastElement = array[lastIndex]
|
||||
array[lastIndex] = !lastElement
|
||||
this.deviceflag = lastElement ? 0 : 1
|
||||
}
|
||||
let flag = values[3] == 0 ? 1 : 0
|
||||
let cucun = '11p_set' + (Number(this.deviceindex) + 1)+ ':' + this.devicehour + ',' + this.deviceminute + ',' + this.devicemiao + ',' + flag + ',' + this.jgtian + ';'
|
||||
|
@ -308,23 +308,23 @@
|
|||
await this.delay(1000)
|
||||
xBlufi.notifySendCustomData({
|
||||
customData: "11get"
|
||||
});
|
||||
})
|
||||
|
||||
setTimeout(() => {
|
||||
this.kgflag = false;
|
||||
this.hideLoading();
|
||||
}, 2000);
|
||||
// setTimeout(() => {
|
||||
// this.kgflag = false
|
||||
this.hideLoading()
|
||||
// }, 2000)
|
||||
} catch (error) {
|
||||
console.error('btnchange error:', error);
|
||||
this.retryOperation();
|
||||
console.error('btnchange error:', error)
|
||||
this.retryOperation()
|
||||
}
|
||||
},
|
||||
|
||||
// 点击设置定时时间
|
||||
btnitem(key, index, values) {
|
||||
// 从 key 中提取索引号,例如从 'p_set1' 提取 '1'
|
||||
const indexMatch = key.match(/p_set(\d+)/);
|
||||
this.deviceindex = indexMatch ? indexMatch[1] : index;
|
||||
const indexMatch = key.match(/p_set(\d+)/)
|
||||
this.deviceindex = indexMatch ? indexMatch[1] : index
|
||||
this.timeflag = true
|
||||
this.hour = values[0]
|
||||
this.minutekq = values[1]
|
||||
|
@ -350,16 +350,16 @@
|
|||
|
||||
formattedTime(minutes, seconds) {
|
||||
// 将数字转换为字符串并补零
|
||||
const formattedMinutes = String(minutes).padStart(2, '0');
|
||||
const formattedSeconds = String(seconds).padStart(2, '0');
|
||||
const formattedMinutes = String(minutes).padStart(2, '0')
|
||||
const formattedSeconds = String(seconds).padStart(2, '0')
|
||||
// 返回格式化后的时间字符串
|
||||
return `${formattedMinutes}:${formattedSeconds}`;
|
||||
return `${formattedMinutes}:${formattedSeconds}`
|
||||
},
|
||||
|
||||
formatTime(seconds) {
|
||||
const minutes = Math.floor(seconds / 60);
|
||||
const remainingSeconds = seconds % 60;
|
||||
return `${minutes}分${remainingSeconds < 10 ? '0' : ''}${remainingSeconds}秒`;
|
||||
const minutes = Math.floor(seconds / 60)
|
||||
const remainingSeconds = seconds % 60
|
||||
return `${minutes}分${remainingSeconds < 10 ? '0' : ''}${remainingSeconds}秒`
|
||||
},
|
||||
|
||||
// 取消选择设置定时时间
|
||||
|
@ -387,21 +387,21 @@
|
|||
this.lastOperation = () => {
|
||||
xBlufi.notifySendCustomData({
|
||||
customData: cucun
|
||||
});
|
||||
};
|
||||
this.lastOperation();
|
||||
})
|
||||
}
|
||||
this.lastOperation()
|
||||
|
||||
await this.delay(1000);
|
||||
await this.delay(1000)
|
||||
xBlufi.notifySendCustomData({
|
||||
customData: "11get"
|
||||
});
|
||||
|
||||
setTimeout(() => {
|
||||
this.hideLoading();
|
||||
}, 2000);
|
||||
// setTimeout(() => {
|
||||
this.hideLoading()
|
||||
// }, 2000)
|
||||
} catch (error) {
|
||||
console.error('btnqd error:', error);
|
||||
this.retryOperation();
|
||||
console.error('btnqd error:', error)
|
||||
this.retryOperation()
|
||||
}
|
||||
},
|
||||
// 保存抽水泵设置
|
||||
|
@ -412,15 +412,15 @@
|
|||
title: '最大值为23时',
|
||||
icon: 'none',
|
||||
duration:2000
|
||||
});
|
||||
return;
|
||||
})
|
||||
return
|
||||
} else if(this.fen >= 60){
|
||||
uni.showToast({
|
||||
title: '最大值为59分钟',
|
||||
icon: 'none',
|
||||
duration:2000
|
||||
});
|
||||
return;
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
this.showLoading();
|
||||
|
@ -429,27 +429,27 @@
|
|||
this.lastOperation = () => {
|
||||
xBlufi.notifySendCustomData({
|
||||
customData: cucun
|
||||
});
|
||||
})
|
||||
};
|
||||
this.lastOperation();
|
||||
this.lastOperation()
|
||||
|
||||
await this.delay(1000);
|
||||
await this.delay(1000)
|
||||
xBlufi.notifySendCustomData({
|
||||
customData: "11get"
|
||||
});
|
||||
})
|
||||
|
||||
uni.showToast({
|
||||
title: '保存成功',
|
||||
icon: 'success',
|
||||
duration: 2000
|
||||
});
|
||||
})
|
||||
|
||||
setTimeout(() => {
|
||||
this.hideLoading();
|
||||
}, 2000);
|
||||
// setTimeout(() => {
|
||||
this.hideLoading()
|
||||
// }, 2000)
|
||||
} catch (error) {
|
||||
console.error('btnbc error:', error);
|
||||
this.retryOperation();
|
||||
console.error('btnbc error:', error)
|
||||
this.retryOperation()
|
||||
}
|
||||
},
|
||||
// 定时浇水时间
|
||||
|
|
|
@ -154,6 +154,12 @@
|
|||
|
||||
this.getshebxq()
|
||||
},
|
||||
onUnload() {
|
||||
this.ver = ''
|
||||
},
|
||||
onHide() {
|
||||
this.ver = ''
|
||||
},
|
||||
methods: {
|
||||
btnxip(){
|
||||
if(this.xinpin == '' || this.xinpin == null){
|
||||
|
|
|
@ -641,13 +641,13 @@
|
|||
uni.showLoading({
|
||||
title: '开启中...'
|
||||
})
|
||||
setTimeout(() => {
|
||||
// setTimeout(() => {
|
||||
this.yschecked = false
|
||||
xBlufi.notifySendCustomData({
|
||||
customData: '11yudi'
|
||||
})
|
||||
uni.hideLoading()
|
||||
}, 1500)
|
||||
// }, 1500)
|
||||
}
|
||||
},
|
||||
// 点击显示设置时间
|
||||
|
@ -670,24 +670,24 @@
|
|||
title: '设置中...'
|
||||
})
|
||||
console.log(e.hour,e.minute);
|
||||
setTimeout(() => {
|
||||
// setTimeout(() => {
|
||||
this.devicetime = e.hour + ':' + e.minute
|
||||
xBlufi.notifySendCustomData({
|
||||
customData: '11date' + e.hour + ':' + e.minute + ';'
|
||||
})
|
||||
uni.hideLoading()
|
||||
}, 1500)
|
||||
// }, 1500)
|
||||
}else{ //抽水泵
|
||||
uni.showLoading({
|
||||
title: '设置中...'
|
||||
})
|
||||
console.log(e.hour,e.minute);
|
||||
setTimeout(() => {
|
||||
// setTimeout(() => {
|
||||
xBlufi.notifySendCustomData({
|
||||
customData: '11hour' + e.hour + '@' + e.minute + '@',
|
||||
})
|
||||
uni.hideLoading()
|
||||
}, 1500)
|
||||
// }, 1500)
|
||||
}
|
||||
},
|
||||
// 雨水感应关闭
|
||||
|
@ -705,13 +705,13 @@
|
|||
uni.showLoading({
|
||||
title: '关闭中...'
|
||||
})
|
||||
setTimeout(() => {
|
||||
// setTimeout(() => {
|
||||
this.yschecked = true
|
||||
xBlufi.notifySendCustomData({
|
||||
customData: '11unyudi'
|
||||
})
|
||||
uni.hideLoading()
|
||||
}, 1500)
|
||||
// }, 1500)
|
||||
}
|
||||
},
|
||||
// 点击儿童锁开启
|
||||
|
@ -729,13 +729,13 @@
|
|||
uni.showLoading({
|
||||
title: '开启中...'
|
||||
})
|
||||
setTimeout(() => {
|
||||
// setTimeout(() => {
|
||||
this.etchecked = false
|
||||
xBlufi.notifySendCustomData({
|
||||
customData: '11lock'
|
||||
})
|
||||
uni.hideLoading()
|
||||
}, 1500)
|
||||
// }, 1500)
|
||||
}
|
||||
},
|
||||
// 点击儿童锁关闭
|
||||
|
@ -753,13 +753,13 @@
|
|||
uni.showLoading({
|
||||
title: '关闭中...'
|
||||
})
|
||||
setTimeout(() => {
|
||||
// setTimeout(() => {
|
||||
this.etchecked = true
|
||||
xBlufi.notifySendCustomData({
|
||||
customData: '11unlock'
|
||||
})
|
||||
uni.hideLoading()
|
||||
}, 1500)
|
||||
// }, 1500)
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -822,14 +822,14 @@
|
|||
uni.showLoading({
|
||||
title: '开启中...'
|
||||
})
|
||||
setTimeout(() => {
|
||||
// setTimeout(() => {
|
||||
xBlufi.notifySendCustomData({
|
||||
customData: "11time@" + this.jstime + '@'
|
||||
})
|
||||
uni.hideLoading()
|
||||
this.startTimer(this.jstime)
|
||||
this.sdjsflag = false
|
||||
}, 1500)
|
||||
// }, 1500)
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -871,7 +871,7 @@
|
|||
uni.showLoading({
|
||||
title: '关闭中...'
|
||||
})
|
||||
setTimeout(() => {
|
||||
// setTimeout(() => {
|
||||
xBlufi.notifySendCustomData({
|
||||
customData: "11close"
|
||||
})
|
||||
|
@ -882,7 +882,7 @@
|
|||
this.jsked = true
|
||||
this.jskeds = false
|
||||
uni.hideLoading()
|
||||
}, 1500)
|
||||
// }, 1500)
|
||||
}
|
||||
},
|
||||
// 开启手动浇水
|
||||
|
@ -1015,7 +1015,7 @@
|
|||
xBlufi.notifySendCustomData({
|
||||
customData: "11get"
|
||||
})
|
||||
}, 3000)
|
||||
}, 2000)
|
||||
}else{
|
||||
this.vardataflag = 1
|
||||
this.clearDisconnectTimer()
|
||||
|
|
Loading…
Reference in New Issue
Block a user