固定摄像头巡检 翻页问题完成

This commit is contained in:
BianLzhaoMin 2025-03-03 13:46:53 +08:00
parent e384daf472
commit dce5d2d918
2 changed files with 75 additions and 7 deletions

View File

@ -35,11 +35,20 @@ export default {
Promise.all([this.getQxToken(), this.selectVideoLoginInfo()]).then(() => { Promise.all([this.getQxToken(), this.selectVideoLoginInfo()]).then(() => {
// 2. Promise.all url // 2. Promise.all url
const { puid, ballIndex } = newValue const { puid, ballIndex } = newValue
this.playUrl = this.playUrl =
this.qxInfo.q2Url + 'stream.flv?puid=' + puid + '&idx=' + ballIndex + '&stream=0&token=' + this.qxToken this.qxInfo.q2Url + 'stream.flv?puid=' + puid + '&idx=' + ballIndex + '&stream=0&token=' + this.qxToken
console.log('this.playUrl', this.playUrl) console.log('this.playUrl', this.playUrl)
this.playvideo() if (this.jessibuca) {
// await this.jessibuca.destroy()
this.playvideo()
} else {
this.createJessibuca()
this.playvideo()
}
}) })
} else {
this.stopvideo()
} }
}, },
deep: true, deep: true,

View File

@ -9,7 +9,7 @@
<template> <template>
<div style="height: 100%"> <div style="height: 100%">
<div class="handle-header"> <div class="handle-header">
<div> <div class="btn-container">
<el-button <el-button
type="primary" type="primary"
size="small" size="small"
@ -76,9 +76,10 @@
<el-button <el-button
type="primary" type="primary"
size="small" size="small"
icon="el-icon-error" icon="el-icon-arrow-left"
@click="closeVideos(2)" @click="onChangePages(1)"
style="background: #1aa4e1; padding: 6px" style="background: #1aa4e1; padding: 6px"
:disabled="currentPage === 1"
> >
上页 上页
</el-button> </el-button>
@ -86,12 +87,18 @@
<el-button <el-button
type="primary" type="primary"
size="small" size="small"
icon="el-icon-error" icon="el-icon-arrow-right"
@click="closeVideos(2)" @click="onChangePages(2)"
style="background: #1aa4e1; padding: 6px" style="background: #1aa4e1; padding: 6px"
:disabled="currentPage === maxPages"
> >
下页 下页
</el-button> </el-button>
<span style="margin-left: 10px; font-size: 1rem; color: #fff">
<el-badge is-dot class="item" type="success" style="margin-top: 8px"></el-badge>
当前页{{ currentPage }}
</span>
</div> </div>
<div class="cell-tool"> <div class="cell-tool">
<div class="bk-button-group"> <div class="bk-button-group">
@ -280,7 +287,7 @@
@click="onSelectVideo(i)" @click="onSelectVideo(i)"
:style="i === activeVideo ? 'border: 2px solid green' : ''" :style="i === activeVideo ? 'border: 2px solid green' : ''"
> >
<JessibucaH265 :playerInfo="fixedData[i - 1]" :ref="`JessibucaH265_${i}`" /> <JessibucaH265 :playerInfo="onLinePlayerList[i - 1]" :ref="`JessibucaH265_${i}`" />
</div> </div>
<!-- <div :class="cellClass(i)" v-for="i in cellCount" :key="i"> <!-- <div :class="cellClass(i)" v-for="i in cellCount" :key="i">
<player <player
@ -428,8 +435,12 @@ export default {
blob: '', blob: '',
fullscreen: false, fullscreen: false,
fixedData: [], fixedData: [],
onLineList: [],
onLinePlayerList: [],
activeVideo: null, activeVideo: null,
activePlayVideo: null, activePlayVideo: null,
currentPage: 1, //
} }
}, },
methods: { methods: {
@ -468,6 +479,7 @@ export default {
}, },
changCellCount(count) { changCellCount(count) {
this.cellCount = count this.cellCount = count
this.onLinePlayerListFun()
let length = this.puidArray.length > count ? count : this.puidArray.length let length = this.puidArray.length > count ? count : this.puidArray.length
this.puidArray = this.puidArray.sort((a, b) => a.activePlayer - b.activePlayer) this.puidArray = this.puidArray.sort((a, b) => a.activePlayer - b.activePlayer)
for (let i = 0; i < length; i++) { for (let i = 0; i < length; i++) {
@ -691,6 +703,8 @@ export default {
deviceType: '固定摄像头', deviceType: '固定摄像头',
}) })
this.fixedData = res.data this.fixedData = res.data
this.onLineList = this.fixedData.filter(e => e.status == 1)
this.onLinePlayerListFun()
}, },
// //
@ -711,6 +725,41 @@ export default {
}) })
} }
}, },
// pages
divideAndRoundUp(a, b) {
if (a === 0) {
return 1
}
let result = a / b
return Math.ceil(result)
},
// /
onChangePages(type) {
// 1. 2.
if (type === 1) {
if (this.currentPage > 1) {
this.currentPage--
}
} else {
if (this.currentPage < this.maxPages) {
this.currentPage++
}
}
this.onLinePlayerListFun()
},
//
onLinePlayerListFun() {
this.onLinePlayerList = this.onLineList.slice(
(this.currentPage - 1) * this.cellCount,
this.cellCount * this.currentPage
)
console.log(' this.onLinePlayerList', this.onLinePlayerList)
},
}, },
computed: { computed: {
cellClass() { cellClass() {
@ -749,6 +798,11 @@ export default {
if (this.cellCount === 1 || this.cellCount === 4) return 'container-9' if (this.cellCount === 1 || this.cellCount === 4) return 'container-9'
} }
}, },
//
maxPages() {
return this.divideAndRoundUp(this.videoNum.onlineNum, this.cellCount)
},
}, },
mounted() { mounted() {
@ -922,5 +976,10 @@ export default {
justify-content: space-between; justify-content: space-between;
height: 7vh; height: 7vh;
padding: 10px 0; padding: 10px 0;
.btn-container {
display: flex;
align-items: center;
}
} }
</style> </style>