Browse Source

feat 增加摄像头控制模块

wangqin
qingzhengli 7 months ago
parent
commit
325d9a376d
  1. 35
      ruoyi-ui/src/views/JiHeExpressway/components/VideoMulti/index.vue

35
ruoyi-ui/src/views/JiHeExpressway/components/VideoMulti/index.vue

@ -1,28 +1,38 @@
<template> <template>
<div class="video-container"> <div class="video-container">
<div class="header"> <div class="header">
<ElSelect @change="showVideo" v-model="cameraId"> <ElSelect @change="cameraChange" v-model="cameraId">
<ElOption v-for="item in urls" <ElOption v-for="item in urls" :key="item.id" :label="item.deviceName" :value="item.iotDeviceId">
:key="item.id" :label="item.deviceName" :value="item.iotDeviceId">
</ElOption> </ElOption>
</ElSelect> </ElSelect>
<img @click="controlDialogVisible = true" v-if="[0, '0'].includes(
dialogData.parseOtherConfig &&
dialogData.parseOtherConfig.ptzCtrl
)
" src="@screen/images/camera-control-icon.svg" width="18px" height="18px"
style="cursor: pointer;background-color: #0d5f79;" />
</div> </div>
<Transition name="fade" mode="out-in"> <Transition name="fade" mode="out-in">
<video controls autoplay muted class="video-stream" v-bind="$attrs" ref="videoContainerRef" /> <video controls autoplay muted class="video-stream" v-bind="$attrs" ref="videoContainerRef" />
</Transition> </Transition>
<CameraControlDialog :deviceId="dialogData.iotDeviceId" :dialogData="dialogData" v-model="controlDialogVisible" />
</div> </div>
</template> </template>
<script> <script>
import { HttpLivePlayer, openLiveVideo } from "./videoStream.js" import { HttpLivePlayer, openLiveVideo } from "./videoStream.js"
import { find } from "lodash"
import { import {
getNearCameraNew, getNearCameraNew,
} from "@screen/pages/Home/components/RoadAndEvents/utils/httpList.js"; } from "@screen/pages/Home/components/RoadAndEvents/utils/httpList.js";
import CameraControlDialog from "@screen/pages/Home/components/Dialogs/Camera/components/CameraControlDialog.vue";
export default { export default {
name: 'VideoControls', name: 'VideoControls',
components: { components: {
CameraControlDialog,
}, },
props: { props: {
// //
@ -44,7 +54,9 @@ export default {
active: "video", active: "video",
player: null, player: null,
urls: [], urls: [],
cameraId: null cameraId: null,
controlDialogVisible: false,
dialogData: {},
} }
}, },
async mounted() { async mounted() {
@ -52,7 +64,12 @@ export default {
this.$once("hook:beforeDestroy", () => this.player?.destroy()); this.$once("hook:beforeDestroy", () => this.player?.destroy());
}, },
methods: { methods: {
cameraChange() {
const changeItem = find(this.urls, { iotDeviceId: this.cameraId });
this.dialogData = { ...changeItem, parseOtherConfig: changeItem.otherConfig && JSON.parse(changeItem.otherConfig) };
console.log(this.cameraId, this.dialogData)
this.showVideo();
},
async playVideo() { async playVideo() {
this.player?.destroy(); this.player?.destroy();
@ -66,7 +83,10 @@ export default {
} }
if (data[this.rangeIndex]) { if (data[this.rangeIndex]) {
this.urls = data[this.rangeIndex] this.urls = data[this.rangeIndex]
this.cameraId = data[this.rangeIndex][0]['iotDeviceId'] console.log(data[this.rangeIndex][0], this.rangeIndex, 'xxxx');
const firstItem = data[this.rangeIndex]?.[0] || {};
this.cameraId = firstItem['iotDeviceId'];
this.dialogData = { ...firstItem, parseOtherConfig: firstItem.otherConfig && JSON.parse(firstItem.otherConfig) }
this.showVideo(); this.showVideo();
} }
}, },
@ -102,6 +122,7 @@ export default {
z-index: 999; z-index: 999;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
.radio { .radio {
background: #265A70; background: #265A70;
border-radius: 41px 41px 41px 41px; border-radius: 41px 41px 41px 41px;

Loading…
Cancel
Save