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 }}%
- + +