680 lines
22 KiB
Plaintext
680 lines
22 KiB
Plaintext
|
|
let dtree, util, tree,layer;
|
|||
|
|
let noNum = 0, num = 0, all = 0;
|
|||
|
|
let type = 'city';
|
|||
|
|
let puidParam;
|
|||
|
|
let winDom = 'videoPlayer1';
|
|||
|
|
layui.extend({
|
|||
|
|
dtree: '../../js/layui_dtree/dtree/dtree'
|
|||
|
|
}).use(['util', 'dtree','layer'], function () {
|
|||
|
|
util = layui.util;
|
|||
|
|
dtree = layui.dtree;
|
|||
|
|
layer = layui.layer;
|
|||
|
|
initTreeCity("");
|
|||
|
|
initVideo();
|
|||
|
|
//按钮点击事件
|
|||
|
|
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;
|
|||
|
|
let passWay = localStorage.getItem("passWay");
|
|||
|
|
if (passWay == null || passWay == '') {
|
|||
|
|
passWay = 'to-2';
|
|||
|
|
}
|
|||
|
|
if (data.genre === '1') {
|
|||
|
|
if (!isEmpty(data.puid)) {
|
|||
|
|
if (videoObject.devCode !== data.puid) {
|
|||
|
|
videoObject.devCode = passWay === 'to-1' ? data.tCode : data.puid;
|
|||
|
|
videoObject.videoType = passWay;
|
|||
|
|
puidParam=data.puid;
|
|||
|
|
playVideo(1, videoObject.devCode, devName, videoObject.videoType);
|
|||
|
|
} else {
|
|||
|
|
layer.msg("视频正在播放中....", {icon: 0});
|
|||
|
|
}
|
|||
|
|
} else {
|
|||
|
|
layer.msg("工程未绑定球机", {icon: 0});
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
} 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 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().post({
|
|||
|
|
headers: {
|
|||
|
|
"encrypt": sm3(JSON.stringify({
|
|||
|
|
keyWord: $('#keyWord').val()
|
|||
|
|
}))
|
|||
|
|
},
|
|||
|
|
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().post({
|
|||
|
|
headers: {
|
|||
|
|
"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().post({
|
|||
|
|
headers: {
|
|||
|
|
"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().post({
|
|||
|
|
headers: {
|
|||
|
|
"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, devName, videoType) {
|
|||
|
|
videos.closeAllVideo();
|
|||
|
|
destoryVideo(flvPlayer);
|
|||
|
|
if (videoObject.videoType !== 'to-1') {
|
|||
|
|
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)
|
|||
|
|
}
|
|||
|
|
} else {
|
|||
|
|
let index = devCode.indexOf("-");
|
|||
|
|
if(index > 0){ // 固定球机播放
|
|||
|
|
let puid = devCode.substring(0,index);
|
|||
|
|
let idx = devCode.substring(index + 1,devCode.length);
|
|||
|
|
TYPlayVideo(1, puid, devName)
|
|||
|
|
}else{
|
|||
|
|
TYPlayVideo(1, devCode, devName)
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 云台控制
|
|||
|
|
* @param devCode
|
|||
|
|
*/
|
|||
|
|
function playControl() {
|
|||
|
|
let key;
|
|||
|
|
//点击事件
|
|||
|
|
let btn = $('[lay-event=control]');
|
|||
|
|
btn.unbind();
|
|||
|
|
btn.mousedown(function (event) {
|
|||
|
|
if (videoObject.playState) {
|
|||
|
|
if (videoObject.videoType !== 'to-1') {
|
|||
|
|
key = qxControlType[$(this).attr('id')];
|
|||
|
|
if (key[2]) {
|
|||
|
|
turnControl(key[0], videoObject.devCode).then(r => {
|
|||
|
|
});
|
|||
|
|
} else {
|
|||
|
|
qxControl(videoObject.devCode, key[1])
|
|||
|
|
}
|
|||
|
|
} else {
|
|||
|
|
key = controlType[$(this).attr('id')][0]
|
|||
|
|
videos.videoControl(videoObject.devCode, key, 5, 5);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
event.stopPropagation();
|
|||
|
|
}).mouseup(function (event) {
|
|||
|
|
if (videoObject.playState) {
|
|||
|
|
if (videoObject.videoType !== 'to-1') {
|
|||
|
|
key = qxControlType[$(this).attr('id')];
|
|||
|
|
if (key[2]) {
|
|||
|
|
turnControl(key[3], videoObject.devCode).then(r => {
|
|||
|
|
});
|
|||
|
|
} else {
|
|||
|
|
qxControl(videoObject.devCode, key[3])
|
|||
|
|
}
|
|||
|
|
} else {
|
|||
|
|
key = controlType[$(this).attr('id')][1]
|
|||
|
|
videos.videoControl(videoObject.devCode, key, 5, 5);
|
|||
|
|
}
|
|||
|
|
} 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;
|
|||
|
|
}
|
|||
|
|
let key;
|
|||
|
|
if (videoObject.playState) {
|
|||
|
|
if (videoObject.videoType === 'to-2') {
|
|||
|
|
key = qxControlType[type];
|
|||
|
|
if (key[2]) {
|
|||
|
|
console.log(key[2]);
|
|||
|
|
turnControl(key[0], videoObject.devCode).then(r => {
|
|||
|
|
});
|
|||
|
|
} else {
|
|||
|
|
console.log(key[3]);
|
|||
|
|
qxControl(videoObject.devCode, key[1])
|
|||
|
|
}
|
|||
|
|
} else {
|
|||
|
|
key = controlType[type][0]
|
|||
|
|
console.log(key);
|
|||
|
|
videos.videoControl(videoObject.devCode, key, 5, 5);
|
|||
|
|
}
|
|||
|
|
} else {
|
|||
|
|
layer.msg("请先播放视频....", {icon: 0});
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
function controlUp(type) {
|
|||
|
|
if(isProhibitKey){
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
let key;
|
|||
|
|
if (videoObject.playState) {
|
|||
|
|
if (videoObject.videoType === 'to-2') {
|
|||
|
|
key = qxControlType[type];
|
|||
|
|
if (key[2]) {
|
|||
|
|
turnControl(key[3], videoObject.devCode).then(r => {
|
|||
|
|
});
|
|||
|
|
} else {
|
|||
|
|
qxControl(videoObject.devCode, key[3])
|
|||
|
|
}
|
|||
|
|
} else {
|
|||
|
|
key = controlType[type][0]
|
|||
|
|
videos.videoControl(videoObject.devCode, key, 5, 5);
|
|||
|
|
}
|
|||
|
|
} 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],
|
|||
|
|
});
|
|||
|
|
}
|