ah_jjzhgd_webscreen/js/pages/video/videoAjax.js

131 lines
4.9 KiB
JavaScript
Raw Normal View History

2024-04-01 12:51:34 +08:00
/* 球机树 */
function loadVideoTree() {
const bidCode = parent.$('#bidPro').val();
2024-04-01 19:05:06 +08:00
const keyWord = $('#keyWord').val();
const paramData = 'bidCode=' + bidCode + '&roleCode=' + roleCode + '&orgId=' + orgId + '&userId=' + userId + '&param=' + keyWord;
2024-04-01 12:51:34 +08:00
let montageParam = aqEnnable ? encryptCBC(paramData) : ' &' + encryptCBC(paramData);
const url = commonUrl + 'screen/largeScreen/video/getVideoTree?params=' + montageParam;
ajaxRequestGet(url, "GET", true, function () {
}, function (result) {
if (result.code === 200) {
2024-04-01 19:05:06 +08:00
setData(result.data);
2024-04-01 12:51:34 +08:00
} else if (result.code === 500) {
console.error('视频树' + result.msg);
} else if (result.code === 401) {
loginout(1);
}
}, function (xhr, status, error) {
2024-04-23 16:07:11 +08:00
errorFn(xhr, status, error)
2024-04-01 12:51:34 +08:00
}, aqEnnable);
2024-04-01 19:05:06 +08:00
function setData(data) {
let totalNum = 0, onlineNum = 0, offLineNum = 0;
2024-06-17 15:47:55 +08:00
let isPlay=true;
2024-04-01 19:05:06 +08:00
$.each(data, function (index, item) {
2024-06-17 15:47:55 +08:00
2024-04-01 19:05:06 +08:00
if (item.id !== '0') {
totalNum++;
2024-04-23 16:07:11 +08:00
let titleName = item.title;
if(item.title.length>20){
2024-04-23 16:07:11 +08:00
titleName = item.title.substr(0, 20) + '...';
}
2024-04-01 19:05:06 +08:00
if (item.onLine === '1') {
onlineNum++;
2024-04-23 16:07:11 +08:00
item.title = '<img src="../../img/video/ball_online.png"><span data-mtpis="'+item.title+'">' + titleName + '</span>'
2024-06-17 15:47:55 +08:00
if(isPlay){
let puid = item.id.replace('QJ', '').split("-")[0];
2024-06-17 21:18:15 +08:00
playList.push(getPlay(puid,winDom,0));
playVideList();
// QXPlayVideo(puid, '0', winDom)
// playControl();
// videoObject.devCode = puid;
2024-06-17 15:47:55 +08:00
isPlay=false;
}
2024-04-01 19:05:06 +08:00
} else {
offLineNum++;
2024-04-23 16:07:11 +08:00
item.title = '<img src="../../img/video/ball_offline.png"><span data-mtpis="'+item.title+'">' + titleName + '</span>'
2024-04-01 19:05:06 +08:00
}
}
})
videoTree = dtree.render({
elem: "#video-tree",
width: "96%", // 指定树的宽度
data: data,
dataFormat: "list",
skin: "laySimple",
line: false, // 显示树线
});
// 设备在线情况
$('.device-status').eq(0).html('全部(' + totalNum + '')
$('.device-status').eq(1).html('在线(' + onlineNum + '')
$('.device-status').eq(2).html('离线(' + offLineNum + '')
}
2024-06-17 19:46:38 +08:00
}
2024-06-17 21:18:15 +08:00
function oneVideo(){
for (let i = 2; i < 5; i++) {
document.getElementById("windowbox" + i).style.cssText = "width: 48.5%;height: 48.8%;";
document.getElementById("videoPlayer"+i).style.cssText = "width: 100%;height: 100%;";
$('.video'+i+'-dimensions').css("width", "100%");
$('.video'+i+'-dimensions').css("height", "100%");
document.getElementById("windowbox" + i).style.display = "none";
}
document.getElementById("windowbox" + 1).style.cssText = "width: 100%;height: 100%;";
document.getElementById("videoPlayer"+1).style.cssText = "width: 100%;height: 100%;";
nowDmoScree=1;
while (playList.length > nowDmoScree) {
console.log(playList[0].windBox)
destoryVideo(playList[0].flvPlayer);
playList.pop();
}
//播放
for (let i = 0; i <playList.length ; i++) {
if( playList[i].state!=1){
flvPlayer= QXPlayVideo(playList[i].puid, '0', playList[i].windBox);
playList[i].flvPlayer=flvPlayer;
playList[i].state=1;
}
}
}
2024-06-17 19:46:38 +08:00
function fourVideo(){
for (let i = 1; i < 5; i++) {
document.getElementById("windowbox" + i).style.cssText = "width: 48.5%;height: 48.8%;";
document.getElementById("videoPlayer"+i).style.cssText = "width: 100%;height: 100%;";
$('.video'+i+'-dimensions').css("width", "100%");
$('.video'+i+'-dimensions').css("height", "100%");
document.getElementById("windowbox" + i).style.display = "block";
}
2024-06-17 21:18:15 +08:00
nowDmoScree=4;
console.log(nowDmoScree);
if(playList.length>nowDmoScree){
playList=playList.slice(-nowDmoScree);
}
for (let i = 0; i <playList.length ; i++) {
QXPlayVideo(playList[i].puid, '0', playList[i].windBox);
playControl();
}
2024-06-17 19:46:38 +08:00
for (var i = 5; i <= 9; i++) {
document.getElementById("windowbox" + i).style.display = "none";
}
2024-06-17 21:18:15 +08:00
}
function playVideList(){
console.log(playList)
if(playList.length>nowDmoScree){
playList=playList.slice(-nowDmoScree);
}
console.log(playList)
for (let i = 0; i <playList.length ; i++) {
if( playList[i].state!=1){
flvPlayer= QXPlayVideo(playList[i].puid, '0', playList[i].windBox);
playList[i].flvPlayer=flvPlayer;
playList[i].state=1;
}
}
console.log(playList);
2024-04-01 12:51:34 +08:00
}