860 lines
26 KiB
JavaScript
860 lines
26 KiB
JavaScript
|
|
let dtree, util, tree,layer;
|
|||
|
|
let noNum = 0, num = 0, all = 0;
|
|||
|
|
let type = 'city';
|
|||
|
|
let puidParam;
|
|||
|
|
let winDom = 'videoPlayer';
|
|||
|
|
let ty_code='to-1';
|
|||
|
|
let nrUvpVideoObj;
|
|||
|
|
let passWay = localStorage.getItem("passWay");
|
|||
|
|
layui.extend({
|
|||
|
|
dtree: '../../js/layui_dtree/dtree/dtree'
|
|||
|
|
}).use(['util', 'dtree','layer'], function () {
|
|||
|
|
util = layui.util;
|
|||
|
|
dtree = layui.dtree;
|
|||
|
|
layer = layui.layer;
|
|||
|
|
//动态加载js
|
|||
|
|
if(ty_code==passWay){
|
|||
|
|
$("#videoPlayer").css("display","none");
|
|||
|
|
passWay=ty_code;
|
|||
|
|
uaplogin();
|
|||
|
|
let url=playVideoUrl('fly','h264','main','123456');
|
|||
|
|
|
|||
|
|
//初始化加载
|
|||
|
|
var ip=video_ip;
|
|||
|
|
var token=video_token;
|
|||
|
|
var port=video_port;
|
|||
|
|
nrUvpVideoObj = new UVPVideoObj({ id: 'windowbox',
|
|||
|
|
ip,
|
|||
|
|
port,
|
|||
|
|
token,
|
|||
|
|
ak,
|
|||
|
|
callback: onEventNotify,
|
|||
|
|
winNum:1
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
playControl();
|
|||
|
|
playControl2();
|
|||
|
|
}else{
|
|||
|
|
initVideo();
|
|||
|
|
}
|
|||
|
|
initTreeCity("");
|
|||
|
|
//按钮点击事件
|
|||
|
|
util.event('lay-active', {
|
|||
|
|
city: function () {
|
|||
|
|
changBtn(this, $(this).parent(), 'checkBtn');
|
|||
|
|
if (type !== 'city') {
|
|||
|
|
initTreeCity("");
|
|||
|
|
type = 'city';
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
risk: function () {
|
|||
|
|
changBtn(this, $(this).parent(), 'checkBtn');
|
|||
|
|
if (type !== 'risk') {
|
|||
|
|
initTreeRisk("");
|
|||
|
|
type = 'risk';
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
regular: function () {
|
|||
|
|
changBtn(this, $(this).parent(), 'checkBtn');
|
|||
|
|
if (type !== 'regular') {
|
|||
|
|
initTreeRegular("");
|
|||
|
|
type = 'regular';
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
swCity:function(){
|
|||
|
|
changBtn(this, $(this).parent(), 'checkBtn');
|
|||
|
|
if (type !== 'swCity') {
|
|||
|
|
initTreeSwCity("");
|
|||
|
|
type = 'swCity';
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
query: function () {
|
|||
|
|
let keyWord = $('#keyWord').val();
|
|||
|
|
let pattern = new RegExp("[%_<>]");
|
|||
|
|
if (pattern.test(keyWord)) {
|
|||
|
|
$("#keyWord").val('');
|
|||
|
|
return layer.msg('关键字查询包含特殊字符,请重新输入', {
|
|||
|
|
icon: 7,
|
|||
|
|
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
if (type === 'city') {
|
|||
|
|
initTreeCity(keyWord);
|
|||
|
|
} else if(type === 'risk'){
|
|||
|
|
initTreeRisk(keyWord);
|
|||
|
|
}else if(type === 'regular'){
|
|||
|
|
initTreeRegular(keyWord);
|
|||
|
|
}else if(type === 'swCity'){
|
|||
|
|
initTreeSwCity(keyWord);
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
photoLocal: function () {
|
|||
|
|
screenshot();
|
|||
|
|
},
|
|||
|
|
videoRemote: function () {
|
|||
|
|
if (videoObject.playState) {
|
|||
|
|
if (isEmpty(videoObject.remoteId)) {
|
|||
|
|
$(this).attr("src", "../../img/video/videoRemote-select.png");
|
|||
|
|
remoteVideo(videoObject.devCode, 0);
|
|||
|
|
} else {
|
|||
|
|
$(this).attr("src", "../../img/video/videoRemote.png");
|
|||
|
|
stopRemote(videoObject.remoteId, 0)
|
|||
|
|
}
|
|||
|
|
} else {
|
|||
|
|
layer.msg("请先播放视频。。。", {icon: 0});
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
photoRemote: function () {
|
|||
|
|
if (videoObject.playState) {
|
|||
|
|
remoteVideo(videoObject.devCode, 1);
|
|||
|
|
} else {
|
|||
|
|
layer.msg("请先播放视频。。。", {icon: 0});
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
dtree.on("node('ballTree')", function (obj) {
|
|||
|
|
|
|||
|
|
if (!videoObject.recordVideoState && isEmpty(videoObject.remoteId)) {
|
|||
|
|
let data = obj.param.recordData;
|
|||
|
|
let devName = data.tName;
|
|||
|
|
if (passWay == null || passWay == '') {
|
|||
|
|
passWay = 'to-2';
|
|||
|
|
}
|
|||
|
|
if (data.genre === '1') {
|
|||
|
|
if(data.puid==null || data.puid=='' || passWay==ty_code){
|
|||
|
|
//播放统一视频
|
|||
|
|
videoObject.devCode =data.tCode;
|
|||
|
|
nrUvpVideoObj.uvpVideoPlay({
|
|||
|
|
winNum:1,
|
|||
|
|
codeType:1,
|
|||
|
|
devCode:data.tCode,
|
|||
|
|
devName:'',
|
|||
|
|
})
|
|||
|
|
|
|||
|
|
|
|||
|
|
}else{
|
|||
|
|
if (!isEmpty(data.puid)) {
|
|||
|
|
if (videoObject.devCode !== data.puid) {
|
|||
|
|
videoObject.devCode = data.puid;
|
|||
|
|
puidParam=data.puid;
|
|||
|
|
playVideo(1, videoObject.devCode);
|
|||
|
|
} else {
|
|||
|
|
layer.msg("视频正在播放中....", {icon: 0});
|
|||
|
|
}
|
|||
|
|
} else {
|
|||
|
|
layer.msg("工程未绑定球机", {icon: 0});
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}else if (data.genre === '2'){
|
|||
|
|
console.log("--->",obj)
|
|||
|
|
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
} else {
|
|||
|
|
if (isEmpty(videoObject.remoteId)) {
|
|||
|
|
layer.msg("当前视频正在本地录像,请先关闭本地录像", {icon: 0});
|
|||
|
|
} else {
|
|||
|
|
layer.msg("当前视频正在远程录像,请先关闭远程录像", {icon: 0});
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
});
|
|||
|
|
tree = dtree.render({
|
|||
|
|
elem: "#ballTree",
|
|||
|
|
initLevel: 1,
|
|||
|
|
data: [],
|
|||
|
|
checkbar: false,//开启复选框
|
|||
|
|
menubar: false,
|
|||
|
|
ficon: ['2'],
|
|||
|
|
skin: "lay",
|
|||
|
|
record: true,
|
|||
|
|
toolbar: true,
|
|||
|
|
toolbarFun: toolbarFun,
|
|||
|
|
done: function (res, $ul, first) {
|
|||
|
|
$('.icon-shexiangtou1').next().css('color', "#2f82fb");
|
|||
|
|
$('div[data-id$="top"]').addClass('top');
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
});
|
|||
|
|
//树右击事件
|
|||
|
|
let toolbarFun = {
|
|||
|
|
loadToolbarBefore: function (buttons, param, $div) {
|
|||
|
|
if (param.recordData.genre === '1') {
|
|||
|
|
openRemotePatrol(param.nodeId, param.recordData.puid, param.recordData.tCode, param.recordData.twCode, param.recordData.tdCode, param.recordData.passWay);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
function videofullscreen(box) {
|
|||
|
|
var video = document.getElementById("windowbox");
|
|||
|
|
if (!document.fullscreenElement) {
|
|||
|
|
video.requestFullscreen().catch(err => {
|
|||
|
|
console.error("Fullscreen request failed:", err);
|
|||
|
|
});
|
|||
|
|
document.addEventListener('keydown', function (e) {
|
|||
|
|
if (e.key === 'Escape') {
|
|||
|
|
handleEscapePress();
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
document.addEventListener('fullscreenchange', handleFullscreenChange);
|
|||
|
|
} else {
|
|||
|
|
if (document.exitFullscreen) {
|
|||
|
|
document.exitFullscreen();
|
|||
|
|
$('#videoControlBtn').css('display', 'none');
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// 全屏状态变化处理
|
|||
|
|
function handleFullscreenChange() {
|
|||
|
|
const isFullscreen = document.fullscreenElement ||
|
|||
|
|
document.webkitFullscreenElement ||
|
|||
|
|
document.mozFullScreenElement ||
|
|||
|
|
document.msFullscreenElement;
|
|||
|
|
|
|||
|
|
// console.log('全屏状态变化:', isFullscreen ? '进入全屏' : '退出全屏');
|
|||
|
|
|
|||
|
|
if (isFullscreen) {
|
|||
|
|
// 进入全屏时的操作
|
|||
|
|
// console.log('现在可以监听ESC键了');
|
|||
|
|
$('#videoControlBtn').removeAttr('style');
|
|||
|
|
} else {
|
|||
|
|
// 退出全屏
|
|||
|
|
$('#videoControlBtn').css('display', 'none');
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
function handleEscapePress() {
|
|||
|
|
const isFullscreen = document.fullscreenElement ||
|
|||
|
|
document.webkitFullscreenElement ||
|
|||
|
|
document.mozFullScreenElement ||
|
|||
|
|
document.msFullscreenElement;
|
|||
|
|
|
|||
|
|
if (isFullscreen) {
|
|||
|
|
console.log('在全屏状态下按下了ESC键');
|
|||
|
|
// 这里可以添加自定义逻辑,比如显示控制栏等
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/*打开远程巡视页面*/
|
|||
|
|
function openRemotePatrol(id, puid, tCode, twCode, tdCode, passWay) {
|
|||
|
|
let layerIndex = layer.open({
|
|||
|
|
id: "remotePatrol",
|
|||
|
|
title: false,
|
|||
|
|
type: 2,
|
|||
|
|
maxmin: false,
|
|||
|
|
content: '../dutyTask/remotePatrol/remotePatrol.html',
|
|||
|
|
area: ['100%', '100%'],
|
|||
|
|
closeBtn: 0,
|
|||
|
|
success: function (layero, index) {
|
|||
|
|
let iframeWin = window["layui-layer-iframe" + layerIndex];
|
|||
|
|
iframeWin.setParams(id, puid, tCode, twCode, tdCode, passWay);
|
|||
|
|
},
|
|||
|
|
end: function () {
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 地市树
|
|||
|
|
* @param keyWord
|
|||
|
|
*/
|
|||
|
|
function initTreeCity(keyWord) {
|
|||
|
|
$.ajax({
|
|||
|
|
headers: {
|
|||
|
|
'decrypt':'decrypt',
|
|||
|
|
'encryption':'encryption',
|
|||
|
|
'Authorization':localStorage.getItem("tokens")
|
|||
|
|
},
|
|||
|
|
type:'POST',
|
|||
|
|
url: dataUrl + 'proteam/pot/video/getMenuListCity',
|
|||
|
|
data: {
|
|||
|
|
keyWord: $('#keyWord').val()
|
|||
|
|
},
|
|||
|
|
success: function (data) {
|
|||
|
|
calleArr(data.data);
|
|||
|
|
let treeData = [{
|
|||
|
|
id: "top",
|
|||
|
|
title: '<span style="font-size: 18px">球机</span><span style="font-size: 16px;"> (在线:<span style="color: green">' + num + ' </span>' + " 不在线:" + '<span style="color: red">' + noNum + ' </span>' + " 总数:" + all + ')</span>',
|
|||
|
|
checkArr: "0",
|
|||
|
|
parentId: "-1",
|
|||
|
|
children: data.data,
|
|||
|
|
iconClass: 'iconfont icon-shexiangtou',
|
|||
|
|
spread: true,
|
|||
|
|
}];
|
|||
|
|
dtree.reload(tree, {
|
|||
|
|
data: treeData,
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 省外球机树
|
|||
|
|
* @param keyWord
|
|||
|
|
*/
|
|||
|
|
function initTreeSwCity(keyWord) {
|
|||
|
|
$.ajax({
|
|||
|
|
type:'post',
|
|||
|
|
headers: {
|
|||
|
|
'Authorization':localStorage.getItem("tokens"),
|
|||
|
|
"encryption":"encryption",
|
|||
|
|
"encrypt": sm3(JSON.stringify({
|
|||
|
|
keyWord: keyWord
|
|||
|
|
}))
|
|||
|
|
},
|
|||
|
|
url: dataUrl + 'proteam/pot/video/getMenuListSWCity',
|
|||
|
|
data: {
|
|||
|
|
keyWord: keyWord
|
|||
|
|
},
|
|||
|
|
success: function (data) {
|
|||
|
|
calleArr2(data.data);
|
|||
|
|
let treeData = [{
|
|||
|
|
id: "top",
|
|||
|
|
title: '<span style="font-size: 18px">省外球机</span><span style="font-size: 16px;"> (在线:<span style="color: green">' + num + ' </span>' + " 不在线:" + '<span style="color: red">' + noNum + ' </span>' + " 总数:" + all + ')</span>',
|
|||
|
|
checkArr: "0",
|
|||
|
|
parentId: "-1",
|
|||
|
|
children: data.data,
|
|||
|
|
iconClass: 'iconfont icon-shexiangtou',
|
|||
|
|
spread: true,
|
|||
|
|
}];
|
|||
|
|
dtree.reload(tree, {
|
|||
|
|
data: treeData
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
/**
|
|||
|
|
* @param {Object} keyWord
|
|||
|
|
*/
|
|||
|
|
function initTreeRisk(keyWord) {
|
|||
|
|
$.ajax({
|
|||
|
|
type:'post',
|
|||
|
|
headers: {
|
|||
|
|
'Authorization':localStorage.getItem("tokens"),
|
|||
|
|
"encryption":"encryption",
|
|||
|
|
"encrypt": sm3(JSON.stringify({
|
|||
|
|
keyWord: keyWord
|
|||
|
|
}))
|
|||
|
|
},
|
|||
|
|
url: dataUrl + 'proteam/pot/video/getMenuListRisk',
|
|||
|
|
data: {
|
|||
|
|
keyWord: keyWord
|
|||
|
|
},
|
|||
|
|
success: function (data) {
|
|||
|
|
calleArr(data.data);
|
|||
|
|
let treeData = [{
|
|||
|
|
id: "top",
|
|||
|
|
title: '<span style="font-size: 18px">球机</span><span style="font-size: 16px;"> (在线:<span style="color: green">' + num + ' </span>' + " 不在线:" + '<span style="color: red">' + noNum + ' </span>' + " 总数:" + all + ')</span>',
|
|||
|
|
checkArr: "0",
|
|||
|
|
parentId: "-1",
|
|||
|
|
children: data.data,
|
|||
|
|
iconClass: 'iconfont icon-shexiangtou',
|
|||
|
|
spread: true,
|
|||
|
|
}];
|
|||
|
|
dtree.reload(tree, {
|
|||
|
|
data: treeData
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
// 固定球机树
|
|||
|
|
function initTreeRegular(){
|
|||
|
|
$.ajax({
|
|||
|
|
type:'post',
|
|||
|
|
headers: {
|
|||
|
|
'Authorization':localStorage.getItem("tokens"),
|
|||
|
|
"encryption":"encryption",
|
|||
|
|
"encrypt": sm3(JSON.stringify({
|
|||
|
|
keyWord: $('#keyWord').val()
|
|||
|
|
}))
|
|||
|
|
},
|
|||
|
|
url: dataUrl + 'proteam/pot/video/getMenuListRegular',
|
|||
|
|
data: {
|
|||
|
|
keyWord: $('#keyWord').val()
|
|||
|
|
},
|
|||
|
|
success: function (data) {
|
|||
|
|
handleData(data.data);
|
|||
|
|
let treeData = [{
|
|||
|
|
id: "top",
|
|||
|
|
title: '<span style="font-size: 18px">固定球机</span><span style="font-size: 16px;"> (在线:<span style="color: green">' + num + ' </span>' + " 不在线:" + '<span style="color: red">' + noNum + ' </span>' + " 总数:" + all + ')</span>',
|
|||
|
|
checkArr: "0",
|
|||
|
|
parentId: "-1",
|
|||
|
|
children: data.data,
|
|||
|
|
iconClass: 'iconfont icon-shexiangtou',
|
|||
|
|
spread: true,
|
|||
|
|
}];
|
|||
|
|
dtree.reload(tree, {
|
|||
|
|
data: treeData,
|
|||
|
|
});
|
|||
|
|
$('.dtree-lay-item').css('padding-left','20px');
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 遍历树数据
|
|||
|
|
* @param treeData
|
|||
|
|
*/
|
|||
|
|
function calleArr(treeData) {
|
|||
|
|
console.log(treeData)
|
|||
|
|
num = 0;
|
|||
|
|
noNum = 0;
|
|||
|
|
all = 0;
|
|||
|
|
for (let i in treeData) {
|
|||
|
|
let objNum = 0;
|
|||
|
|
let objNoNum = 0;
|
|||
|
|
let obj = treeData[i];
|
|||
|
|
obj.iconClass = 'iconfont icon-dingwei';
|
|||
|
|
if (obj.children) {
|
|||
|
|
for (let i in obj.children) {
|
|||
|
|
if (!isEmpty(obj.children[i].puid)) {
|
|||
|
|
//判断球机图标
|
|||
|
|
if (!isEmpty(obj.children[i].state) && obj.children[i].state === '1') {
|
|||
|
|
//在线图标
|
|||
|
|
obj.children[i].iconClass = 'iconfont icon-shexiangtou1';
|
|||
|
|
num++;
|
|||
|
|
objNum++;
|
|||
|
|
} else {
|
|||
|
|
//不在线图标
|
|||
|
|
obj.children[i].iconClass = 'iconfont icon-shexiangtou';
|
|||
|
|
noNum++;
|
|||
|
|
objNoNum++;
|
|||
|
|
}
|
|||
|
|
} else {
|
|||
|
|
//不在线图标
|
|||
|
|
obj.children[i].iconClass = 'iconfont icon-shexiangtou';
|
|||
|
|
noNum++;
|
|||
|
|
objNoNum++;
|
|||
|
|
}
|
|||
|
|
all++;
|
|||
|
|
}
|
|||
|
|
obj.title = obj.title + ' (<span style="color: green">' + objNum + '</span>/<span style="color: red">' + objNoNum + '</span>)';
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 遍历树数据
|
|||
|
|
* @param treeData
|
|||
|
|
*/
|
|||
|
|
function calleArr2(treeData) {
|
|||
|
|
console.log(treeData)
|
|||
|
|
num = 0;
|
|||
|
|
noNum = 0;
|
|||
|
|
all = 0;
|
|||
|
|
for (let i in treeData) {
|
|||
|
|
let objNum = 0;
|
|||
|
|
let objNoNum = 0;
|
|||
|
|
treeData.iconClass = 'iconfont icon-shexiangtou';
|
|||
|
|
if (!isEmpty(treeData[i].puid)) {
|
|||
|
|
//判断球机图标
|
|||
|
|
if (!isEmpty(treeData[i].state) && treeData[i].state === '1') {
|
|||
|
|
//在线图标
|
|||
|
|
treeData[i].iconClass = 'iconfont icon-shexiangtou1';
|
|||
|
|
num++;
|
|||
|
|
objNum++;
|
|||
|
|
} else {
|
|||
|
|
//不在线图标
|
|||
|
|
treeData[i].iconClass = 'iconfont icon-shexiangtou';
|
|||
|
|
noNum++;
|
|||
|
|
objNoNum++;
|
|||
|
|
}
|
|||
|
|
} else {
|
|||
|
|
//不在线图标
|
|||
|
|
treeData[i].iconClass = 'iconfont icon-shexiangtou';
|
|||
|
|
noNum++;
|
|||
|
|
objNoNum++;
|
|||
|
|
}
|
|||
|
|
all++;
|
|||
|
|
treeData.title = treeData.title + ' (<span style="color: green">' + objNum + '</span>/<span style="color: red">' + objNoNum + '</span>)';
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// 处理固定式球机数据
|
|||
|
|
function handleData(treeData){
|
|||
|
|
num = 0;
|
|||
|
|
noNum = 0;
|
|||
|
|
all = 0;
|
|||
|
|
for (let i in treeData) {
|
|||
|
|
let objNum = 0;
|
|||
|
|
let objNoNum = 0;
|
|||
|
|
let obj = treeData[i];
|
|||
|
|
obj.iconClass = 'none';
|
|||
|
|
if (obj.children) {
|
|||
|
|
for (let i in obj.children) {
|
|||
|
|
if (!isEmpty(obj.children[i].puid)) {
|
|||
|
|
//判断球机图标
|
|||
|
|
if (!isEmpty(obj.children[i].state) && obj.children[i].state === '1') {
|
|||
|
|
//在线图标
|
|||
|
|
obj.children[i].iconClass = 'iconfont icon-shexiangtou1';
|
|||
|
|
num++;
|
|||
|
|
objNum++;
|
|||
|
|
} else {
|
|||
|
|
//不在线图标
|
|||
|
|
obj.children[i].iconClass = 'iconfont icon-shexiangtou';
|
|||
|
|
noNum++;
|
|||
|
|
objNoNum++;
|
|||
|
|
}
|
|||
|
|
} else {
|
|||
|
|
//不在线图标
|
|||
|
|
obj.children[i].iconClass = 'iconfont icon-shexiangtou';
|
|||
|
|
noNum++;
|
|||
|
|
objNoNum++;
|
|||
|
|
}
|
|||
|
|
all++;
|
|||
|
|
}
|
|||
|
|
obj.title = obj.title + ' (<span style="color: green">' + objNum + '</span>/<span style="color: red">' + objNoNum + '</span>)';
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 播放视频
|
|||
|
|
* @param {Object} winNum
|
|||
|
|
* @param {Object} devCode
|
|||
|
|
* @param {Object} devName
|
|||
|
|
* @param videoType 视频类型
|
|||
|
|
*/
|
|||
|
|
function playVideo(winNum, devCode) {
|
|||
|
|
let index = devCode.indexOf("-");
|
|||
|
|
if(index > 0){ // 固定球机播放
|
|||
|
|
let puid = devCode.substring(0,index);
|
|||
|
|
let idx = devCode.substring(index + 1,devCode.length);
|
|||
|
|
QXPlayVideo(puid, idx, winDom)
|
|||
|
|
}else{
|
|||
|
|
QXPlayVideo(devCode, '0', winDom)
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 云台控制
|
|||
|
|
* @param devCode
|
|||
|
|
*/
|
|||
|
|
function playControl() {
|
|||
|
|
|
|||
|
|
let key;
|
|||
|
|
//点击事件
|
|||
|
|
let btn = $('[lay-event=control]');
|
|||
|
|
btn.unbind();
|
|||
|
|
btn.mousedown(function (event) {
|
|||
|
|
if(ty_code==passWay){
|
|||
|
|
key = tyControlType[$(this).attr('id')];
|
|||
|
|
nrUvpVideoObj.uvpVideoControl({ devCode:videoObject.devCode, cmd:key[0] })
|
|||
|
|
|
|||
|
|
}else{
|
|||
|
|
key = qxControlType[$(this).attr('id')];
|
|||
|
|
if (videoObject.playState) {
|
|||
|
|
key = qxControlType[$(this).attr('id')];
|
|||
|
|
if (key[2]) {
|
|||
|
|
//清新 -球机移动
|
|||
|
|
turnControl(key[0], videoObject.devCode).then(r => {
|
|||
|
|
});
|
|||
|
|
} else {
|
|||
|
|
//球机放大缩小
|
|||
|
|
qxControl(videoObject.devCode, key[1])
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
event.stopPropagation();
|
|||
|
|
}).mouseup(function (event) {
|
|||
|
|
if(ty_code==passWay){
|
|||
|
|
key = tyControlType[$(this).attr('id')];
|
|||
|
|
nrUvpVideoObj.uvpVideoControl({ devCode:videoObject.devCode, cmd:key[1] })
|
|||
|
|
|
|||
|
|
}else{
|
|||
|
|
key = qxControlType[$(this).attr('id')];
|
|||
|
|
if (videoObject.playState) {
|
|||
|
|
key = qxControlType[$(this).attr('id')];
|
|||
|
|
if (key[2]) {
|
|||
|
|
turnControl(key[3], videoObject.devCode).then(r => {
|
|||
|
|
});
|
|||
|
|
} else {
|
|||
|
|
qxControl(videoObject.devCode, key[3])
|
|||
|
|
}
|
|||
|
|
}else {
|
|||
|
|
layer.msg("请先播放视频....", {icon: 0});
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
event.stopPropagation();
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// 获取所有操作按钮
|
|||
|
|
const controlButtons = document.querySelectorAll('.control2');
|
|||
|
|
const videoControlBtn = document.querySelectorAll('#videoControlBtn');
|
|||
|
|
|
|||
|
|
// 为每个按钮添加双击事件阻止
|
|||
|
|
controlButtons.forEach(button => {
|
|||
|
|
button.addEventListener('dblclick', function(e) {
|
|||
|
|
e.preventDefault();
|
|||
|
|
e.stopPropagation();
|
|||
|
|
e.stopImmediatePropagation();
|
|||
|
|
return false;
|
|||
|
|
});
|
|||
|
|
});
|
|||
|
|
videoControlBtn.forEach(button => {
|
|||
|
|
button.addEventListener('dblclick', function(e) {
|
|||
|
|
e.preventDefault();
|
|||
|
|
e.stopPropagation();
|
|||
|
|
e.stopImmediatePropagation();
|
|||
|
|
return false;
|
|||
|
|
});
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
// 视频全屏,按钮的点击事件
|
|||
|
|
function playControl2() {
|
|||
|
|
let key;
|
|||
|
|
//点击事件
|
|||
|
|
let btn = $('[lay-event=control2]');
|
|||
|
|
btn.unbind();
|
|||
|
|
btn.mousedown(function (event) {
|
|||
|
|
event.stopPropagation();
|
|||
|
|
if (ty_code == passWay) {
|
|||
|
|
key = tyControlType[$(this).attr('id')];
|
|||
|
|
nrUvpVideoObj.uvpVideoControl({ devCode: videoObject.devCode, cmd: key[0] })
|
|||
|
|
|
|||
|
|
} else {
|
|||
|
|
key = qxControlType[$(this).attr('id')];
|
|||
|
|
console.log(key);
|
|||
|
|
|
|||
|
|
if (videoObject.playState) {
|
|||
|
|
key = qxControlType[$(this).attr('id')];
|
|||
|
|
if (key[2]) {
|
|||
|
|
//清新 -球机移动
|
|||
|
|
turnControl(key[0], videoObject.devCode).then(r => {
|
|||
|
|
});
|
|||
|
|
} else {
|
|||
|
|
//球机放大缩小
|
|||
|
|
qxControl(videoObject.devCode, key[1])
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
event.stopPropagation();
|
|||
|
|
}).mouseup(function (event) {
|
|||
|
|
if (ty_code == passWay) {
|
|||
|
|
key = tyControlType[$(this).attr('id')];
|
|||
|
|
nrUvpVideoObj.uvpVideoControl({ devCode: videoObject.devCode, cmd: key[1] })
|
|||
|
|
|
|||
|
|
} else {
|
|||
|
|
key = qxControlType[$(this).attr('id')];
|
|||
|
|
if (videoObject.playState) {
|
|||
|
|
key = qxControlType[$(this).attr('id')];
|
|||
|
|
if (key[2]) {
|
|||
|
|
turnControl(key[3], videoObject.devCode).then(r => {
|
|||
|
|
});
|
|||
|
|
} else {
|
|||
|
|
qxControl(videoObject.devCode, key[3])
|
|||
|
|
}
|
|||
|
|
} else {
|
|||
|
|
layer.msg("请先播放视频....", { icon: 0 });
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
event.stopPropagation();
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 改变底部按钮样式
|
|||
|
|
*/
|
|||
|
|
function changBtn(dom, parentDom, css) {
|
|||
|
|
let button = $(dom);
|
|||
|
|
if (!button.hasClass(css)) {
|
|||
|
|
$.each(parentDom.children(), function (index, item) {
|
|||
|
|
$(item).removeClass(css);
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
button.addClass(css);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// 输入框查询禁用快捷键
|
|||
|
|
let isProhibitKey = false;
|
|||
|
|
function prohibitKey(type){
|
|||
|
|
if(type === 1){ // 禁用
|
|||
|
|
console.log('禁用')
|
|||
|
|
isProhibitKey = true;
|
|||
|
|
}else if(type === 2){ // 不禁用
|
|||
|
|
console.log('不禁用')
|
|||
|
|
isProhibitKey = false;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
let numA = "";
|
|||
|
|
let up = "W";
|
|||
|
|
let down = "S";
|
|||
|
|
let left = "A";
|
|||
|
|
let right = "D";
|
|||
|
|
let amplify = "Q";
|
|||
|
|
let shrink = "E";
|
|||
|
|
let farFocus = "R";
|
|||
|
|
let nearFocus = "T";
|
|||
|
|
let photoLocal = "F";
|
|||
|
|
let videoLocal = "G";
|
|||
|
|
let escape = "Escape";
|
|||
|
|
//键盘监听事件——本地截屏
|
|||
|
|
document.onkeydown = function (event) {
|
|||
|
|
up = isEmpty(localStorage.getItem("up")) ? "W" : localStorage.getItem("up");
|
|||
|
|
down = isEmpty(localStorage.getItem("down")) ? "S" : localStorage.getItem("down");
|
|||
|
|
left = isEmpty(localStorage.getItem("left")) ? "A" : localStorage.getItem("left");
|
|||
|
|
right = isEmpty(localStorage.getItem("right")) ? "D" : localStorage.getItem("right");
|
|||
|
|
amplify = isEmpty(localStorage.getItem("amplify")) ? "Q" : localStorage.getItem("amplify");
|
|||
|
|
shrink = isEmpty(localStorage.getItem("shrink")) ? "E" : localStorage.getItem("shrink");
|
|||
|
|
farFocus = isEmpty(localStorage.getItem("farFocus")) ? "R" : localStorage.getItem("farFocus");
|
|||
|
|
nearFocus = isEmpty(localStorage.getItem("nearFocus")) ? "T" : localStorage.getItem("nearFocus");
|
|||
|
|
photoLocal = isEmpty(localStorage.getItem("photoLocal")) ? "F" : localStorage.getItem("photoLocal");
|
|||
|
|
videoLocal = isEmpty(localStorage.getItem("videoLocal")) ? "G" : localStorage.getItem("videoLocal");
|
|||
|
|
escape = isEmpty(localStorage.getItem("escape")) ? "Escape" : localStorage.getItem("escape");
|
|||
|
|
let e = event || window.event || arguments.callee.caller.arguments[0];
|
|||
|
|
if (numA !== e.code.replaceAll("Key", '')) {
|
|||
|
|
whichkey(event);
|
|||
|
|
}
|
|||
|
|
numA = e.code.replaceAll("Key", '');
|
|||
|
|
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
|
|||
|
|
function whichkey(event) {
|
|||
|
|
if(isProhibitKey){
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
let e = event || window.event || arguments.callee.caller.arguments[0];
|
|||
|
|
if (e.code === escape && e) {
|
|||
|
|
configure();
|
|||
|
|
} else if (e && e.code.replaceAll("Key", '') === photoLocal) { // Ctrl_B
|
|||
|
|
screenshot();
|
|||
|
|
} else if (e && e.code.replaceAll("Key", '') === videoLocal) { // Ctrl_B
|
|||
|
|
$("#videoLocal").click()
|
|||
|
|
} else if (e && e.code.replaceAll("Key", '') === up) { // Ctrl_B
|
|||
|
|
controlDown("up");
|
|||
|
|
} else if (e && e.code.replaceAll("Key", '') === down) { // Ctrl_B
|
|||
|
|
controlDown("down");
|
|||
|
|
} else if (e && e.code.replaceAll("Key", '') === left) { // Ctrl_B
|
|||
|
|
controlDown("left");
|
|||
|
|
} else if (e && e.code.replaceAll("Key", '') === right) { // Ctrl_B
|
|||
|
|
controlDown("right");
|
|||
|
|
} else if (e && e.code.replaceAll("Key", '') === amplify) { // Ctrl_B
|
|||
|
|
controlDown("amplify");
|
|||
|
|
} else if (e && e.code.replaceAll("Key", '') === shrink) { // Ctrl_B
|
|||
|
|
controlDown("shrink");
|
|||
|
|
} else if (e && e.code.replaceAll("Key", '') === farFocus) { // Ctrl_B
|
|||
|
|
controlDown("farFocus");
|
|||
|
|
} else if (e && e.code.replaceAll("Key", '') === nearFocus) { // Ctrl_B
|
|||
|
|
controlDown("nearFocus");
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
document.onkeyup = function (event) {
|
|||
|
|
numA = "";
|
|||
|
|
let e = event || window.event || arguments.callee.caller.arguments[0];
|
|||
|
|
if (e && e.code.replaceAll("Key", '') === up) { // Ctrl_B
|
|||
|
|
controlUp("up");
|
|||
|
|
} else if (e && e.code.replaceAll("Key", '') === down) { // Ctrl_B
|
|||
|
|
controlUp("down");
|
|||
|
|
} else if (e && e.code.replaceAll("Key", '') === left) { // Ctrl_B
|
|||
|
|
controlUp("left");
|
|||
|
|
} else if (e && e.code.replaceAll("Key", '') === right) { // Ctrl_B
|
|||
|
|
controlUp("right");
|
|||
|
|
} else if (e && e.code.replaceAll("Key", '') === amplify) { // Ctrl_B
|
|||
|
|
controlUp("amplify");
|
|||
|
|
} else if (e && e.code.replaceAll("Key", '') === shrink) { // Ctrl_B
|
|||
|
|
controlUp("shrink");
|
|||
|
|
} else if (e && e.code.replaceAll("Key", '') === farFocus) { // Ctrl_B
|
|||
|
|
controlUp("farFocus");
|
|||
|
|
} else if (e && e.code.replaceAll("Key", '') === nearFocus) { // Ctrl_B
|
|||
|
|
controlUp("nearFocus");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
function controlDown(type) {
|
|||
|
|
if(isProhibitKey){
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
//统一视频
|
|||
|
|
if(ty_code==passWay){
|
|||
|
|
let key= tyControlType[type];
|
|||
|
|
nrUvpVideoObj.uvpVideoControl({ devCode:videoObject.devCode, cmd:key[0] })
|
|||
|
|
}else{
|
|||
|
|
if (videoObject.playState) {
|
|||
|
|
let key= qxControlType[type];
|
|||
|
|
if (key[2]) {
|
|||
|
|
//清新 -球机移动
|
|||
|
|
turnControl(key[0], videoObject.devCode).then(r => {
|
|||
|
|
});
|
|||
|
|
} else {
|
|||
|
|
//球机放大缩小
|
|||
|
|
qxControl(videoObject.devCode, key[1])
|
|||
|
|
}
|
|||
|
|
}else {
|
|||
|
|
layer.msg("请先播放视频....", {icon: 0});
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
function controlUp(type) {
|
|||
|
|
if(isProhibitKey){
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
if(ty_code==passWay){
|
|||
|
|
let key= tyControlType[type];
|
|||
|
|
nrUvpVideoObj.uvpVideoControl({ devCode:videoObject.devCode, cmd:key[1] })
|
|||
|
|
}else{
|
|||
|
|
if(videoObject.playState) {
|
|||
|
|
//球机移动
|
|||
|
|
let key = qxControlType[$(this).attr('id')];
|
|||
|
|
if (key[2]) {
|
|||
|
|
turnControl(key[3], videoObject.devCode).then(r => {
|
|||
|
|
});
|
|||
|
|
} else {
|
|||
|
|
qxControl(videoObject.devCode, key[3])
|
|||
|
|
}
|
|||
|
|
} else {
|
|||
|
|
layer.msg("请先播放视频....", {icon: 0});
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
function set3DisTrue(){
|
|||
|
|
let is3D = $('#3dset').prop('checked')
|
|||
|
|
if(is3D){
|
|||
|
|
layer.msg('已开启3D云台', {icon: 1})
|
|||
|
|
}else{
|
|||
|
|
layer.msg('已关闭3D云台', {icon: 1})
|
|||
|
|
}
|
|||
|
|
localStorage.setItem("threeD",is3D);
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
function configure() {
|
|||
|
|
let height = '80%', width = '30%';
|
|||
|
|
let index = parent.layer.open({
|
|||
|
|
id: "configure",
|
|||
|
|
title: ['快捷键设置', 'font-size:18px;'],
|
|||
|
|
type: 2,
|
|||
|
|
shade: 0.1,
|
|||
|
|
shadeClose: false,
|
|||
|
|
maxmin: false,
|
|||
|
|
content: '../video/configure.html',
|
|||
|
|
area: [width, height],
|
|||
|
|
});
|
|||
|
|
}
|