From f1b90810cdc08ba186f32a0d1acf7a69fc84e9a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=99=E8=90=8C?= <525441437@qq.com> Date: Thu, 7 Dec 2023 10:17:59 +0800 Subject: [PATCH] 1 --- src/views/wufang/downtake.vue | 4 ++-- src/views/wufang/rollByRoll.vue | 27 ++++++++++++++++----------- src/views/wufang/uptake.vue | 6 +++--- src/views/wufang/waterPump.vue | 2 +- 4 files changed, 22 insertions(+), 17 deletions(-) diff --git a/src/views/wufang/downtake.vue b/src/views/wufang/downtake.vue index 55dce66..dfbca1b 100644 --- a/src/views/wufang/downtake.vue +++ b/src/views/wufang/downtake.vue @@ -50,13 +50,13 @@
-
展开的输出通道
+
打开的通道
-
关闭的输出通道
+
关闭的通道
diff --git a/src/views/wufang/rollByRoll.vue b/src/views/wufang/rollByRoll.vue index 571fbe4..f53a13a 100644 --- a/src/views/wufang/rollByRoll.vue +++ b/src/views/wufang/rollByRoll.vue @@ -228,24 +228,29 @@ export default { getStatus(data) { this.api.getControlGetState(data).then(res => { if (res.data.code == 200) { - this.sunrise = this.convertToTimeMinutes(res.data.data['1021']) - this.sunset = this.convertToTimeMinutes(res.data.data['1022']) + this.sunrise = this.insertColonEveryTwoDigits(this.convertToTimeMinutes(res.data.data['1021'])) + this.sunset = this.insertColonEveryTwoDigits(this.convertToTimeMinutes(res.data.data['1022'])) } }) }, //16进制转为时间 16位无符号高字节是时,低字节是分 convertToTimeMinutes(hexValue) { - // 将 16 进制字符串转换为 16 进制数值 - const intValue = hexValue + // 将十进制数转换为16进制字符串 + let hexString = hexValue.toString(16); - // 提取高字节(小时)和低字节(分钟) - const hours = (intValue >> 8) & 0xFF; - const minutes = intValue & 0xFF; +// 补零,确保结果是4位16进制数 +while (hexString.length < 4) { + hexString = '0' + hexString; +} - // 格式化为时:分的字符串 - const formattedTime = `${String(hours).padStart(2, '0')}:${String(minutes).padStart(2, '0')}`; - - return formattedTime; +return hexString; + + }, + insertColonEveryTwoDigits(inputString) { + // 使用正则表达式将字符串每两位切割 + const chunks = inputString.match(/.{1,2}/g); + return chunks.join(':') + // 使用join方法将切割后的数组元素用冒号连接起来 }, dataInit() { var store = this.$store.state diff --git a/src/views/wufang/uptake.vue b/src/views/wufang/uptake.vue index 21a029a..ff3ace9 100644 --- a/src/views/wufang/uptake.vue +++ b/src/views/wufang/uptake.vue @@ -56,7 +56,7 @@
- 大风保护 + 大风保护有效
@@ -87,13 +87,13 @@
-
展开的输出通道
+
打开的通道
-
收拢的输出通道
+
关闭的通道
diff --git a/src/views/wufang/waterPump.vue b/src/views/wufang/waterPump.vue index ff103ed..e964a2e 100644 --- a/src/views/wufang/waterPump.vue +++ b/src/views/wufang/waterPump.vue @@ -44,7 +44,7 @@ 室内1#平均温度夜间时段高于 - ℃启动 + 停止