From dba0e6e7561bbd8ed8e55c7db8a88fee70bc6cdb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B4=9B=E6=B4=9B=E5=B8=8C=E9=9B=85?= Date: Sat, 11 May 2024 13:57:19 +0800 Subject: [PATCH] =?UTF-8?q?=E5=86=B7=E5=8D=B4=E6=97=B6=E9=97=B4=E8=BF=9B?= =?UTF-8?q?=E5=BA=A6=E6=9D=A1=E5=8F=8A=E5=BE=AA=E7=8E=AF=E6=92=AD=E6=94=BE?= =?UTF-8?q?=E6=8E=A7=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/store/mqtt.ts | 3 ++- src/views/mqtt/index.vue | 52 ++++++++++++++++++++++++++++------------ 2 files changed, 39 insertions(+), 16 deletions(-) diff --git a/src/store/mqtt.ts b/src/store/mqtt.ts index edbeed7..6b044da 100644 --- a/src/store/mqtt.ts +++ b/src/store/mqtt.ts @@ -10,7 +10,8 @@ export const useMqttStore = defineStore('mqtt', { clientId: 'R328328', forceRawTime: false, normalizedTime: false, - coolDownTime: 0 + coolDownTime: 0, + loopPlayback: true } }, persist: { diff --git a/src/views/mqtt/index.vue b/src/views/mqtt/index.vue index 7ce0f7a..8048881 100644 --- a/src/views/mqtt/index.vue +++ b/src/views/mqtt/index.vue @@ -18,9 +18,10 @@ const url = $toRef(mqttStore, 'url') const username = $toRef(mqttStore, 'username') const password = $toRef(mqttStore, 'password') const clientId = $toRef(mqttStore, 'clientId') -let forceRawTime = $toRef(mqttStore, 'forceRawTime') -let normalizedTime = $toRef(mqttStore, 'normalizedTime') -let coolDownTime = $toRef(mqttStore, 'coolDownTime') +const forceRawTime = $toRef(mqttStore, 'forceRawTime') +const normalizedTime = $toRef(mqttStore, 'normalizedTime') +const coolDownTime = $toRef(mqttStore, 'coolDownTime') +const loopPlayback = $toRef(mqttStore, 'loopPlayback') let loading = $ref(false) const dataLib = reactive(dataLib0) @@ -137,6 +138,13 @@ async function doPublish() { publish.rawTime = true // 发送数据的定时器 const interval = setInterval(() => { + // 判断取消循环播放 + if (!loopPlayback) { + if (publish.index == list.length - 1) { + jobCancel.value?.() + return + } + } // 判断定时器被关闭 if (exit) { clearInterval(interval) @@ -310,15 +318,17 @@ watch( 暂停 继续 - - 原始时间模式:开 - - 原始时间模式:关 - - 时间归一化:开 - - 时间归一化:关 -
+ + 原始时间模式:开 + 原始时间模式:关 + + 时间归一化:开 + + 时间归一化:关 + 自动重播:开 + 自动重播:关 + +
@@ -378,8 +388,20 @@ watch(
-
发送进度:{{ publish.percentage }}%
- + +