|
|
|
|
@ -293,6 +293,30 @@ export struct ManualControl {
|
|
|
|
|
return `${h}:${min}:${s}`;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
confirmAction(message: string, action: () => void) {
|
|
|
|
|
AlertDialog.show({
|
|
|
|
|
title: '提示',
|
|
|
|
|
message: message,
|
|
|
|
|
primaryButton: {
|
|
|
|
|
value: '取消',
|
|
|
|
|
action: () => {}
|
|
|
|
|
},
|
|
|
|
|
secondaryButton: {
|
|
|
|
|
value: '确定',
|
|
|
|
|
action: () => {
|
|
|
|
|
action();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
restartDevice() {
|
|
|
|
|
this.m9zService.restartDevice({
|
|
|
|
|
onSuccess: (val: boolean): void => { this.showToastMessage('发送重启命令成功'); },
|
|
|
|
|
onError: (err: string): void => { this.showToastMessage('失败:' + err); }
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
build() {
|
|
|
|
|
Stack() {
|
|
|
|
|
Scroll() {
|
|
|
|
|
@ -325,7 +349,7 @@ export struct ManualControl {
|
|
|
|
|
.fontColor(this.manualData.disable ? '#22fdc8' : '#b2ebf2')
|
|
|
|
|
.border({ width: 1, color: this.manualData.disable ? '#22fdc8' : '#213b67' })
|
|
|
|
|
.height(44)
|
|
|
|
|
.onClick(() => this.toggleMode())
|
|
|
|
|
.onClick((): void => { this.confirmAction(`确定切换到${this.manualData.disable ? '自动' : '手动'}模式吗?`, (): void => this.toggleMode()); })
|
|
|
|
|
}
|
|
|
|
|
.width('100%')
|
|
|
|
|
.margin({bottom: 20})
|
|
|
|
|
@ -360,7 +384,7 @@ export struct ManualControl {
|
|
|
|
|
Text(loop.isOpen ? '开启' : '关闭')
|
|
|
|
|
.fontSize(10).fontColor(loop.isOpen ? '#22fdc8' : '#999')
|
|
|
|
|
}
|
|
|
|
|
.onClick(() => this.toggleLoop(loop.index))
|
|
|
|
|
.onClick((): void => { this.confirmAction(`确定${loop.isOpen ? '关闭' : '开启'}回路${loop.index + 1}吗?`, (): void => this.toggleLoop(loop.index)); })
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
@ -398,7 +422,7 @@ export struct ManualControl {
|
|
|
|
|
Text(`通道${loop.index + 1}`)
|
|
|
|
|
.fontSize(12).fontColor('#b2ebf2')
|
|
|
|
|
}
|
|
|
|
|
.onClick(() => this.openBrightnessDialog(loop.index))
|
|
|
|
|
.onClick((): void => { this.openBrightnessDialog(loop.index); })
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
@ -417,7 +441,7 @@ export struct ManualControl {
|
|
|
|
|
.border({width: 1, color: '#22fdc8'})
|
|
|
|
|
.layoutWeight(1)
|
|
|
|
|
.height(40)
|
|
|
|
|
.onClick(() => this.turnOnAll())
|
|
|
|
|
.onClick((): void => { this.confirmAction('确定要全开吗?', (): void => this.turnOnAll()); })
|
|
|
|
|
|
|
|
|
|
Button('全关')
|
|
|
|
|
.backgroundColor('#1a1520')
|
|
|
|
|
@ -426,7 +450,7 @@ export struct ManualControl {
|
|
|
|
|
.layoutWeight(1)
|
|
|
|
|
.height(40)
|
|
|
|
|
.margin({left: 10})
|
|
|
|
|
.onClick(() => this.turnOffAll())
|
|
|
|
|
.onClick((): void => { this.confirmAction('确定要全关吗?', (): void => this.turnOffAll()); })
|
|
|
|
|
|
|
|
|
|
Button('一键调光')
|
|
|
|
|
.backgroundColor('#2a2515')
|
|
|
|
|
@ -435,7 +459,7 @@ export struct ManualControl {
|
|
|
|
|
.layoutWeight(1)
|
|
|
|
|
.height(40)
|
|
|
|
|
.margin({left: 10})
|
|
|
|
|
.onClick(() => this.openBrightnessDialog(-1))
|
|
|
|
|
.onClick((): void => { this.openBrightnessDialog(-1); })
|
|
|
|
|
}.width('100%').margin({bottom: 15})
|
|
|
|
|
|
|
|
|
|
Row() {
|
|
|
|
|
@ -445,7 +469,7 @@ export struct ManualControl {
|
|
|
|
|
.border({width: 1, color: '#40a7fa'})
|
|
|
|
|
.layoutWeight(1)
|
|
|
|
|
.height(40)
|
|
|
|
|
.onClick(() => this.syncDeviceTime())
|
|
|
|
|
.onClick((): void => { this.confirmAction('确定要同步设备时间吗?', (): void => this.syncDeviceTime()); })
|
|
|
|
|
|
|
|
|
|
Button('刷新数据')
|
|
|
|
|
.backgroundColor('rgba(34, 253, 200, 0.1)')
|
|
|
|
|
@ -454,20 +478,18 @@ export struct ManualControl {
|
|
|
|
|
.layoutWeight(1)
|
|
|
|
|
.height(40)
|
|
|
|
|
.margin({left: 10})
|
|
|
|
|
.onClick(() => this.refreshData())
|
|
|
|
|
.onClick((): void => { this.refreshData(); })
|
|
|
|
|
|
|
|
|
|
Button('重启设备')
|
|
|
|
|
.backgroundColor('#fa5050')
|
|
|
|
|
.fontColor('white')
|
|
|
|
|
.layoutWeight(1)
|
|
|
|
|
.height(40)
|
|
|
|
|
.margin({left: 10})
|
|
|
|
|
.onClick((): void => { this.confirmAction('确定要重启设备吗?', (): void => this.restartDevice()); })
|
|
|
|
|
}.width('100%').margin({bottom: 20})
|
|
|
|
|
|
|
|
|
|
// --- Bottom Info ---
|
|
|
|
|
Column() {
|
|
|
|
|
Row() {
|
|
|
|
|
Text(`日出时间:${this.sunriseTime}`).fontSize(12).fontColor('#b2ebf2').layoutWeight(1)
|
|
|
|
|
Text(`日落时间:${this.sunsetTime}`).fontSize(12).fontColor('#b2ebf2').layoutWeight(1)
|
|
|
|
|
}.width('100%')
|
|
|
|
|
}
|
|
|
|
|
.width('100%')
|
|
|
|
|
.padding(15)
|
|
|
|
|
.backgroundColor('rgba(15, 30, 60, 0.4)')
|
|
|
|
|
.borderRadius(8)
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
.width('100%')
|
|
|
|
|
.padding({ left: 15, right: 15, top: 15, bottom: 80 })
|
|
|
|
|
|