浇花器

This commit is contained in:
3321822538@qq.com 2025-05-17 12:10:46 +08:00
parent 50ee64fd4b
commit 39f3134e6b
3 changed files with 75 additions and 69 deletions

View File

@ -90,7 +90,7 @@
</view> </view>
</view> </view>
</view> </view>
<view class="baocun" @click="btnbc"> <view class="baocun" v-if="pre != 'WATER'" @click="btnbc">
保存 保存
</view> </view>
<u-picker v-model="showtime" mode="time" :params="paramstime" :default-time="00" @confirm='confirmtime'></u-picker> <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) { async btnchange(key, index, values) {
try { try {
this.showLoading(); this.showLoading()
this.kgflag = true; // this.kgflag = true
this.btnitem(key, index, values); this.btnitem(key, index, values)
this.btnqx(); this.btnqx()
this.deviceindex = index; this.deviceindex = index
this.devicehour = values[0] || 0; // this.devicehour = values[0] || 0 //
this.deviceminute = values[1] || 0; this.deviceminute = values[1] || 0
this.devicemiao = values[2] || 0; this.devicemiao = values[2] || 0
if (this.list.hasOwnProperty(key)) { if (this.list.hasOwnProperty(key)) {
const array = this.list[key]; const array = this.list[key]
const lastIndex = array.length - 1; const lastIndex = array.length - 1
const lastElement = array[lastIndex]; const lastElement = array[lastIndex]
array[lastIndex] = !lastElement; array[lastIndex] = !lastElement
this.deviceflag = lastElement ? 0 : 1; this.deviceflag = lastElement ? 0 : 1
} }
let flag = values[3] == 0 ? 1 : 0 let flag = values[3] == 0 ? 1 : 0
let cucun = '11p_set' + (Number(this.deviceindex) + 1)+ ':' + this.devicehour + ',' + this.deviceminute + ',' + this.devicemiao + ',' + flag + ',' + this.jgtian + ';' 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) await this.delay(1000)
xBlufi.notifySendCustomData({ xBlufi.notifySendCustomData({
customData: "11get" customData: "11get"
}); })
setTimeout(() => { // setTimeout(() => {
this.kgflag = false; // this.kgflag = false
this.hideLoading(); this.hideLoading()
}, 2000); // }, 2000)
} catch (error) { } catch (error) {
console.error('btnchange error:', error); console.error('btnchange error:', error)
this.retryOperation(); this.retryOperation()
} }
}, },
// //
btnitem(key, index, values) { btnitem(key, index, values) {
// key 'p_set1' '1' // key 'p_set1' '1'
const indexMatch = key.match(/p_set(\d+)/); const indexMatch = key.match(/p_set(\d+)/)
this.deviceindex = indexMatch ? indexMatch[1] : index; this.deviceindex = indexMatch ? indexMatch[1] : index
this.timeflag = true this.timeflag = true
this.hour = values[0] this.hour = values[0]
this.minutekq = values[1] this.minutekq = values[1]
@ -350,16 +350,16 @@
formattedTime(minutes, seconds) { formattedTime(minutes, seconds) {
// //
const formattedMinutes = String(minutes).padStart(2, '0'); const formattedMinutes = String(minutes).padStart(2, '0')
const formattedSeconds = String(seconds).padStart(2, '0'); const formattedSeconds = String(seconds).padStart(2, '0')
// //
return `${formattedMinutes}:${formattedSeconds}`; return `${formattedMinutes}:${formattedSeconds}`
}, },
formatTime(seconds) { formatTime(seconds) {
const minutes = Math.floor(seconds / 60); const minutes = Math.floor(seconds / 60)
const remainingSeconds = seconds % 60; const remainingSeconds = seconds % 60
return `${minutes}${remainingSeconds < 10 ? '0' : ''}${remainingSeconds}`; return `${minutes}${remainingSeconds < 10 ? '0' : ''}${remainingSeconds}`
}, },
// //
@ -387,21 +387,21 @@
this.lastOperation = () => { this.lastOperation = () => {
xBlufi.notifySendCustomData({ xBlufi.notifySendCustomData({
customData: cucun customData: cucun
}); })
}; }
this.lastOperation(); this.lastOperation()
await this.delay(1000); await this.delay(1000)
xBlufi.notifySendCustomData({ xBlufi.notifySendCustomData({
customData: "11get" customData: "11get"
}); });
setTimeout(() => { // setTimeout(() => {
this.hideLoading(); this.hideLoading()
}, 2000); // }, 2000)
} catch (error) { } catch (error) {
console.error('btnqd error:', error); console.error('btnqd error:', error)
this.retryOperation(); this.retryOperation()
} }
}, },
// //
@ -412,15 +412,15 @@
title: '最大值为23时', title: '最大值为23时',
icon: 'none', icon: 'none',
duration:2000 duration:2000
}); })
return; return
} else if(this.fen >= 60){ } else if(this.fen >= 60){
uni.showToast({ uni.showToast({
title: '最大值为59分钟', title: '最大值为59分钟',
icon: 'none', icon: 'none',
duration:2000 duration:2000
}); })
return; return
} }
this.showLoading(); this.showLoading();
@ -429,27 +429,27 @@
this.lastOperation = () => { this.lastOperation = () => {
xBlufi.notifySendCustomData({ xBlufi.notifySendCustomData({
customData: cucun customData: cucun
}); })
}; };
this.lastOperation(); this.lastOperation()
await this.delay(1000); await this.delay(1000)
xBlufi.notifySendCustomData({ xBlufi.notifySendCustomData({
customData: "11get" customData: "11get"
}); })
uni.showToast({ uni.showToast({
title: '保存成功', title: '保存成功',
icon: 'success', icon: 'success',
duration: 2000 duration: 2000
}); })
setTimeout(() => { // setTimeout(() => {
this.hideLoading(); this.hideLoading()
}, 2000); // }, 2000)
} catch (error) { } catch (error) {
console.error('btnbc error:', error); console.error('btnbc error:', error)
this.retryOperation(); this.retryOperation()
} }
}, },
// //

View File

@ -154,6 +154,12 @@
this.getshebxq() this.getshebxq()
}, },
onUnload() {
this.ver = ''
},
onHide() {
this.ver = ''
},
methods: { methods: {
btnxip(){ btnxip(){
if(this.xinpin == '' || this.xinpin == null){ if(this.xinpin == '' || this.xinpin == null){

View File

@ -641,13 +641,13 @@
uni.showLoading({ uni.showLoading({
title: '开启中...' title: '开启中...'
}) })
setTimeout(() => { // setTimeout(() => {
this.yschecked = false this.yschecked = false
xBlufi.notifySendCustomData({ xBlufi.notifySendCustomData({
customData: '11yudi' customData: '11yudi'
}) })
uni.hideLoading() uni.hideLoading()
}, 1500) // }, 1500)
} }
}, },
// //
@ -670,24 +670,24 @@
title: '设置中...' title: '设置中...'
}) })
console.log(e.hour,e.minute); console.log(e.hour,e.minute);
setTimeout(() => { // setTimeout(() => {
this.devicetime = e.hour + ':' + e.minute this.devicetime = e.hour + ':' + e.minute
xBlufi.notifySendCustomData({ xBlufi.notifySendCustomData({
customData: '11date' + e.hour + ':' + e.minute + ';' customData: '11date' + e.hour + ':' + e.minute + ';'
}) })
uni.hideLoading() uni.hideLoading()
}, 1500) // }, 1500)
}else{ // }else{ //
uni.showLoading({ uni.showLoading({
title: '设置中...' title: '设置中...'
}) })
console.log(e.hour,e.minute); console.log(e.hour,e.minute);
setTimeout(() => { // setTimeout(() => {
xBlufi.notifySendCustomData({ xBlufi.notifySendCustomData({
customData: '11hour' + e.hour + '@' + e.minute + '@', customData: '11hour' + e.hour + '@' + e.minute + '@',
}) })
uni.hideLoading() uni.hideLoading()
}, 1500) // }, 1500)
} }
}, },
// //
@ -705,13 +705,13 @@
uni.showLoading({ uni.showLoading({
title: '关闭中...' title: '关闭中...'
}) })
setTimeout(() => { // setTimeout(() => {
this.yschecked = true this.yschecked = true
xBlufi.notifySendCustomData({ xBlufi.notifySendCustomData({
customData: '11unyudi' customData: '11unyudi'
}) })
uni.hideLoading() uni.hideLoading()
}, 1500) // }, 1500)
} }
}, },
// //
@ -729,13 +729,13 @@
uni.showLoading({ uni.showLoading({
title: '开启中...' title: '开启中...'
}) })
setTimeout(() => { // setTimeout(() => {
this.etchecked = false this.etchecked = false
xBlufi.notifySendCustomData({ xBlufi.notifySendCustomData({
customData: '11lock' customData: '11lock'
}) })
uni.hideLoading() uni.hideLoading()
}, 1500) // }, 1500)
} }
}, },
// //
@ -753,13 +753,13 @@
uni.showLoading({ uni.showLoading({
title: '关闭中...' title: '关闭中...'
}) })
setTimeout(() => { // setTimeout(() => {
this.etchecked = true this.etchecked = true
xBlufi.notifySendCustomData({ xBlufi.notifySendCustomData({
customData: '11unlock' customData: '11unlock'
}) })
uni.hideLoading() uni.hideLoading()
}, 1500) // }, 1500)
} }
}, },
@ -822,14 +822,14 @@
uni.showLoading({ uni.showLoading({
title: '开启中...' title: '开启中...'
}) })
setTimeout(() => { // setTimeout(() => {
xBlufi.notifySendCustomData({ xBlufi.notifySendCustomData({
customData: "11time@" + this.jstime + '@' customData: "11time@" + this.jstime + '@'
}) })
uni.hideLoading() uni.hideLoading()
this.startTimer(this.jstime) this.startTimer(this.jstime)
this.sdjsflag = false this.sdjsflag = false
}, 1500) // }, 1500)
} }
}, },
@ -871,7 +871,7 @@
uni.showLoading({ uni.showLoading({
title: '关闭中...' title: '关闭中...'
}) })
setTimeout(() => { // setTimeout(() => {
xBlufi.notifySendCustomData({ xBlufi.notifySendCustomData({
customData: "11close" customData: "11close"
}) })
@ -882,7 +882,7 @@
this.jsked = true this.jsked = true
this.jskeds = false this.jskeds = false
uni.hideLoading() uni.hideLoading()
}, 1500) // }, 1500)
} }
}, },
// //
@ -1015,7 +1015,7 @@
xBlufi.notifySendCustomData({ xBlufi.notifySendCustomData({
customData: "11get" customData: "11get"
}) })
}, 3000) }, 2000)
}else{ }else{
this.vardataflag = 1 this.vardataflag = 1
this.clearDisconnectTimer() this.clearDisconnectTimer()