From 0c34c90a74548a6ac5d67c3ea3bb17ab03133404 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B4=9B=E6=B4=9B=E5=B8=8C=E9=9B=85?= Date: Wed, 8 May 2024 15:34:15 +0800 Subject: [PATCH] =?UTF-8?q?=E6=97=B6=E9=97=B4=E5=81=8F=E7=A7=BB=E6=8C=89?= =?UTF-8?q?=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/theme/base/element-plus/button.scss | 12 +++++++++++ src/views/mqtt/index.vue | 28 ++++++++++++++++++------- 2 files changed, 33 insertions(+), 7 deletions(-) diff --git a/src/theme/base/element-plus/button.scss b/src/theme/base/element-plus/button.scss index af0da39..37a4d3f 100644 --- a/src/theme/base/element-plus/button.scss +++ b/src/theme/base/element-plus/button.scss @@ -119,4 +119,16 @@ html.base-theme { .el-button + .el-button { margin-left: 12px; } + + .el-button-group > .el-button + .el-button{ + margin-left: unset; + } + + .el-button +.el-button-group { + margin-left: 12px; + } + + .el-button-group +.el-button-group { + margin-left: 12px; + } } diff --git a/src/views/mqtt/index.vue b/src/views/mqtt/index.vue index ff75ab0..8d9bfb0 100644 --- a/src/views/mqtt/index.vue +++ b/src/views/mqtt/index.vue @@ -85,11 +85,11 @@ async function doPublish() { const list = jsonModule publish.index = 0 function next() { - if (!publish.pause) { + if (!publish.pause || (publish.pause && publish.timeTicking < 0)) { publish.index += publish.timeTicking - if (publish.index >= list.length) publish.index = 0 - else if (publish.index < 0) publish.index = list.length - 1 } + if (publish.index >= list.length) publish.index = 0 + else if (publish.index < 0) publish.index = list.length - 1 return list[publish.index] } @@ -115,13 +115,13 @@ async function doPublish() { let item = next() // 判断下有没有内容,防止空指针 - if (item[0]?.content[0]) { + if (item[0]?.content?.[0]) { // 设置时间 publish.lastRawTimestamp = item[0].content[0].timeStamp // 处理暂停等操作对时间的影响 if (!publish.rawTime) { - if (publish.pause) publish.timeOffset += 100 - else if (publish.timeTicking < 0) publish.timeOffset += 200 + if (publish.timeTicking < 0) publish.timeOffset += 200 + else if (publish.pause) publish.timeOffset += 100 const offset = publish.timeOffset publish.lastTimestamp = publish.lastRawTimestamp + publish.timeOffset // 由于时间发生变化,对所有车辆的时间进行替换 @@ -154,6 +154,12 @@ function reverse() { publish.timeTicking = -1 publish.rawTime = false } + +function move(tick: number) { + publish.rawTime = false + publish.index += tick + publish.timeOffset -= tick * 100 +}