equipmanage_jk.html 29 KB

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