equipmanage_jk1.html 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898
  1. {% load staticfiles %}
  2. <!DOCTYPE html>
  3. <html lang="zh-CN">
  4. <head>
  5. <meta charset="UTF-8">
  6. <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  7. <link href="{% static '/lib/bootstrap-3.3.7/css/bootstrap.css' %}" rel="stylesheet">
  8. <link rel="stylesheet" href="{% static '/lib/font-awesome/4.5.0/css/font-awesome.css' %}">
  9. <link rel="stylesheet" href="{% static '/lib/css/ace.min.css' %}" />
  10. <link rel="stylesheet" href="{% static '/lib/layui/css/layui.css' %}">
  11. <meta name="renderer" content="webkit">
  12. <title>测试页面</title>
  13. <style>
  14. body {
  15. background: #fff;
  16. }
  17. .flashDownDiv,
  18. .nullData {
  19. text-align: center;
  20. font-size: 14px;
  21. height: 630px;
  22. }
  23. .flashDownDiv p:first-child,
  24. .nullData p:first-child {
  25. padding-top: 10%;
  26. }
  27. .flashShowDiv,
  28. .flashDownDiv,
  29. .nullData {
  30. display: none;
  31. }
  32. /* 视频框 */
  33. .equipname {
  34. position: absolute;
  35. display: none;
  36. }
  37. #divMain .a1 {
  38. width: 100%;
  39. height: 100%;
  40. }
  41. #divMain .a4 {
  42. width: 50%;
  43. height: 50%;
  44. }
  45. #divMain .a9 {
  46. width: 33.33%;
  47. height: 33.33%;
  48. }
  49. #divMain .a16 {
  50. width: 25%;
  51. height: 25%;
  52. }
  53. #divMain a,
  54. a:visited {
  55. float: left;
  56. border: 1px solid #000;
  57. margin: 0 -1px -1px 0;
  58. position: relative;
  59. text-decoration: none;
  60. }
  61. #divMain .aSelected {
  62. z-index: 9;
  63. border: 1px solid #dbffc9;
  64. }
  65. /* 多屏选择 */
  66. .v1 {
  67. cursor: pointer;
  68. width: 23px;
  69. height: 23px;
  70. display: inline-table;
  71. }
  72. .v1,
  73. .v4,
  74. .v9,
  75. .v16 {
  76. color: #fff;
  77. font-size: 24px;
  78. }
  79. .v1{
  80. background: url(../static/img/jkbtn/1.png) no-repeat center;
  81. }
  82. .v1:hover,.v1.active{
  83. background: url(../static/img/jkbtn/11.png) no-repeat center;
  84. }
  85. .v1.active,
  86. .v1:hover {
  87. color: #37CAB9;
  88. }
  89. .v4 {
  90. cursor: pointer;
  91. width: 23px;
  92. height: 23px;
  93. display: inline-table;
  94. }
  95. .v4{
  96. background: url(../static/img/jkbtn/2.png) no-repeat center;
  97. }
  98. .v4:hover,.v4.active{
  99. background: url(../static/img/jkbtn/22.png) no-repeat center;
  100. }
  101. .v4.active,
  102. .v4:hover {
  103. color: #37CAB9;
  104. }
  105. .v9 {
  106. cursor: pointer;
  107. width: 23px;
  108. height: 23px;
  109. display: inline-table;
  110. }
  111. .v9{
  112. background: url(../static/img/jkbtn/3.png) no-repeat center;
  113. }
  114. .v9:hover,.v9.active{
  115. background: url(../static/img/jkbtn/33.png) no-repeat center;
  116. }
  117. .v9.active,
  118. .v9:hover {
  119. color: #37CAB9;
  120. }
  121. .v16{
  122. background: url(../static/img/jkbtn/4.png) no-repeat center;
  123. }
  124. .v16:hover,.v16.active{
  125. background: url(../static/img/jkbtn/44.png) no-repeat center;
  126. }
  127. .v16,
  128. .v16:hover {
  129. cursor: pointer;
  130. width: 23px;
  131. height: 23px;
  132. display: inline-table;
  133. }
  134. /* 列表 */
  135. .scrollDiv {
  136. overflow-x: hidden;
  137. line-height: 40px;
  138. height: 100%;
  139. width: 220px;
  140. }
  141. #jkList {
  142. width: 220px;
  143. }
  144. #jkList>div {
  145. color: #fff;
  146. vertical-align: middle;
  147. line-height: 40px;
  148. padding: 0px 15px;
  149. white-space: nowrap;
  150. width: 220px;
  151. /* text-overflow: ellipsis;
  152. overflow: hidden;
  153. cursor: pointer; */
  154. }
  155. #jkList>div.active,
  156. #jkList>div:hover {
  157. color: rgb(255, 255, 0);
  158. background-color: #36404D;
  159. }
  160. /* 控制 */
  161. .ctrlBox {
  162. /* display: none; */
  163. position: absolute;
  164. /* background: #685f5f; */
  165. z-index: 99999;
  166. padding: 0 20px;
  167. width: 220px;
  168. height: 275px;
  169. left: 0;
  170. bottom: 20px;
  171. /* border: 1px solid #000; */
  172. border-radius: 30px 30px 50px 50px;
  173. }
  174. .addCtrl,
  175. .cutCtrl,
  176. .minusCtrl,
  177. .directionCtrl>div {
  178. position: absolute;
  179. width: 50px;
  180. height: 50px;
  181. cursor: pointer;
  182. }
  183. .addCtrl {
  184. top: 50px;
  185. background: url(../static/img/jkbtn/jkadd.png) no-repeat center;
  186. background-size: 100% 100%;
  187. }
  188. .cutCtrl {
  189. top: 50px;
  190. left: 50%;
  191. margin-left: -18px;
  192. background: url(../static/img/jkbtn/cut.png) no-repeat center;
  193. background-size: 100% 100%;
  194. }
  195. .minusCtrl {
  196. top: 50px;
  197. right: 11px;
  198. background: url(../static/img/jkbtn/jkminus.png) no-repeat center;
  199. background-size: 100% 100%;
  200. }
  201. .directionCtrl {
  202. position: absolute;
  203. width: 200px;
  204. height: 200px;
  205. bottom: -20px;
  206. background: url(../static/img/jkbtn/jkctrl.png) no-repeat center;
  207. background-size: 90% 90%;
  208. }
  209. .upCtrl {
  210. top: 20px;
  211. left: 50%;
  212. margin-left: -25px;
  213. }
  214. .leftCtrl {
  215. left: 20px;
  216. top: 50%;
  217. margin-top: -25px;
  218. }
  219. .bottomCtrl {
  220. bottom: 20px;
  221. left: 50%;
  222. margin-left: -25px;
  223. }
  224. .rightCtrl {
  225. right: 20px;
  226. top: 50%;
  227. margin-top: -25px;
  228. }
  229. /* fenpei */
  230. .fenpei {
  231. color: #fff;
  232. text-align: center;
  233. }
  234. .fenpei span {
  235. padding: 3px 5px;
  236. }
  237. .fenpei .jianbtn,
  238. .fenpei .jiabtn {
  239. cursor: pointer;
  240. }
  241. #downpath {
  242. width: 100%;
  243. height: 80px;
  244. resize: none;
  245. margin-top: 10px;
  246. }
  247. .page-header {
  248. margin: 0 0 12px;
  249. border-bottom: 1px dotted #E2E2E2;
  250. padding-right: 35px;
  251. padding-top: 7px;
  252. text-align: right;
  253. }
  254. .page-header a {
  255. color: #31b4ff;
  256. font-size: 16px;
  257. }
  258. .page-header a:hover{
  259. color: #0074b6;
  260. }
  261. /* 查看图片按钮 */
  262. .lookjkPhoto{
  263. color: #cfa301;
  264. margin: 0 5px;
  265. line-height: 25px;
  266. }
  267. .lookjkPhoto:hover{
  268. color: rgb(255, 255, 0);
  269. }
  270. .lookjkPhoto:active,.lookjkPhoto:focus{
  271. color: #cfa301;
  272. }
  273. .jkNameSpan{
  274. vertical-align: middle;
  275. display: inline-block;
  276. width: 51%;
  277. text-overflow: ellipsis;
  278. overflow: hidden;
  279. cursor: pointer;
  280. }
  281. table{
  282. border: none;
  283. }
  284. #windowCtrl{
  285. text-align: center;
  286. }
  287. #playback{
  288. background: url(../static/img/playBackBj.png) no-repeat;
  289. width: 80px;
  290. height: 30px;
  291. background-size: 100% 100%;
  292. border: none;
  293. color: #868686;
  294. }
  295. /* 监控在线图标 */
  296. .onLine{
  297. display: inline-block;
  298. width: 10px;
  299. height: 10px;
  300. border-radius: 50%;
  301. background: #2ff235;
  302. vertical-align: middle;
  303. margin-right: 10px;
  304. }
  305. .offLine{
  306. display: inline-block;
  307. width: 10px;
  308. height: 10px;
  309. border-radius: 50%;
  310. background: #8b8a8a;
  311. vertical-align: middle;
  312. margin-right: 10px;
  313. }
  314. </style>
  315. </head>
  316. <script>
  317. </script>
  318. <body>
  319. <script src="{% static '/lib/js/ezuikit.js' %}"></script>
  320. <div class="content">
  321. <div class="searchCover page-header">
  322. <a href="equipmanage_jk1" target="BoardRight">
  323. 切换成插件播放
  324. <i class="fa fa-share" aria-hidden="true"></i>
  325. </a>
  326. </div>
  327. <div class="innerTable">
  328. <div class="nullData">
  329. <p>暂无设备</p>
  330. <p>请先添加设备</p>
  331. </div>
  332. <div class="flashDownDiv">
  333. <p>您没有安装flash插件,无法播放视频</p>
  334. <p>请先下载安装最新的flash插件</p>
  335. <a href="https://get.adobe.com/cn/flashplayer/" class="btn btn-primary">
  336. <i class="fa fa-download" aria-hidden="true"></i>
  337. 下载视频控件
  338. </a>
  339. </div>
  340. <div class="flashShowDiv">
  341. <div style="display: table; width: 100%;" id="jk_main">
  342. <!-- 视频框 -->
  343. <div style="display: table-cell;">
  344. <div id="divMain" style="width: 100%; height:870px; background: rgb(49, 58, 71); margin: auto; padding: 15px; position: relative; z-index: 9999;">
  345. </div>
  346. <div style="clear: both; width: 100%; height: 45px; line-height: 45px; background: rgb(49, 58, 71); padding-left: 13px;">
  347. <span class="v1" id="span_V1" onclick="CreateVidewDiv(1);">
  348. </span>
  349. <span class="v4" id="span_V4" onclick="CreateVidewDiv(4);">
  350. </span>
  351. <span class="v9" id="span_V9" onclick="CreateVidewDiv(9);">
  352. </span>
  353. <span class="v16" id="span_V16" onclick="CreateVidewDiv(16);">
  354. </span>
  355. <!-- <span class="v4" id="span_V4" onclick="CreateVidewDiv(9);"></span> -->
  356. <!-- <span class="v4" id="span_V4" onclick="CreateVidewDiv(9);">qqq</span> -->
  357. <!-- <button id="playback">查看回放</button> -->
  358. </div>
  359. </div>
  360. <!-- 控制 -->
  361. <div id="div_ControlPanel" style="position:relative;display: table-cell; width: 220px; height: 778px; overflow: hidden; background: rgb(70, 78, 96); vertical-align: top;">
  362. <table style="width: 100%">
  363. <tr>
  364. <td>
  365. <div class="scrollDiv">
  366. <div id="jkList">
  367. <!-- <div>
  368. <img src="{% static 'img/sxtIcon.png' %}" width="26px" alt=""> 祥泰
  369. </div>
  370. <div class="active">
  371. <img src="{% static 'img/sxtIcon.png' %}" width="26px" alt=""> 祥泰祥泰祥泰祥泰祥泰祥泰祥泰祥泰祥泰祥泰祥泰祥泰祥泰祥泰祥泰祥泰祥泰祥泰
  372. </div>
  373. <div>
  374. <img src="{% static 'img/sxtIcon.png' %}" width="26px" alt=""> 祥泰
  375. </div> -->
  376. </div>
  377. <div class="fenpei">
  378. <span class="jianbtn" onclick="getjklistFun('jian')">
  379. <img src="{% static 'img/jkupicon.png' %}" width="26px" alt="">
  380. </span>
  381. <span id="currPageNum">1</span>
  382. <span>/</span>
  383. <span id="totalPageNum">9</span>
  384. <span class="jiabtn" onclick="getjklistFun('jia')">
  385. <img src="{% static 'img/jkdownicon.png' %}" width="26px" alt="">
  386. </span>
  387. </div>
  388. </div>
  389. </td>
  390. </tr>
  391. <tr>
  392. <td>
  393. <!-- <div><button id="playback1">查看回放</button></div> -->
  394. <div class="ctrlBox">
  395. <div id="windowCtrl">
  396. <button id="playback">查看回放</button>
  397. </div>
  398. <div class="addCtrl" onmousedown="configCamera(this,'move',8)" onmouseup="configCamera(this,'stop')"></div>
  399. <div class="cutCtrl" onclick="configCamera(this,'takephoto','')"></div>
  400. <div class="minusCtrl" onmousedown="configCamera(this,'move',9)" onmouseup="configCamera(this,'stop')"></div>
  401. <div class="directionCtrl">
  402. <div class="upCtrl" onmousedown="configCamera(this,'move',0)" onmouseup="configCamera(this,'stop')"></div>
  403. <div class="leftCtrl" onmousedown="configCamera(this,'move',2)" onmouseup="configCamera(this,'stop')"></div>
  404. <div class="bottomCtrl" onmousedown="configCamera(this,'move',1)" onmouseup="configCamera(this,'stop')"></div>
  405. <div class="rightCtrl" onmousedown="configCamera(this,'move',3)" onmouseup="configCamera(this,'stop')"></div>
  406. </div>
  407. </div>
  408. </td>
  409. </tr>
  410. </table>
  411. </div>
  412. </div>
  413. <!-- <div class="fenpei-bottom">
  414. <input type="hidden" id="totalPage" value={{ nums }}>
  415. <div id="page" style="text-align: center;"></div>
  416. </div> -->
  417. </div>
  418. </div>
  419. </div>
  420. <script src="{% static '/lib/js/jquery-2.1.4.min.js' %}"></script>
  421. <script src="{% static '/lib/bootstrap-3.3.7/js/bootstrap.js' %}"></script>
  422. <script src="{% static '/lib/layui/layui.all.js' %}"></script>
  423. <script src="{% static '/js/common.js' %}?versions=0.5.4"></script>
  424. <script>
  425. $.ajaxSetup({
  426. data: { csrfmiddlewaretoken: '{{ csrf_token }}' },
  427. });
  428. function CreateVidewDiv(n) {
  429. if($('#playback')){
  430. $('#playback').remove();
  431. }
  432. divNum = n;
  433. AutoNext = true;
  434. var width = "100%";
  435. var height = "100%";
  436. var html = "";
  437. for (var i = 1; i <= n; i++) {
  438. if (i == 1)
  439. html += "<a id=\"a_" + i + "\" class=\"a" + n + " aSelected\">";
  440. else
  441. html += "<a id=\"a_" + i + "\" class=\"a" + n + "\">";
  442. html += "<span id='span_deviceSerial_" + i + "' class='equipname' style=''></span>";
  443. html += "<span id='span_jktype_" + i + "' style='display:none'></span>";
  444. html += "<span id='span_cameraNo_" + i + "' style='display:none'></span>";
  445. html += "<table id=\"table_" + i + "\" style=\"width: " + width + "; height: " + height + "; margin:0 auto\">";
  446. html += "<tr style='display:none;'>";
  447. html += "<td id=\"title_" + i + "\" class=\"Video_Title\" onclick=\"setCurIndex(" + i + ")\" onmouseover=\"setMouseOver(" + i + ")\" onmouseout=\"setMouseOut(" + i + ")\"><span style='color:#999'>点此选择</span></td>";
  448. html += "</tr>";
  449. html += "<tr><td id='video_" + i + "' onclick=\"setCurIndex(" + i + ");\" onmouseover=\"setMouseOver(" + i + ")\" onmouseout=\"setMouseOut(" + i + ")\">";
  450. html += "</td></tr>";
  451. html += "</table> ";
  452. html += "</a> ";
  453. }
  454. curIndex = 1;
  455. $("#divMain").html(html);
  456. $("#span_V1").removeClass("active");
  457. $("#span_V4").removeClass("active");
  458. $("#span_V9").removeClass("active");
  459. $("#span_V16").removeClass("active");
  460. $("#span_V" + n).addClass("active");
  461. scrollBar();
  462. }
  463. function setMouseOut(idx) {
  464. if (curIndex != idx && $("#a_" + idx).length > 0)
  465. $("#a_" + idx).removeClass("aSelected");
  466. }
  467. function setMouseOver(idx) {
  468. if ($("#a_" + idx).length > 0)
  469. $("#a_" + idx).addClass("aSelected");
  470. }
  471. // 点击获取当前监控
  472. function setCurIndex(idx) {
  473. AutoNext = false;
  474. if (curIndex > 0 && $("#a_" + curIndex).length > 0)
  475. $("#a_" + curIndex).removeClass("aSelected");
  476. curIndex = idx;
  477. if ($("#a_" + idx).length > 0)
  478. $("#a_" + idx).addClass("aSelected");
  479. // 多屏点击
  480. if(divNum>1){
  481. var imei = $("#a_" + idx).find('#span_deviceSerial_'+idx).html();
  482. var currjkType = parseInt($("#a_" + idx).find('#span_jktype_'+idx).html());
  483. if(currjkType && $('#playback').length==0){
  484. $('#windowCtrl').append('<button id="playback" imei="'+imei+'">查看回放</button>');
  485. }else if(!currjkType){
  486. $('#playback').remove();
  487. }else{
  488. $('#playback').attr('imei',imei);
  489. }
  490. }
  491. }
  492. var winHeight = 0;
  493. function windowResize() { //函数:获取尺寸
  494. var divMainWidth = $('#divMain').css('width').replace("px", "");
  495. var divMainHeight = divMainWidth * 9 / 16;
  496. $('#divMain').css('height', divMainHeight + 22 + "px");
  497. var EZUIKitHeight = divMainHeight / Math.sqrt(divNum) - 10;
  498. $('.videoNum' + divNum).css('height', EZUIKitHeight + "px");
  499. $('#div_ControlPanel').css('height', divMainHeight + "px");
  500. if ($("#tr_ptz").is(':visible'))
  501. $('#div_CamerList').css('height', divMainHeight - 215 + "px");
  502. else
  503. $('#div_CamerList').css('height', divMainHeight - 20 + "px");
  504. scrollBar();
  505. }
  506. window.onresize = function () {
  507. windowResize();
  508. }
  509. var spanIdx = "";
  510. </script>
  511. <script>
  512. // 判断是否启用flash
  513. function flashChecker() {
  514. var hasFlash = 0;     //是否安装了flash
  515. var flashVersion = 0;   //flash版本
  516. if (document.all) {
  517. var swf = new ActiveXObject('ShockwaveFlash.ShockwaveFlash');
  518. if (swf) {
  519. hasFlash = 1;
  520. VSwf = swf.GetVariable("$version");
  521. flashVersion = parseInt(VSwf.split(" ")[1].split(",")[0]);
  522. }
  523. } else {
  524. if (navigator.plugins && navigator.plugins.length > 0) {
  525. var swf = navigator.plugins["Shockwave Flash"];
  526. if (swf) {
  527. hasFlash = 1;
  528. var words = swf.description.split(" ");
  529. for (var i = 0; i < words.length; ++i) {
  530. if (isNaN(parseInt(words[i]))) {
  531. continue;
  532. }
  533. flashVersion = parseInt(words[i]);
  534. }
  535. }
  536. }
  537. }
  538. return {
  539. f: hasFlash,
  540. v: flashVersion
  541. };
  542. }
  543. var fls = flashChecker();
  544. // 控制
  545. function configCamera(deviceSerial, ctrl, movenum) {
  546. var id = $("#a_" + curIndex).find('.equipname').html();
  547. if (!id) {
  548. layer.msg('暂无设备!')
  549. return;
  550. }
  551. $.ajax({
  552. url: 'jk_view',
  553. type: 'post',
  554. dataType: 'json',
  555. data: {
  556. id: id,
  557. ctrl: ctrl,
  558. movenum: movenum
  559. },
  560. beforeSend: function () {
  561. if (ctrl == 'takephoto') {
  562. loadFlage = layer.load();
  563. }
  564. },
  565. complete: function () {
  566. layer.close(loadFlage);
  567. },
  568. success: function (data) {
  569. if (ctrl == 'takephoto') {
  570. layui.use('layer', function () {
  571. var layer = layui.layer;
  572. layer.open({
  573. title: '手动下载'
  574. , content: '<textarea readonly id="downpath">' + data.data.picUrl + '</textarea>'
  575. , btn: ['复制', '取消']
  576. , area: ['400px', '230px']
  577. , yes: function (index, layero) {
  578. //按钮【按钮一】的回调
  579. document.getElementById('downpath').select();
  580. layer.tips('手动复制,在浏览器打开,另存为', '#downpath', {
  581. tips: 2
  582. });
  583. return false;
  584. }
  585. , btn2: function (index, layero) {
  586. //按钮【按钮二】的回调
  587. //return false 开启该代码可禁止点击该按钮关闭
  588. }
  589. , btn3: function (index, layero) {
  590. }
  591. , cancel: function () {
  592. //右上角关闭回调
  593. //return false 开启该代码可禁止点击该按钮关闭
  594. }
  595. });
  596. });
  597. // window.open(data.data.picUrl)
  598. }
  599. }
  600. })
  601. }
  602. if (fls.f) { //安装了flash
  603. CreateVidewDiv(1)
  604. $('.flashShowDiv').show();
  605. $('.flashDownDiv').hide();
  606. getJkList(1, '')
  607. } else {
  608. $('.flashShowDiv').hide();
  609. $('.flashDownDiv').show();
  610. }
  611. // 获取视频列表
  612. function getJkList(page, searchId) {
  613. $.ajax({
  614. url: 'jk_page',
  615. type: 'get',
  616. data: {
  617. page: page,
  618. f_id: searchId
  619. },
  620. dataType: 'json',
  621. beforeSend: function () {
  622. loadFlage = layer.load();
  623. },
  624. success: function (data) {
  625. fillmenu(data)
  626. $('#currPageNum').html(currPage);
  627. totalPageNum = Math.ceil(data.nums / 10);
  628. $('#totalPageNum').html(totalPageNum);
  629. layer.close(loadFlage);
  630. }
  631. })
  632. }
  633. function fillmenu(data) {
  634. var dat = data.ids;
  635. var html = '';
  636. for (i = 0; i < dat.length; i++) {
  637. var name = dat[i].equip_name ? dat[i].equip_name : dat[i].equip_id;
  638. if(dat[i].status == 1){
  639. var icon = '<span class="onLine"></span>'
  640. }else{
  641. var icon = '<span class="offLine"></span>'
  642. }
  643. if (i == 0) {
  644. html += '<div class="active jkItem" data-jktype="' + dat[i].jktype +'" data-id=' + dat[i].equip_id + '>'+icon+'<span title="'+name+'" class="jkNameSpan">' + name + '</span>';
  645. if(dat[i].photo_num >0){
  646. html += '<a href="javascript:;" class="lookjkPhoto">查看图片</a></div>';
  647. }else{
  648. html += '</div>';
  649. }
  650. } else {
  651. html += '<div class="jkItem" data-jktype="' + dat[i].jktype +'" data-id=' + dat[i].equip_id + '>'+icon+'<span title="'+name+'" class="jkNameSpan">' + name + '</span>';
  652. if(dat[i].photo_num >0){
  653. html += '<a href="javascript:;" class="lookjkPhoto">查看图片</a></div>';
  654. }else{
  655. html += '</div>';
  656. }
  657. }
  658. if (i == dat.length - 1) {
  659. $('#jkList').html(html);
  660. getPath(dat[0].equip_id,dat[0].jktype)
  661. }
  662. }
  663. }
  664. // 菜单点击事件
  665. $('#jkList').on('click', '.jkItem', function () {
  666. var jktype = $(this).data('jktype');
  667. getPath($(this).data('id'),jktype);
  668. $('#jkList .jkItem').removeClass('active');
  669. $(this).addClass('active');
  670. })
  671. $('#jkList').on('click', '.lookjkPhoto', function (event) {
  672. // alert($(this).parent().data('id'));
  673. var imei = $(this).parent().data('id');
  674. // document.getElementById("iframe-main").src="home_map.html";
  675. $("body", parent.document).find('iframe').attr('src','jk_image?imei='+imei);
  676. event.stopPropagation();//阻止事件冒泡即可
  677. })
  678. //预览函数
  679. function StartPlay(id, connectionType, liveStatus, rtmp, hls, deviceSerial, cameraNo, title, obj,jktype) {
  680. if (obj == null) {
  681. $("#div_CamerList>div").eq(0).addClass("select-c");
  682. }
  683. else {
  684. $("#div_CamerList").children("div").removeClass("select-c");
  685. $(obj).addClass("select-c");
  686. }
  687. $("#span_ConnectionType_" + curIndex).html(connectionType);
  688. $("#span_deviceSerial_" + curIndex).html(deviceSerial);
  689. $("#span_jktype_" + curIndex).html(jktype);
  690. $("#span_cameraNo_" + curIndex).html(cameraNo);
  691. $("#span_playTime_" + curIndex).html(new Date().getTime()); //开始播放,时间为0
  692. if (spanIdx != "")
  693. $("#Span_" + spanIdx).css("color", "white");
  694. spanIdx = id;
  695. $("#Span_" + id).css("color", "#FFFF00");
  696. $("#a_" + curIndex).addClass("noborder");
  697. if (curIndex == 0 || $("#a_" + curIndex).length == 0)
  698. return;
  699. $("#title_" + curIndex).html(title);
  700. var playHtml = "<video id='myPlayer" + curIndex + "' style='width: 100%; height: 100%' class='videoNum" + divNum + "' poster='' controls playsinline webkit-playsinline autoplay>";
  701. playHtml += "<source src='" + hls + "' type='' />";
  702. playHtml += "</video>";
  703. var script = document.createElement("script");
  704. script.type = "text/javascript";
  705. script.appendChild(document.createTextNode(" new EZUIPlayer('myPlayer" + curIndex + "');"));
  706. $("#video_" + curIndex).html(playHtml);
  707. $("#video_" + curIndex).append(script);
  708. if ($("#a_" + (curIndex + 1)).length > 0)
  709. SetAutoNext(curIndex + 1);
  710. //SetPtzControl();
  711. windowResize();
  712. }
  713. function getPath(imei,jktype) {
  714. if(jktype && $('#playback').length==0){
  715. $('#windowCtrl').append('<button id="playback" imei="'+imei+'">查看回放</button>');
  716. }else if(!jktype){
  717. $('#playback').remove();
  718. }else{
  719. $('#playback').attr('imei',imei);
  720. }
  721. $.ajax({
  722. url: 'jk_view',
  723. type: 'get',
  724. data: {
  725. imei: imei
  726. },
  727. dataType: 'json',
  728. beforeSend: function () {
  729. loadFlage = layer.load();
  730. },
  731. success: function (data) {
  732. var dat = data[0].data[0];
  733. if (data[0].code == 200) {
  734. StartPlay(dat.deviceSerial, '', '', dat.rtmpHd, dat.hlsHd, dat.deviceSerial, '', '', null,jktype)
  735. }
  736. layer.close(loadFlage);
  737. }
  738. })
  739. }
  740. function SetAutoNext(idx) {
  741. if (AutoNext) {
  742. if (curIndex > 0 && $("#a_" + curIndex).length > 0)
  743. $("#a_" + curIndex).removeClass("aSelected");
  744. curIndex = idx;
  745. if ($("#a_" + idx).length > 0)
  746. $("#a_" + idx).addClass("aSelected");
  747. }
  748. }
  749. // 分页点击
  750. var currPage = 1;
  751. var totalPageNum;
  752. function getjklistFun(str) {
  753. if (str == 'jian') {
  754. if (currPage > 1) {
  755. currPage--;
  756. }
  757. } else {
  758. if (currPage < totalPageNum) {
  759. currPage++;
  760. }
  761. }
  762. getJkList(currPage, '')
  763. }
  764. // StartPlay('363','1', '2', 'rtmp://rtmp.open.ys7.com/openlive/8702368f321341deb9fb5edb9d72faec', 'http://hls.open.ys7.com/openlive/8702368f321341deb9fb5edb9d72faec.m3u8', '719458092', '1','阳台',null);
  765. // 回放
  766. $(document).on('click','#playback',function(){
  767. var id = $(this).attr('imei');
  768. layer.open({
  769. title:'查看回放',
  770. type: 2,
  771. area: ['80%', '80%'],
  772. fixed: false, //不固定
  773. maxmin: true,
  774. content: 'nvr_view',
  775. success: function(layero, index){
  776. var iframe = window['layui-layer-iframe' + index];
  777. iframe.child(id) //函数
  778. }
  779. });
  780. })
  781. </script>
  782. </body>
  783. </html>