diff --git a/ruoyi-ui/src/views/JiHeExpressway/components/Video/Video.vue b/ruoyi-ui/src/views/JiHeExpressway/components/Video/Video.vue index 24faf33c..ec28d997 100644 --- a/ruoyi-ui/src/views/JiHeExpressway/components/Video/Video.vue +++ b/ruoyi-ui/src/views/JiHeExpressway/components/Video/Video.vue @@ -28,19 +28,18 @@ export default { default: 'flv' }, rangeIndex: { - type: Number, default: 0 } }, async mounted() { // setTimeout(() => { // this.$nextTick(() => { - if (this.videoType == 'flv') { - // const player = await openLiveVideo(this.$refs.videoContainerRef, { camId: this.camId, url: this.url, pileNum: this.pileNum }) - const player = new HttpLivePlayer(this.$refs.videoContainerRef, { camId: this.camId, url: this.url, pileNum: this.pileNum, rangeIndex: this.rangeIndex }); + if (this.videoType == 'flv') { + // const player = await openLiveVideo(this.$refs.videoContainerRef, { camId: this.camId, url: this.url, pileNum: this.pileNum }) + const player = new HttpLivePlayer(this.$refs.videoContainerRef, { camId: this.camId, url: this.url, pileNum: this.pileNum, rangeIndex: this.rangeIndex }); - this.$once("hook:beforeDestroy", () => player?.destroy()); - } + this.$once("hook:beforeDestroy", () => player?.destroy()); + } // }) // }) diff --git a/ruoyi-ui/src/views/JiHeExpressway/components/Video/videoStream.js b/ruoyi-ui/src/views/JiHeExpressway/components/Video/videoStream.js index f97c7f7b..0a8cff9a 100644 --- a/ruoyi-ui/src/views/JiHeExpressway/components/Video/videoStream.js +++ b/ruoyi-ui/src/views/JiHeExpressway/components/Video/videoStream.js @@ -5,6 +5,7 @@ import { Message } from "element-ui"; import { getCameraStream, getNearCamera, + getNearCameraNew, } from "@screen/pages/Home/components/RoadAndEvents/utils/httpList.js"; /** @@ -63,12 +64,20 @@ async function getUrl({ camId, url, pileNum, rangeIndex } = {}) { if (url) return url; if (pileNum) { - const { code, data } = await getNearCamera(pileNum).catch(() => ({})); + let code, data, cameraData; + if (rangeIndex) { + if (typeof rangeIndex === "string") + cameraData = await getNearCameraNew(pileNum).catch(() => ({})); + else cameraData = await getNearCamera(pileNum).catch(() => ({})); + } else { + cameraData = await getNearCamera(pileNum).catch(() => ({})); + } + code = cameraData.code; + data = cameraData.data; if (code != 200 || !data?.length) { Message.warning("未获取到附近的相机信息"); return; } - camId = data[rangeIndex || 0]?.camId; } diff --git a/ruoyi-ui/src/views/JiHeExpressway/pages/Home/components/Dialogs/TrafficIncidents/index.vue b/ruoyi-ui/src/views/JiHeExpressway/pages/Home/components/Dialogs/TrafficIncidents/index.vue index f30b7d55..204beeb6 100644 --- a/ruoyi-ui/src/views/JiHeExpressway/pages/Home/components/Dialogs/TrafficIncidents/index.vue +++ b/ruoyi-ui/src/views/JiHeExpressway/pages/Home/components/Dialogs/TrafficIncidents/index.vue @@ -2,8 +2,8 @@
-
diff --git a/ruoyi-ui/src/views/JiHeExpressway/pages/Home/components/RoadAndEvents/utils/httpList.js b/ruoyi-ui/src/views/JiHeExpressway/pages/Home/components/RoadAndEvents/utils/httpList.js index 78032945..736c5e7b 100644 --- a/ruoyi-ui/src/views/JiHeExpressway/pages/Home/components/RoadAndEvents/utils/httpList.js +++ b/ruoyi-ui/src/views/JiHeExpressway/pages/Home/components/RoadAndEvents/utils/httpList.js @@ -41,6 +41,16 @@ export function getNearCamera(pileNum) { }); } +export function getNearCameraNew(pileNum) { + return request({ + url: "/video/nearCamPileNum", + method: "get", + params: { + pileNum, + }, + }); +} + function padZero(num) { num = num.toString(); while (num.length < 3) {