video_monitoring-list-x.html 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1">
  6. <link rel="stylesheet" href="https://apps.bdimg.com/libs/jquerymobile/1.4.5/jquery.mobile-1.4.5.min.css">
  7. <style type="text/css">
  8. body {background-color: #f1f0f5;}
  9. table,tr,td,th {border: 0px; color: #6e6e6e; font-size: 14px; margin: 0px; padding:0px; border-spacing:0px; border-style:none; border-collapse:collapse;}
  10. p {margin: 20px auto 20px auto;text-align: center;}
  11. video {margin: 20px;text-align: center;}
  12. .timenum {color: #1993c7; font-size: 24px;}
  13. .ui-content {margin: 0px; padding: 0px; background-color: #ffffff; }
  14. .gray {
  15. -webkit-filter: grayscale(100%);
  16. -moz-filter: grayscale(100%);
  17. -ms-filter: grayscale(100%);
  18. -o-filter: grayscale(100%);
  19. filter: grayscale(100%);
  20. filter: gray;
  21. opacity:0.7;//通过改变透明度来调节灰色的程度
  22. }
  23. a {text-decoration:none;}
  24. </style>
  25. <script src="https://apps.bdimg.com/libs/jquery/1.10.2/jquery.min.js"></script>
  26. <script src="https://apps.bdimg.com/libs/jquerymobile/1.4.5/jquery.mobile-1.4.5.min.js"></script>
  27. <script type="text/javascript">
  28. var arr={$arr1|json_encode=true};
  29. var companyid={$companyid};
  30. var vidoeStore;
  31. var count = 0, reCount=0;
  32. var removeDIV=function(id){
  33. var obj = document.getElementById(id);
  34. var parent = obj.parentNode;
  35. parent.removeChild(obj);
  36. }
  37. var getNow = function(s){
  38. return s<10?('0'+s):s;
  39. }
  40. var gettime = function(){
  41. var myDate = new Date();
  42. var year = myDate.getFullYear();
  43. var month = myDate.getMonth()+1;
  44. var date = myDate.getDate();
  45. var hour = myDate.getHours();
  46. var min = myDate.getMinutes();
  47. var sec = myDate.getSeconds();
  48. return (year+'-'+getNow(month)+'-'+getNow(date)+' '+getNow(hour)+':'+getNow(min)+':'+getNow(sec));
  49. }
  50. var open_video = function(id){
  51. if($("#openid").val()!=id)
  52. $("#openid").val(id);
  53. for(var n=0;n<vidoeStore.RESULT.LIST.length;n++){
  54. if(vidoeStore.RESULT.LIST[n].DEVICE==$("#openid").val()){
  55. if(vidoeStore.RESULT.LIST[n].ONAIR){
  56. window.location="https://qhome.usky.cn/video2.html?device="+id+"&companyid="+companyid;
  57. return;
  58. }
  59. }
  60. }
  61. count = 0;
  62. reCount = 0;
  63. var mask = document.getElementById('videomask');
  64. if(mask==undefined){
  65. var mwidth = $(window).width();
  66. var mheight = $(window).height();
  67. mask = document.createElement('div');
  68. mask.id = 'videomask';
  69. mask.style.position = 'absolute';
  70. mask.style.top = '0px';
  71. mask.style.left = '0px';
  72. mask.style.width = $(window).width()+'px';
  73. mask.style.height = $(window).height()+'px';
  74. mask.style.backgroundColor = 'rgba(0,0,0,0.3)';
  75. document.getElementById("pagethree").appendChild(mask);
  76. var note = document.createElement('div');
  77. note.style.textAlign='center';
  78. note.style.margin = '300px '+((mwidth-60)/2)+'px 0px '+((mwidth-60)/2)+'px';
  79. note.innerHTML='Loading...';
  80. mask.appendChild(note);
  81. }
  82. var d = {
  83. CMD:3,
  84. BODY:{
  85. DEVICE:id,
  86. ACTION:1,
  87. IDX:7
  88. }
  89. }
  90. $.ajax({
  91. url:"https://fire.usky.cn:8443/YtIoT/cgi-bin/demo2.cgi",
  92. type:'POST',
  93. data: 'queryJson:'+JSON.stringify(d),
  94. success:function(result){
  95. setTimeout(chk_video,5000);
  96. }
  97. })
  98. }
  99. var chk_video = function(){
  100. var d = {
  101. CMD:1
  102. }
  103. if($("#openid").val().length==0)
  104. $("#videoinfobody").html("<p> Loading... </p>");
  105. $.ajax({
  106. url:"https://fire.usky.cn:8443/YtIoT/cgi-bin/demo2.cgi",
  107. type:'POST',
  108. data: 'queryJson:'+JSON.stringify(d),
  109. success:function(result){
  110. var json = eval('(' + result + ')');
  111. vidoeStore = json;
  112. //alert(vidoeStore);
  113. if($("#openid").val().length>0){
  114. for(var n=0;n<json.RESULT.LIST.length;n++){
  115. if($("#openid").val()==json.RESULT.LIST[n].DEVICE){
  116. reCount++;
  117. if(json.RESULT.LIST[n].ONAIR){
  118. if((++count)>2){
  119. var mask = document.getElementById('videomask');
  120. if(mask!=undefined){
  121. removeDIV('videomask');
  122. }
  123. window.location="https://qhome.usky.cn/video2.html?device="+json.RESULT.LIST[n].DEVICE+"&companyid="+companyid;
  124. }else{
  125. setTimeout(chk_video,5000);
  126. }
  127. }else{
  128. setTimeout(chk_video,5000);
  129. }
  130. if(reCount>5){
  131. var mask = document.getElementById('videomask');
  132. if(mask!=undefined){
  133. removeDIV('videomask');
  134. }
  135. $("#myPopup").popup("open");
  136. }
  137. break;
  138. }
  139. }
  140. }else{
  141. var header = $(".ui-header");
  142. var footer = $(".ui-footer");
  143. var contentCurrent = $(".ui-content").outerHeight() - $(".ui-content").height();
  144. var viewport_height = $(window).height();
  145. var content_height = viewport_height - header.outerHeight() - footer.outerHeight()-contentCurrent;
  146. $("#videoinfobody").html("");
  147. $("#videoinfobody").css({
  148. "padding":'0px',
  149. "margin":'0px',
  150. "height":(content_height+"px"),
  151. "overflow-y":"auto",
  152. "overflow-x":"none"
  153. });
  154. var div = document.getElementById("videoinfobody");
  155. var table3 = document.createElement("table");
  156. table3.width='100%';
  157. table3.style.borderTop = '5px solid #c8c8c8';
  158. table3.style.borderBottom = '1px solid #c8c8c8';
  159. div.appendChild(table3);
  160. var table6 = document.createElement("table");
  161. table6.border='0';
  162. table6.cellspacing='0';
  163. table6.cellpadding='0';
  164. table6.style.margin='10px 10px 30px 10px';
  165. table6.style.width= ($(window).width()-20)+'px';
  166. table6.style.border='1px solid #dadada';
  167. table6.style.color="#000000";
  168. div.appendChild(table6);
  169. var tr8 = document.createElement("tr");
  170. tr8.style.border='1px solid #dadada';
  171. tr8.style.height='36px';
  172. tr8.style.backgroundColor='#dadada';
  173. table6.appendChild(tr8);
  174. var td24 = document.createElement("th");
  175. tr8.appendChild(td24);
  176. var td25 = document.createElement("th");
  177. td25.innerHTML="设备编号";
  178. tr8.appendChild(td25);
  179. var td26 = document.createElement("th");
  180. td26.innerHTML="在线状态";
  181. tr8.appendChild(td26);
  182. var td27 = document.createElement("th");
  183. td27.innerHTML="操作";
  184. tr8.appendChild(td27);
  185. var num = 0;
  186. for(var n=0;n<json.RESULT.LIST.length;n++){
  187. var online = (json.RESULT.LIST[n].ALIVEVALUE==3)?true:false;
  188. for(var i=0;i<arr.length;i++){
  189. //alert(json.RESULT.LIST[n].DEVICE);
  190. //alert(arr[i]);
  191. if(json.RESULT.LIST[n].DEVICE==arr[i]){
  192. var trr = document.createElement("tr");
  193. trr.style.border='1px solid #dadada';
  194. trr.style.height='36px';
  195. table6.appendChild(trr);
  196. var tdd1 = document.createElement("th");
  197. tdd1.innerHTML=(i+1);
  198. trr.appendChild(tdd1);
  199. var tdd2 = document.createElement("td");
  200. tdd2.innerHTML=json.RESULT.LIST[n].DEVICE;
  201. trr.appendChild(tdd2);
  202. var tdd3 = document.createElement("td");
  203. tdd3.style.textAlign='center';
  204. if(online)
  205. tdd3.innerHTML='<span style="color:#00bf95">在线</span>';
  206. else
  207. tdd3.innerHTML='<span style="color:#ff6d00">离线</span>';
  208. trr.appendChild(tdd3);
  209. var tdd4 = document.createElement("td");
  210. tdd4.style.textAlign='center';
  211. trr.appendChild(tdd4);
  212. var todo = document.createElement("div");
  213. todo.style.width='24px';
  214. todo.style.height='24px';
  215. todo.style.margin='0px auto 0px auto';
  216. todo.style.backgroundImage='url(__PUBLIC__/wxapp/images/video-x.png)';
  217. if(!online)
  218. todo.setAttribute('class','gray');
  219. else{
  220. todo.setAttribute('onclick','open_video("'+json.RESULT.LIST[n].DEVICE+'")');
  221. num++;
  222. }
  223. tdd4.appendChild(todo);
  224. }
  225. }
  226. }
  227. if(json.RESULT.LIST.length>0){
  228. var tmp = (num*100/json.RESULT.LIST.length);
  229. $("#video_online").html('在线率:'+((tmp>80)?('<span style="color:#00bf95">'+tmp.toFixed(2)+'%</span>')
  230. :('<span style="color:#ff6d00">'+tmp.toFixed(2)+'%</span>')));
  231. }
  232. }
  233. }
  234. })
  235. }
  236. var resizebody = function(){
  237. scroll(0, 0);
  238. var header = $(".ui-header");
  239. var footer = $(".ui-footer");
  240. var contentCurrent = $(".ui-content").outerHeight() - $(".ui-content").height();
  241. var viewport_height = $(window).height();
  242. var headerHeight = header.outerHeight();
  243. var footerHeight = footer.outerHeight();
  244. if(headerHeight!=undefined)
  245. $("#headerHeight").val(headerHeight);
  246. if(footerHeight!=undefined)
  247. $("#footerHeight").val(footerHeight);
  248. var content_height = viewport_height - $("#headerHeight").val() - $("#footerHeight").val() -contentCurrent;
  249. $(".ui-content").height(content_height);
  250. };
  251. var chkinfo = function(){
  252. chk_video();
  253. resizebody();
  254. };
  255. $(document).ready(function(){
  256. $(window).bind("orientationchange resize load", resizebody);
  257. });
  258. </script>
  259. <title>永天云服务器</title>
  260. </head>
  261. <body onload="chkinfo()">
  262. <div data-role="page" id="pagethree">
  263. <div data-role="header" data-theme="b">
  264. <a href="__MODULE__/index/index{$tokenurl}/companyid/{$companyid}" class="ui-btn ui-btn-left ui-icon-back ui-btn-icon-left" data-ajax="false">返回</a>
  265. <h1>视频监测</h1>
  266. <a href="#" class="ui-btn ui-icon-refresh ui-btn-icon-notext ui-btn-right" onclick="chk_video()">刷新</a>
  267. </div>
  268. <div id="videoinfo" data-role="content" class="ui-content">
  269. <div id="videoinfobody">
  270. </div>
  271. <div data-role="popup" id="myPopup">
  272. <a href="#pagethree" data-rel="back" class="ui-btn ui-corner-all ui-shadow ui-btn ui-icon-delete ui-btn-icon-notext ui-btn-right">关闭</a>
  273. <p>远程摄像头连接超时,请稍后再试</p>
  274. </div>
  275. </div>
  276. </div>
  277. <input id='openid' name='openid' type='hidden' value=''/>
  278. <input type="hidden" id="headerHeight" name="headerHeight" value="44">
  279. <input type="hidden" id="footerHeight" name="footerHeight" value="58">
  280. </body>
  281. </html>