frame3.html 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
  6. <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
  7. <title>map</title>
  8. <link rel="stylesheet" type="text/css" href="../../css/api.css" />
  9. <link rel="stylesheet" type="text/css" href="../../css/style.css" />
  10. <link rel="stylesheet" href="../../css/aui.css">
  11. <link rel="stylesheet" href="../../css/projeck.css">
  12. <style>
  13. .api_layout {
  14. height: 100%;
  15. }
  16. #canvas {
  17. display: block;
  18. width: 100%;
  19. height: 100%;
  20. background: url(../../image/map.png) no-repeat;
  21. background-position: center;
  22. background-size: 100% 100%;
  23. }
  24. .frame_bg {
  25. display: none;
  26. width: 100%;
  27. }
  28. </style>
  29. </head>
  30. <body>
  31. <div class="api_layout">
  32. <canvas id="canvas"></canvas>
  33. <div class="frame_bg">
  34. <img src="../../image/producrData.png" alt="">
  35. </div>
  36. </div>
  37. </body>
  38. </html>
  39. <script type="text/javascript" src="../../script/api.js"></script>
  40. <script type="text/javascript" src="../../script/doT.min.js"></script>
  41. <script src="../../script/config.js" charset="utf-8"></script>
  42. <script src="../../script/zepto.js" charset="utf-8"></script>
  43. <script type="text/javascript">
  44. var toast = new auiToast();
  45. var testtimer = "";
  46. apiready = function() {
  47. // canvas();
  48. api.addEventListener({
  49. name: 'eventCanvas'
  50. }, function(ret, err) {
  51. canvas();
  52. });
  53. api.addEventListener({
  54. name: 'clearCanvas'
  55. }, function(ret, err) {
  56. clearSetInterval();
  57. });
  58. api.addEventListener({
  59. name: 'scrolltobottom',
  60. extra: {
  61. threshold: 0 //设置距离底部多少距离时触发,默认值为0,数字类型
  62. }
  63. }, function(ret, err) {
  64. $event.openTabLayoutTransition('frame3_1','frame3_1','', '')
  65. });
  66. }
  67. function canvas() {
  68. var radius = 0;
  69. var c = document.getElementById("canvas");
  70. c.width = document.body.clientWidth * 2;
  71. c.height = document.body.clientHeight * 2;
  72. var ctx = c.getContext("2d");
  73. // canvas.rect(params1,params2,params3,params4) 参数分别为 矩形左上角的x轴坐标 矩形左上角的y轴坐标 矩形的宽度 矩形的高度
  74. // 灵新煤矿
  75. const path1 = new Path2D();
  76. path1.rect($event.yhW(28), $event.yhW(68), 200, $event.yhW(60));
  77. // 红柳煤矿
  78. const path2 = new Path2D();
  79. path2.rect($event.yhW(28), $event.yhW(141), 200, $event.yhW(60));
  80. // 枣圈煤矿
  81. const path3 = new Path2D();
  82. path3.rect($event.yhW(28), $event.yhW(209), 200, $event.yhW(60));
  83. // 请水营煤矿
  84. const path4 = new Path2D();
  85. path4.rect($event.yhW(28), $event.yhW(300), 230, $event.yhW(60));
  86. // 石槽村煤矿
  87. const path5 = new Path2D();
  88. path5.rect($event.yhW(28), $event.yhW(369), 230, $event.yhW(60));
  89. // 梅花井煤矿
  90. const path6 = new Path2D();
  91. path6.rect($event.yhW(28), $event.yhW(443), 230, $event.yhW(60));
  92. // 信息中心
  93. const path7 = new Path2D();
  94. path7.rect($event.yhW(552), $event.yhW(68), 230, $event.yhW(60));
  95. // 双马煤矿
  96. const path8 = new Path2D();
  97. path8.rect($event.yhW(533), $event.yhW(750), 230, $event.yhW(60));
  98. // 金凤煤矿
  99. const path9 = new Path2D();
  100. path9.rect($event.yhW(520), $event.yhW(812), 230, $event.yhW(60));
  101. // 羊场湾煤矿
  102. const path10 = new Path2D();
  103. path10.rect($event.yhW(505), $event.yhW(893), 230, $event.yhW(60));
  104. ctx.stroke()
  105. c.addEventListener('click', function(e) {
  106. var lx = ctx.isPointInPath(path1, e.clientX * 2, e.clientY * 2);
  107. var hl = ctx.isPointInPath(path2, e.clientX * 2, e.clientY * 2);
  108. var zq = ctx.isPointInPath(path3, e.clientX * 2, e.clientY * 2);
  109. var qsy = ctx.isPointInPath(path4, e.clientX * 2, e.clientY * 2);
  110. var mhj = ctx.isPointInPath(path5, e.clientX * 2, e.clientY * 2);
  111. var scc = ctx.isPointInPath(path6, e.clientX * 2, e.clientY * 2);
  112. var sm = ctx.isPointInPath(path7, e.clientX * 2, e.clientY * 2);
  113. var jf = ctx.isPointInPath(path8, e.clientX * 2, e.clientY * 2);
  114. var ycw = ctx.isPointInPath(path9, e.clientX * 2, e.clientY * 2);
  115. var ycw2 = ctx.isPointInPath(path10, e.clientX * 2, e.clientY * 2);
  116. if (lx === true) {
  117. // return $event.openWin('browseQrcode_win','../browseQrcode/browseQrcode_win',{pageId:'102512a8a2d54725bc7c7e6f6ab89fc5',title:'灵新煤矿'},'');
  118. } else if (hl == true) {
  119. // return $event.openWin('browseQrcode_win'+Math.random(),'../browseQrcode/browseQrcode_win',{pageId:'2b855ddda4984ad9b0353ab3ca0f81e3',title:'红柳煤矿'},'');
  120. } else if (zq == true) {
  121. return $event.openTabLayout('zaoquanCoalMine' + Math.random(), '../producationDataItem/zaoquanCoalMine', '枣泉煤矿', {
  122. pageId: '',
  123. title: '枣泉煤矿'
  124. });
  125. } else if (qsy == true) {
  126. // return $event.openWin('browseQrcode_win','../browseQrcode/browseQrcode_win',{pageId:'7663c485d6004f1b9592d8e5000c7419',title:'清⽔营煤矿'},'');
  127. } else if (mhj == true) {
  128. // return $event.openWin('browseQrcode_win','../browseQrcode/browseQrcode_win',{pageId:'4b4405fc17f14fe186d0583fd274e0a2',title:'⽯槽村煤矿'},'');
  129. } else if (scc == true) {
  130. // return $event.openWin('browseQrcode_win','../browseQrcode/browseQrcode_win',{pageId:'b7696b92fa994931857e3385765e02bc',title:'梅花井煤矿'},'');
  131. } else if (sm == true) {
  132. return $event.openTabLayout('informationCenter' + Math.random(), '../producationDataItem/informationCenter', '信息中心', {
  133. pageId: '信息中心',
  134. title: '信息中心'
  135. });
  136. } else if (jf == true) {
  137. // return $event.openWin('browseQrcode_win','../browseQrcode/browseQrcode_win',{pageId:'2d9916d6f827470fa35440456f1f2d6f',title:'双马煤矿'},'');
  138. } else if (ycw == true) {
  139. return $event.openTabLayout('jinfengCoalMine' + Math.random(), '../producationDataItem/jinfengCoalMine', '金凤煤矿', {
  140. pageId: '金凤煤矿',
  141. title: '金凤煤矿'
  142. });
  143. } else if (ycw2 == true) {
  144. // return $event.openWin('browseQrcode_win','../browseQrcode/browseQrcode_win',{pageId:'d39b9800339840f18520a9eb338f15c0',title:'羊场湾煤矿'},'');
  145. }
  146. }, false)
  147. function drawCircle() {
  148. ctx.beginPath();
  149. ctx.arc($event.yhW(480), $event.yhW(550), radius, 0, Math.PI * 2);
  150. ctx.closePath();
  151. ctx.lineWidth = 2;
  152. ctx.strokeStyle = 'rgba(122,228,238,1)';
  153. ctx.stroke();
  154. radius += 1;
  155. if (radius > 120) {
  156. radius = 0;
  157. }
  158. }
  159. function render() {
  160. var prev = ctx.globalCompositeOperation;
  161. ctx.globalCompositeOperation = 'destination-in';
  162. ctx.globalAlpha = 0.95;
  163. ctx.fillRect(0, 0, document.body.clientWidth * 2, document.body.clientHeight * 2);
  164. ctx.globalCompositeOperation = prev;
  165. drawCircle();
  166. };
  167. testtimer = setInterval(function() {
  168. render();
  169. }, 30);
  170. }
  171. // 点击其他tab关闭定时任务
  172. function clearSetInterval() {
  173. clearInterval(testtimer);
  174. }
  175. </script>