feat:视频列表现在分页操作
This commit is contained in:
@@ -53,18 +53,12 @@
|
|||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
list.value.forEach(async (item, index) => {
|
list.value.forEach(async (item, index) => {
|
||||||
var video = document.getElementById(`video${index}`)
|
var video = document.getElementById(`video${index}`)
|
||||||
let res1 = await postRefreshApi({
|
|
||||||
type: 'hls',
|
|
||||||
businessVideoDisplayPosition: item.businessVideoDisplayPosition,
|
|
||||||
cameraIndexCode: item.cameraIndexCode
|
|
||||||
})
|
|
||||||
item.hlsUrl = res1.data.hlsUrl
|
|
||||||
const hls = new Hls({
|
const hls = new Hls({
|
||||||
maxBufferLength: 10, // 最大缓冲长度(秒)
|
maxBufferLength: 10, // 最大缓冲长度(秒)
|
||||||
maxMaxBufferLength: 15, // 缓冲区长度的上限
|
maxMaxBufferLength: 15, // 缓冲区长度的上限
|
||||||
maxBufferSize: 20 * 1000 * 1000 // 最大缓冲大小(字节)
|
maxBufferSize: 20 * 1000 * 1000 // 最大缓冲大小(字节)
|
||||||
})
|
})
|
||||||
hls.loadSource(res1.data.hlsUrl)
|
hls.loadSource(item.hlsUrl)
|
||||||
hls.attachMedia(video)
|
hls.attachMedia(video)
|
||||||
hls.on(Hls.Events.MANIFEST_PARSED, () => {
|
hls.on(Hls.Events.MANIFEST_PARSED, () => {
|
||||||
video.play()
|
video.play()
|
||||||
|
|||||||
@@ -9,11 +9,9 @@
|
|||||||
:key="index"
|
:key="index"
|
||||||
@click="handleNav(index)"
|
@click="handleNav(index)"
|
||||||
>
|
>
|
||||||
<span v-if="!params.businessScenicArea && index==0">
|
<span v-if="!params.businessScenicArea && index == 0"> 核心路段 </span>
|
||||||
核心路段
|
|
||||||
</span>
|
|
||||||
<span v-else>
|
<span v-else>
|
||||||
{{ item.dictLabel }}
|
{{ item.dictLabel }}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -45,12 +43,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-if="videoLog == 1" class="video-wrapper">
|
<div v-if="videoLog == 1" class="video-wrapper">
|
||||||
<div
|
<div class="video-list">
|
||||||
class="video-list"
|
|
||||||
v-infinite-scroll="getVideoList"
|
|
||||||
:infinite-scroll-immediate="false"
|
|
||||||
:infinite-scroll-distance="50"
|
|
||||||
>
|
|
||||||
<div
|
<div
|
||||||
class="video-item"
|
class="video-item"
|
||||||
v-for="(item, index) in videoList"
|
v-for="(item, index) in videoList"
|
||||||
@@ -74,6 +67,16 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="pagination">
|
||||||
|
<el-pagination
|
||||||
|
v-model:current-page="params.pageNum"
|
||||||
|
background
|
||||||
|
hide-on-single-page
|
||||||
|
:total="total"
|
||||||
|
layout="prev, pager, next"
|
||||||
|
@current-change="currentChange"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-if="videoLog == 2" class="video-detail">
|
<div v-if="videoLog == 2" class="video-detail">
|
||||||
@@ -145,9 +148,10 @@
|
|||||||
let videoSrc = ref('')
|
let videoSrc = ref('')
|
||||||
let show = ref(false)
|
let show = ref(false)
|
||||||
let loading = ref(false)
|
let loading = ref(false)
|
||||||
|
let total = ref(0)
|
||||||
let params = reactive({
|
let params = reactive({
|
||||||
pageNum: 1,
|
pageNum: 1,
|
||||||
pageSize: 7,
|
pageSize: 6,
|
||||||
businessScenicArea: '',
|
businessScenicArea: '',
|
||||||
businessVideoDisplayPosition: ''
|
businessVideoDisplayPosition: ''
|
||||||
})
|
})
|
||||||
@@ -164,18 +168,12 @@
|
|||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
videoList.value.forEach(async (item, index) => {
|
videoList.value.forEach(async (item, index) => {
|
||||||
const video = document.getElementById(`monitorVideo${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({
|
const hls = new Hls({
|
||||||
maxBufferLength: 10, // 最大缓冲长度(秒)
|
maxBufferLength: 10, // 最大缓冲长度(秒)
|
||||||
maxMaxBufferLength: 15, // 缓冲区长度的上限
|
maxMaxBufferLength: 15, // 缓冲区长度的上限
|
||||||
maxBufferSize: 30 * 1000 * 1000 // 最大缓冲大小(字节)
|
maxBufferSize: 30 * 1000 * 1000 // 最大缓冲大小(字节)
|
||||||
})
|
})
|
||||||
hls.loadSource(res.data.hlsUrl)
|
hls.loadSource(item.hlsUrl)
|
||||||
hls.attachMedia(video)
|
hls.attachMedia(video)
|
||||||
hls.on(Hls.Events.MANIFEST_PARSED, () => {
|
hls.on(Hls.Events.MANIFEST_PARSED, () => {
|
||||||
video.play()
|
video.play()
|
||||||
@@ -183,11 +181,16 @@
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
const currentChange = (e) => {
|
||||||
|
videoList.value = []
|
||||||
|
getVideoList()
|
||||||
|
}
|
||||||
const handleNav = (e) => {
|
const handleNav = (e) => {
|
||||||
if (current.value == e) return
|
if (current.value == e) return
|
||||||
videoLog.value = 1
|
videoLog.value = 1
|
||||||
params.pageNum = 1
|
params.pageNum = 1
|
||||||
videoList.value = []
|
videoList.value = []
|
||||||
|
total.value = 0
|
||||||
current.value = e
|
current.value = e
|
||||||
getVideoList()
|
getVideoList()
|
||||||
}
|
}
|
||||||
@@ -197,7 +200,7 @@
|
|||||||
}
|
}
|
||||||
const handleItemVideo = (url, type) => {
|
const handleItemVideo = (url, type) => {
|
||||||
videoLog.value = 2
|
videoLog.value = 2
|
||||||
nextTick(() => {
|
setTimeout(() => {
|
||||||
const hls = new Hls({
|
const hls = new Hls({
|
||||||
maxBufferLength: 10, // 最大缓冲长度(秒)
|
maxBufferLength: 10, // 最大缓冲长度(秒)
|
||||||
maxMaxBufferLength: 15, // 缓冲区长度的上限
|
maxMaxBufferLength: 15, // 缓冲区长度的上限
|
||||||
@@ -209,7 +212,20 @@
|
|||||||
videoRef.value.play()
|
videoRef.value.play()
|
||||||
})
|
})
|
||||||
if (type == 100) initVideo()
|
if (type == 100) initVideo()
|
||||||
})
|
}, 1000)
|
||||||
|
// nextTick(() => {
|
||||||
|
// const hls = new Hls({
|
||||||
|
// maxBufferLength: 10, // 最大缓冲长度(秒)
|
||||||
|
// maxMaxBufferLength: 15, // 缓冲区长度的上限
|
||||||
|
// maxBufferSize: 30 * 1000 * 1000 // 最大缓冲大小(字节)
|
||||||
|
// })
|
||||||
|
// hls.loadSource(url)
|
||||||
|
// hls.attachMedia(videoRef.value)
|
||||||
|
// hls.on(Hls.Events.MANIFEST_PARSED, () => {
|
||||||
|
// videoRef.value.play()
|
||||||
|
// })
|
||||||
|
// if (type == 100) initVideo()
|
||||||
|
// })
|
||||||
}
|
}
|
||||||
const handleCamera = async (cameraIndexCode) => {
|
const handleCamera = async (cameraIndexCode) => {
|
||||||
show.value = true
|
show.value = true
|
||||||
@@ -225,22 +241,9 @@
|
|||||||
loading.value = true
|
loading.value = true
|
||||||
params.businessVideoDisplayPosition = navList.value[current.value].dictValue
|
params.businessVideoDisplayPosition = navList.value[current.value].dictValue
|
||||||
let res = await getVideoListApi(params)
|
let res = await getVideoListApi(params)
|
||||||
|
total.value = res.total
|
||||||
if (res.data.length > 0) {
|
if (res.data.length > 0) {
|
||||||
let list = res.data
|
videoList.value = res.data
|
||||||
list.forEach(async (i) => {
|
|
||||||
let res = await postRefreshApi({
|
|
||||||
type: 'hls',
|
|
||||||
businessVideoDisplayPosition: i.businessVideoDisplayPosition,
|
|
||||||
cameraIndexCode: i.cameraIndexCode
|
|
||||||
})
|
|
||||||
return {
|
|
||||||
...i,
|
|
||||||
hlsUrl: res.data.hlsUrl
|
|
||||||
}
|
|
||||||
})
|
|
||||||
videoList.value = [...videoList.value, ...res.data]
|
|
||||||
params.pageNum++
|
|
||||||
// postVideoRemain()
|
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
videoList.value.forEach(async (x, index) => {
|
videoList.value.forEach(async (x, index) => {
|
||||||
const video = document.getElementById(`monitorVideo${index}`)
|
const video = document.getElementById(`monitorVideo${index}`)
|
||||||
@@ -275,22 +278,23 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
const getVideoRegions = async () => {
|
const getVideoRegions = async () => {
|
||||||
if(params.businessScenicArea=='三峡之巅'){
|
if (params.businessScenicArea == '三峡之巅') {
|
||||||
regionList.value = [{
|
regionList.value = [
|
||||||
"regions": "调试中",
|
|
||||||
"videoResources": []
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"regions": "调试中",
|
regions: '调试中',
|
||||||
"videoResources": []
|
videoResources: []
|
||||||
}];
|
},
|
||||||
}else{
|
{
|
||||||
|
regions: '调试中',
|
||||||
|
videoResources: []
|
||||||
|
}
|
||||||
|
]
|
||||||
|
} else {
|
||||||
let res = await getVideoRegionsApi({
|
let res = await getVideoRegionsApi({
|
||||||
businessScenicArea: params.businessScenicArea
|
businessScenicArea: params.businessScenicArea
|
||||||
})
|
})
|
||||||
regionList.value = res.data
|
regionList.value = res.data
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
const onMonitorChange = () => {
|
const onMonitorChange = () => {
|
||||||
monitorChange = PubSub.subscribe('monitorChange', (res, data) => {
|
monitorChange = PubSub.subscribe('monitorChange', (res, data) => {
|
||||||
@@ -474,37 +478,29 @@
|
|||||||
|
|
||||||
.video {
|
.video {
|
||||||
&-wrapper {
|
&-wrapper {
|
||||||
|
position: relative;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: vh(960);
|
height: vh(960);
|
||||||
padding: vh(30) vw(20);
|
padding: vh(30) vw(20);
|
||||||
|
box-sizing: border-box;
|
||||||
background-image: url('/src/assets/images/log-v-bg.png');
|
background-image: url('/src/assets/images/log-v-bg.png');
|
||||||
background-size: 100% 100%;
|
background-size: 100% 100%;
|
||||||
|
.pagination {
|
||||||
|
padding: vh(10) vw(30);
|
||||||
|
position: absolute;
|
||||||
|
right: vw(30);
|
||||||
|
bottom: vh(20);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
&-list {
|
&-list {
|
||||||
overflow-y: auto;
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
gap: vw(8);
|
gap: vw(8);
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
align-content: flex-start;
|
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 {
|
&-item {
|
||||||
width: vw(686);
|
width: vw(686);
|
||||||
height: vh(460);
|
height: vh(420);
|
||||||
padding: vw(10);
|
padding: vw(10);
|
||||||
background-image: url('/src/assets/images/item-primary.png');
|
background-image: url('/src/assets/images/item-primary.png');
|
||||||
background-size: 100% 100%;
|
background-size: 100% 100%;
|
||||||
@@ -538,7 +534,7 @@
|
|||||||
}
|
}
|
||||||
&-item__video {
|
&-item__video {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: vh(446);
|
height: vh(406);
|
||||||
}
|
}
|
||||||
|
|
||||||
&-detail {
|
&-detail {
|
||||||
|
|||||||
Reference in New Issue
Block a user