feat:对接监控大屏
This commit is contained in:
@@ -1,120 +1,224 @@
|
||||
<template>
|
||||
<div class="video-box">
|
||||
<div class="flex video-one-1" v-if="videoLog == 1">
|
||||
<div v-if="videoLog == 1" class="video-wrapper">
|
||||
<div class="video-list">
|
||||
<div
|
||||
@click="handleItemVideo"
|
||||
class="v-item"
|
||||
:class="index == 0 ? 'v-error-bg' : ''"
|
||||
v-for="(item, index) in 15"
|
||||
class="video-item"
|
||||
v-for="(item, index) in videoList"
|
||||
:key="index"
|
||||
@click="handleItemVideo(item.hlsUrl, item.cameraName, item.updateTime)"
|
||||
>
|
||||
<vue3VideoPlay v-bind="options" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="video-live flex" v-if="videoLog == 2">
|
||||
<div class="video-lt v-error-bg">
|
||||
<div class="desc">核心路段:这是一条信息说明</div>
|
||||
<vue3VideoPlay v-bind="options" />
|
||||
</div>
|
||||
<div class="video-rt">
|
||||
<div class="title">
|
||||
<span>最近联系</span>
|
||||
</div>
|
||||
<div class="rt-v-box">
|
||||
<div class="rt-video v-error-bg" v-for="item in 8">
|
||||
<div class="desc">核心路段:这是一条信息说明</div>
|
||||
<vue3VideoPlay v-bind="options" />
|
||||
</div>
|
||||
<div class="video-item__inner">
|
||||
<video
|
||||
class="video-item__video"
|
||||
:id="'monitorVideo' + index"
|
||||
muted
|
||||
autoplay
|
||||
:controls="false"
|
||||
style="object-fit: cover"
|
||||
>
|
||||
<source src="" type="application/x-mpegURL" />
|
||||
</video>
|
||||
<p class="video-item__title--primary">
|
||||
{{ item.cameraName }}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="video-detail" v-if="videoLog == 2">
|
||||
<div class="video-detail__wrapper v-error-bg">
|
||||
<div class="video-detail__title">
|
||||
<span>{{ videoTitle }}</span>
|
||||
<span>{{ videoUpdateTime }}</span>
|
||||
</div>
|
||||
<video
|
||||
class="video-detail__video"
|
||||
ref="videoRef"
|
||||
muted
|
||||
autoplay
|
||||
controls
|
||||
style="object-fit: cover"
|
||||
>
|
||||
<source src="" type="application/x-mpegURL" />
|
||||
</video>
|
||||
</div>
|
||||
<!-- <div class="video-rt">
|
||||
<div class="title">
|
||||
<span>最近联系</span>
|
||||
</div>
|
||||
<div class="rt-v-box">
|
||||
<div class="rt-video v-error-bg" v-for="item in 8">
|
||||
<div class="desc">核心路段:这是一条信息说明</div>
|
||||
</div>
|
||||
</div>
|
||||
</div> -->
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { fitChartSize } from '@/utils/dataUtil'
|
||||
const options = reactive({
|
||||
src: 'http://192.168.1.60:8080/live/340200000013200000011_34020000001320000001/hls.m3u8', //视频源
|
||||
type: 'm3u8', //视频类型
|
||||
width: '100%',
|
||||
height: '100%',
|
||||
color: '#409eff', //主题色
|
||||
title: '', //视频名称
|
||||
muted: false, //静音
|
||||
webFullScreen: false,
|
||||
speedRate: ['0.75', '1.0', '1.25', '1.5', '2.0'], //播放倍速
|
||||
autoPlay: true, //自动播放
|
||||
loop: false, //循环播放
|
||||
mirror: false, //镜像画面
|
||||
ligthOff: false, //关灯模式
|
||||
volume: 0.3, //默认音量大小
|
||||
control: true, //是否显示控制
|
||||
controlBtns: [
|
||||
// "audioTrack",
|
||||
// "quality",
|
||||
// "speedRate",
|
||||
// "volume",
|
||||
'setting',
|
||||
'pip',
|
||||
'pageFullScreen',
|
||||
'fullScreen'
|
||||
] //显示所有按钮,
|
||||
import { postRefreshApi } from '@/api/home'
|
||||
import Hls from 'hls.js'
|
||||
|
||||
let props = defineProps({
|
||||
list: {
|
||||
type: Array,
|
||||
default: () => []
|
||||
}
|
||||
})
|
||||
const videoLog = ref(1)
|
||||
const handleItemVideo = () => {
|
||||
console.log('单击视频')
|
||||
|
||||
const videoList = ref([])
|
||||
|
||||
watch(
|
||||
() => props.list,
|
||||
(val) => {
|
||||
videoList.value = val
|
||||
nextTick(() => {
|
||||
videoList.value.forEach(async (item, index) => {
|
||||
const video = document.getElementById(`monitorVideo${index}`)
|
||||
let res = await postRefreshApi({
|
||||
type: 'hls',
|
||||
businessVideoDisplayPosition: item.businessVideoDisplayPosition,
|
||||
cameraIndexCode: item.cameraIndexCode
|
||||
})
|
||||
item.hlsUrl = res.data.hlsUrl
|
||||
const hls = new Hls()
|
||||
hls.loadSource(res.data.hlsUrl)
|
||||
hls.attachMedia(video)
|
||||
hls.on(Hls.Events.MANIFEST_PARSED, () => {
|
||||
video.play()
|
||||
})
|
||||
})
|
||||
})
|
||||
},
|
||||
{ immediate: true }
|
||||
)
|
||||
|
||||
let videoLog = ref(1)
|
||||
let videoRef = ref()
|
||||
let videoTitle = ref('')
|
||||
let videoUpdateTime = ref('')
|
||||
|
||||
const handleItemVideo = (url, title, time) => {
|
||||
videoLog.value = 2
|
||||
videoTitle.value = title
|
||||
videoUpdateTime.value = time
|
||||
nextTick(() => {
|
||||
const hls = new Hls()
|
||||
console.log(url, '111')
|
||||
console.log(videoRef.value, '222')
|
||||
|
||||
hls.loadSource(url)
|
||||
hls.attachMedia(videoRef.value)
|
||||
hls.on(Hls.Events.MANIFEST_PARSED, () => {
|
||||
videoRef.value.play()
|
||||
})
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.video-box {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
.video-one-1 {
|
||||
.video {
|
||||
&-wrapper {
|
||||
width: 100%;
|
||||
height: vh(960);
|
||||
padding: vh(30) vw(20);
|
||||
background-image: url('/src/assets/images/log-v-bg.png');
|
||||
background-size: 100% 100%;
|
||||
}
|
||||
&-list {
|
||||
overflow-y: auto;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
gap: vw(8);
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
padding-top: 0;
|
||||
padding: vh(30) vw(20);
|
||||
margin-left: vw(20);
|
||||
align-content: flex-start;
|
||||
|
||||
&::-webkit-scrollbar {
|
||||
width: vw(4); /* 滚动条的宽度 */
|
||||
}
|
||||
/* 滚动条轨道 */
|
||||
&::-webkit-scrollbar-track {
|
||||
background: 'transparent'; /* 轨道的背景色 */
|
||||
}
|
||||
/* 滚动条滑块 */
|
||||
&::-webkit-scrollbar-thumb {
|
||||
background: rgba(0, 150, 255, 0.63); /* 滑块的背景色 */
|
||||
border-radius: 5px; /* 滑块的圆角 */
|
||||
}
|
||||
}
|
||||
&-item {
|
||||
width: vw(404);
|
||||
height: vh(300);
|
||||
padding: vw(10);
|
||||
background-image: url('/src/assets/images/item-primary.png');
|
||||
background-size: 100% 100%;
|
||||
&:nth-child(5n) {
|
||||
margin-right: 0;
|
||||
}
|
||||
}
|
||||
&-item__inner {
|
||||
position: relative;
|
||||
}
|
||||
&-item__title {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
padding: vh(10) vw(10);
|
||||
color: #fff;
|
||||
font-size: vw(14);
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
z-index: 999;
|
||||
}
|
||||
&-item__title--error {
|
||||
@extend .video-item__title;
|
||||
background-color: rgba(226, 27, 27, 0.72);
|
||||
}
|
||||
&-item__title--primary {
|
||||
@extend .video-item__title;
|
||||
background-color: rgba(4, 30, 69, 0.72);
|
||||
}
|
||||
&-item__video {
|
||||
width: 100%;
|
||||
height: vh(286);
|
||||
}
|
||||
|
||||
&-detail {
|
||||
margin-left: vw(10);
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
}
|
||||
&-detail__wrapper {
|
||||
position: relative;
|
||||
padding: vh(40) vw(50);
|
||||
width: vw(1666);
|
||||
height: vh(950);
|
||||
background-image: url('/src/assets/images/one-video-bg.png');
|
||||
background-size: 100% 100%;
|
||||
}
|
||||
&-detail__title {
|
||||
position: absolute;
|
||||
left: vw(50);
|
||||
right: vw(50);
|
||||
top: 40 (vh);
|
||||
z-index: 9;
|
||||
font-weight: 400;
|
||||
font-size: vw(14);
|
||||
color: #ffffff;
|
||||
padding: vw(20);
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
background: rgba(4, 30, 69, 0.5);
|
||||
}
|
||||
&-detail__video {
|
||||
width: 100%;
|
||||
height: vh(880);
|
||||
}
|
||||
.video-live {
|
||||
justify-content: space-between;
|
||||
margin-left: vw(10);
|
||||
.video-lt {
|
||||
width: vw(1666);
|
||||
height: vh(950);
|
||||
background-image: url('/src/assets/images/one-video-bg.png');
|
||||
background-size: 100% 100%;
|
||||
padding: vh(40) vw(50);
|
||||
position: relative;
|
||||
.desc {
|
||||
position: absolute;
|
||||
// width:100%;
|
||||
left: vw(50);
|
||||
right: vw(50);
|
||||
top: 40 (vh);
|
||||
z-index: 9;
|
||||
background: rgba(4, 30, 69, 0.5);
|
||||
border-radius: 0px 0px 0px 0px;
|
||||
text-align: center;
|
||||
font-weight: 400;
|
||||
font-size: vw(14);
|
||||
color: #ffffff;
|
||||
padding: vw(20);
|
||||
text-align: left;
|
||||
font-style: normal;
|
||||
text-transform: none;
|
||||
}
|
||||
}
|
||||
.v-error-bg {
|
||||
// background-image: url('/src/assets/images/v-item-bg-1.png');
|
||||
// background-size: 100% 100%;
|
||||
.desc {
|
||||
background: rgba(226, 27, 27, 0.5);
|
||||
}
|
||||
}
|
||||
.video-rt {
|
||||
width: vw(400);
|
||||
height: vh(950);
|
||||
@@ -204,18 +308,5 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
.v-item {
|
||||
width: vw(400);
|
||||
height: vh(300);
|
||||
background-image: url('/src/assets/images/v-item-bg.png');
|
||||
background-size: 100% 100%;
|
||||
padding: vw(20);
|
||||
margin-right: vw(4);
|
||||
margin-bottom: vh(4);
|
||||
}
|
||||
.v-error-bg {
|
||||
background-image: url('/src/assets/images/v-item-bg-1.png');
|
||||
background-size: 100% 100%;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user