From b99a6ba4721b1125a70e596aee397aea65f87ead Mon Sep 17 00:00:00 2001 From: qingzhengli <1204552371@qq.com> Date: Tue, 19 Mar 2024 23:30:04 +0800 Subject: [PATCH] =?UTF-8?q?fix=20bug=20=20=E6=91=84=E5=83=8F=E5=A4=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/views/JiHeExpressway/components/Video/Video.vue | 4 ++-- .../views/JiHeExpressway/components/Video/videoStream.js | 7 ++++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/ruoyi-ui/src/views/JiHeExpressway/components/Video/Video.vue b/ruoyi-ui/src/views/JiHeExpressway/components/Video/Video.vue index d0682c76..9e02ecdd 100644 --- a/ruoyi-ui/src/views/JiHeExpressway/components/Video/Video.vue +++ b/ruoyi-ui/src/views/JiHeExpressway/components/Video/Video.vue @@ -40,8 +40,8 @@ export default { camId: { handler(newV) { this.playVideo(); - }, - immediate: true + } + // immediate: true } }, async mounted() { diff --git a/ruoyi-ui/src/views/JiHeExpressway/components/Video/videoStream.js b/ruoyi-ui/src/views/JiHeExpressway/components/Video/videoStream.js index 0a8cff9a..4aecfbf3 100644 --- a/ruoyi-ui/src/views/JiHeExpressway/components/Video/videoStream.js +++ b/ruoyi-ui/src/views/JiHeExpressway/components/Video/videoStream.js @@ -74,11 +74,16 @@ async function getUrl({ camId, url, pileNum, rangeIndex } = {}) { } code = cameraData.code; data = cameraData.data; - if (code != 200 || !data?.length) { + // console.log(rangeIndex, "rangeIndex", cameraData); + if ( + code != 200 || + (Array.isArray(data) ? !data?.length : !Object.keys(data || {}).length) + ) { Message.warning("未获取到附近的相机信息"); return; } camId = data[rangeIndex || 0]?.camId; + console.log(rangeIndex, "rangeIndex", data, data[rangeIndex], cameraData); } if (camId) {