浇花器
This commit is contained in:
parent
50ee64fd4b
commit
39f3134e6b
|
@ -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()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 定时浇水时间
|
// 定时浇水时间
|
||||||
|
|
|
@ -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){
|
||||||
|
|
|
@ -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()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user