feat:修改视频列表为6个

This commit is contained in:
zjc
2025-01-23 11:19:47 +08:00
parent 4d2f693bf5
commit fd726ead46

View File

@@ -142,7 +142,7 @@
let loading = ref(false) let loading = ref(false)
let params = reactive({ let params = reactive({
pageNum: 1, pageNum: 1,
pageSize: 16, pageSize: 7,
businessScenicArea: '', businessScenicArea: '',
businessVideoDisplayPosition: '' businessVideoDisplayPosition: ''
}) })
@@ -215,39 +215,46 @@
videoSrc.value = res.data.url videoSrc.value = res.data.url
} }
const getVideoList = async () => { const getVideoList = async () => {
params.businessVideoDisplayPosition = navList.value[current.value].dictValue try {
let res = await getVideoListApi(params) if (loading.value) return
if (res.data.length > 0) { loading.value = true
let list = res.data params.businessVideoDisplayPosition = navList.value[current.value].dictValue
list.forEach(async (i) => { let res = await getVideoListApi(params)
let res = await postRefreshApi({ if (res.data.length > 0) {
type: 'hls', let list = res.data
businessVideoDisplayPosition: i.businessVideoDisplayPosition, list.forEach(async (i) => {
cameraIndexCode: i.cameraIndexCode let res = await postRefreshApi({
}) type: 'hls',
return { businessVideoDisplayPosition: i.businessVideoDisplayPosition,
...i, cameraIndexCode: i.cameraIndexCode
hlsUrl: res.data.hlsUrl
}
})
videoList.value = [...videoList.value, ...res.data]
params.pageNum++
// postVideoRemain()
nextTick(() => {
videoList.value.forEach(async (x, index) => {
const video = document.getElementById(`monitorVideo${index}`)
const hls = new Hls({
maxBufferLength: 10, // 最大缓冲长度(秒)
maxMaxBufferLength: 15, // 缓冲区长度的上限
maxBufferSize: 30 * 1000 * 1000 // 最大缓冲大小(字节)
}) })
hls.loadSource(x.hlsUrl) return {
hls.attachMedia(video) ...i,
hls.on(Hls.Events.MANIFEST_PARSED, () => { hlsUrl: res.data.hlsUrl
video.play() }
})
videoList.value = [...videoList.value, ...res.data]
params.pageNum++
// postVideoRemain()
nextTick(() => {
videoList.value.forEach(async (x, index) => {
const video = document.getElementById(`monitorVideo${index}`)
const hls = new Hls({
maxBufferLength: 10, // 最大缓冲长度(秒)
maxMaxBufferLength: 15, // 缓冲区长度的上限
maxBufferSize: 30 * 1000 * 1000 // 最大缓冲大小(字节)
})
hls.loadSource(x.hlsUrl)
hls.attachMedia(video)
hls.on(Hls.Events.MANIFEST_PARSED, () => {
video.play()
})
}) })
}) })
}) }
loading.value = false
} catch (error) {
loading.value = false
} }
} }
const getVideoType = async (id) => { const getVideoType = async (id) => {
@@ -263,17 +270,10 @@
} }
} }
const getVideoRegions = async () => { const getVideoRegions = async () => {
if (loading.value) return let res = await getVideoRegionsApi({
loading.value = true businessScenicArea: params.businessScenicArea
try { })
let res = await getVideoRegionsApi({ regionList.value = res.data
businessScenicArea: params.businessScenicArea
})
regionList.value = res.data
loading.value = false
} catch (error) {
loading.value = false
}
} }
const onMonitorChange = () => { const onMonitorChange = () => {
monitorChange = PubSub.subscribe('monitorChange', (res, data) => { monitorChange = PubSub.subscribe('monitorChange', (res, data) => {
@@ -486,12 +486,12 @@
} }
} }
&-item { &-item {
width: vw(406); width: vw(686);
height: vh(300); height: vh(460);
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%;
&:nth-child(5n) { &:nth-child(3n) {
margin-right: 0; margin-right: 0;
} }
} }
@@ -521,7 +521,7 @@
} }
&-item__video { &-item__video {
width: 100%; width: 100%;
height: vh(286); height: vh(446);
} }
&-detail { &-detail {