/** * Created by zhumingyue on 2016/2/27. */ var pos = {afterX:0,afterY:0,nowX:0,nowY:0,divX:0,divY:0}; $(function(){ setWH(); $(window).resize(function(){ setWH(); }); $("body").mouseover(function(){ $(".search_emer_video").show(); }); $("body").mouseout(function(){ $(".search_emer_video").hide(); }); }); $(function(){ LoginServer(); $(".show_bar").toggle( function(){ $("#sideBar").slideUp(0); }, function(){ $("#sideBar").slideDown(0); } ); }); function resolveUrl(){ var encondeCondition=window.location.search; var condition= decodeURI(decodeURI(encondeCondition.substring(1,encondeCondition.length))); var conditionArr=condition.split("&"); var condJson={}; for(var item in conditionArr){ var temArr=conditionArr[item].split("="); condJson[temArr[0]]=temArr[1]; } userInfo = condJson; return condJson; }; /** * 登录 */ function LoginServer(){ var url = $.pathname() + "/ws/cockpit/CockpitService/getSyncConfig"; $.post(url,function(data){ ocx.LoginServer(data.ip,data.port,data.name,data.pwd,data.mode); // ocx.LoginServer(data.ip,data.port,"tang","009cd3e062b7ae641621d234be10df3a",data.mode); },'json'); } function setWH(){ var winHei = $(window).height(); var winWid = $(window).width(); $("#main_tab").height(winHei-30); $("#main_tab").width(winWid); }; function activityPanl(){ $(".top_bar").css("height","100%"); $(".bottom_bar").css("height","0"); $("#con_panl").addClass("con_panl"); }; function removeActivity(){ $(".top_bar").css("height","45%"); $(".bottom_bar").css("height","55%"); $("#con_panl").removeClass("con_panl"); }; /* 树形菜单和拖动框初始化 */ function initComplete(){ var deptId = resolveUrl()["dept_id"]; var setting = { async: { enable: true, dataType: 'JSON', //返回的JSON数据的名字 dataName: 'treeNodes', contentType: "application/json", url:'/nwyj/ws/cockpit/CockpitService/getSync', otherParam:{"deptId":deptId}, autoParam: ["id", "name", "name=reName"] } }; zTree = $.fn.zTree.init($("#dept_tree"), setting); }; /* 监听鼠标是否移动 */ function showcoords(e,obj){ var e = window.event || e; pos.nowX = e.clientX; pos.nowY = e.clientY; } function changeXY(){ if(pos.afterX==pos.nowX && pos.afterY==pos.nowY){ $("#m_img").slideUp(0); $("#s_img").slideUp(0); }else{ pos.afterX = pos.nowX; pos.afterY = pos.nowY; } }; /* 拖动控制栏 */ function cl(x,y){ pos.divX = x ; pos.divY = y ; $(document).bind('mousemove',function(e){ con_panl_move(event,this); }); } function al(){ $(document).unbind('mousemove'); } function con_panl_move(e,obj){ var e = window.event || e; var x = e.clientX - pos.divX; var y = e.clientY - pos.divY; $("#x").val("X:" + x); $("#y").val("Y:" + y); $("#con_panl").css({left:x+"px",top:y+"px"}); } /* 分屏 */ function SetWinNum(winnum){ ocx.SetWndNum(winnum); } /* 打开视频 */ function openVideo(CameraID){ //var CameraID=$("#vid").val(); //$(".titleBar").html(CameraID); con_panl.window.setVideoId(CameraID); var nSelWndNo = 0; nSelWndNo = ocx.GetSelWndIndex(); ocx.OpenVideo(CameraID,nSelWndNo ); } /* 关闭 */ function closeVideo(){ var nSelWndNo = 0; nSelWndNo = ocx.GetSelWndIndex(); ocx.CloseVideo(nSelWndNo); } /* 抓图 */ function capturePicture(){ ocx.CapturePicture("f:\\1111111.bmp"); } /* 录屏 */ function startRecord(){ ocx.StartRecord("f:\\22222222.dav"); } /* 停止录屏 */ function stopRecord(){ ocx.StopRecord(); } /* 操控 */ function PTZControl(cmd,stop){ // var step = $("#steps").val();//步长设置 var step = window.frames["con_panl"].$("#steps").val(); ocx.PTZControl(cmd,step,stop); }