接口更改

This commit is contained in:
duanliang
2025-03-21 18:52:28 +08:00
parent 08041130e8
commit ecc97f2424
4 changed files with 32 additions and 6 deletions

BIN
dist.zip

Binary file not shown.

View File

@@ -36,7 +36,7 @@
</template> </template>
<script setup> <script setup>
import { getVideoListApi } from '@/api/home' import { getVideoListApi,getColletListApi } from '@/api/home'
import { postVideoCollectApi } from '@/api/monitor' import { postVideoCollectApi } from '@/api/monitor'
import primary from '@/assets/images/item-primary.png' import primary from '@/assets/images/item-primary.png'
@@ -101,7 +101,7 @@
getVideoList() getVideoList()
} }
const getVideoList = async () => { const getVideoList = async () => {
let res = await getVideoListApi(params) let res = await getColletListApi(params)
list.value = res.data list.value = res.data
total.value = res.total total.value = res.total
nextTick(() => { nextTick(() => {

View File

@@ -244,7 +244,7 @@
isBack.value = true isBack.value = true
let res = await getSpotListApi() let res = await getSpotListApi()
navLeft.value = res.data navLeft.value = res.data
console.log(res.data,'22220000')
current.value = res.data[0].id current.value = res.data[0].id
title.value = navLeft.value[current.value].name title.value = navLeft.value[current.value].name
pubSub.publish('scenicChange', navLeft.value[0]) pubSub.publish('scenicChange', navLeft.value[0])
@@ -281,10 +281,12 @@
navLeft.value = [ navLeft.value = [
{ {
name: '奉节县', name: '奉节县',
scenicSpotId: '' scenicSpotId: '',
id:10086,
}, },
...spotRes.data ...spotRes.data
] ]
current.value = navLeft.value[0].id
break break
case '/sceneTesting': case '/sceneTesting':
title.value = '三峡之巅-安全检测' title.value = '三峡之巅-安全检测'

View File

@@ -166,7 +166,7 @@
</template> </template>
<script setup> <script setup>
import { getVideoListApi, getPreviewUrlApi } from '@/api/home' import { getVideoListApi, getPreviewUrlApi,getColletListApi } from '@/api/home'
import { import {
getVideoTypeApi, getVideoTypeApi,
getVideoRegionsApi, getVideoRegionsApi,
@@ -262,6 +262,30 @@
videoList.value = [] videoList.value = []
getVideoList() getVideoList()
} }
const getColletList = async () => {
let res = await getColletListApi(params)
videoList.value = res.data
total.value = res.total
nextTick(() => {
videoList.value.forEach(async (item, index) => {
var video = document.getElementById(`video${index}`)
const hls = new Hls({
enableWorker: false, // 禁用 Worker 来避免额外的线程
enableSoftwareAES: true, // 使用软件解码器以避免硬件解码的额外请求
cache: true, // 启用缓存
maxBufferLength: 10, // 最大缓冲长度(秒)
maxMaxBufferLength: 15, // 缓冲区长度的上限
maxBufferSize: 20 * 1000 * 1000 // 最大缓冲大小(字节)
})
hls.loadSource(item.hlsUrl)
hls.attachMedia(video)
hls.on(Hls.Events.MANIFEST_PARSED, () => {
video.play()
})
hlsRefs.push(hls)
})
})
}
const handleNav = (e) => { const handleNav = (e) => {
if (current.value == e) return if (current.value == e) return
clearHlsRefs() clearHlsRefs()
@@ -271,7 +295,7 @@
total.value = 0 total.value = 0
current.value = e current.value = e
if(e==3){ if(e==3){
getVideoList(3) getColletList(3)
return false return false
} }
getVideoList() getVideoList()