homeAttence.html 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. <!DOCTYPE html>
  2. <html lang="zh-CN">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
  6. <title>下载APP</title>
  7. <link rel="icon" href="../static/img/favicon2.ico" type="img/x-ico">
  8. <link rel="stylesheet" href="../static/js/vender/toastr/toastr.min.css">
  9. <link rel="stylesheet" href="../static/css/maJiaBaoGoApp.css">
  10. <script src="../static/js/vender/jquery-3.4.1.min.js"></script>
  11. <script src="../static/js/vender/toastr/toastr.min.js"></script>
  12. <script src="../static/js/vender/config.js"></script>
  13. <style>
  14. .code-container {
  15. background: url(../static/img/homeAttence/bg.png);
  16. background-repeat: no-repeat;
  17. background-size: 7.5rem 100vh;
  18. }
  19. </style>
  20. </head>
  21. <body>
  22. <div class="code-container">
  23. <div class="btn-content">
  24. <img class="download-app" src="../static/img/homeAttence/download-bg.png" />
  25. <img class="download-text" src="../static/img/homeAttence/download-text.png" />
  26. </div>
  27. <div class="mask">
  28. <div class="point">
  29. <img class="point-img" src="../static/img/point.png" />
  30. </div>
  31. <div class="dialog">
  32. <img class="border" src="../static/img/homeAttence/border.png" />
  33. <img class="border-close" src="../static/img/homeAttence/close.png" />
  34. <img class="border-text" src="../static/img/border-text.png" />
  35. <img class="border-btn" src="../static/img/homeAttence/btn.png" />
  36. <img class="small-routine" src="../static/img/homeAttence/home.png" id="picurl" />
  37. <img class="btn-text" src="../static/img/btn-text.png" />
  38. </div>
  39. </div>
  40. </div>
  41. <script>
  42. toastr.options.positionClass = 'toast-center-center';
  43. toastr.options.timeOut = '1500';
  44. </script>
  45. <script type="text/javascript">
  46. // var baseUrl = 'http://14.215.128.96/'
  47. let timer,flag = true;
  48. var url = window.location.href;
  49. url = url.split('/')
  50. var loc = window.location.search,
  51. n1 = loc.length,//地址的总长度
  52. n2 = loc.indexOf("="),//取得=号的位置
  53. id = loc.substr(n2 + 1, n1 - n2),//从=号后面的内容
  54. u = navigator.userAgent,
  55. isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/),
  56. isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; //android终端
  57. //埋点
  58. if(isAndroid){
  59. operate(id);
  60. }
  61. if(isiOS){
  62. const pointName = id + '_IOS'
  63. operate(pointName);
  64. }
  65. function operate(pointName,type){
  66. $.ajax({
  67. url: baseUrl + '/api/public/v1/systemBuriedPoint/stat',
  68. type: 'post',
  69. data:JSON.stringify({
  70. pointName: pointName
  71. }),
  72. contentType:"application/json",
  73. dataType: 'json',
  74. cache: false,
  75. success: function (res) {
  76. if(isAndroid && type === 'click'){
  77. getAppDownload();
  78. }
  79. },
  80. })
  81. }
  82. //点击下载APP
  83. $('.btn-content')[0].addEventListener('click',()=>{
  84. var ua = navigator.userAgent.toLowerCase();
  85. if(ua.match(/MicroMessenger/i)=="micromessenger" || ua.match(/QQ\/[0-9]/i)){
  86. $('.point').animate({top: '0.1rem'},"fast");
  87. $('.mask').css('background','rgba(0,0,0,0.7)');
  88. $('.mask').show();
  89. document.documentElement.style.overflow='hidden';
  90. }else if(isAndroid){
  91. const pointName = id + '_click'
  92. operate(pointName,'click');
  93. }else if(isiOS){
  94. const pointName = id + '_IOS_click'
  95. operate(pointName);
  96. $('.dialog').animate({top: '4.36rem'},"fast");
  97. $('.mask').show();
  98. document.documentElement.style.overflow='hidden';
  99. }
  100. },false);
  101. //关闭
  102. $('.border-close')[0].addEventListener('click',handleClose,false);
  103. function handleClose() {
  104. $('.dialog').animate({top: '-6.96rem'},"fast");
  105. $('.mask').hide();
  106. document.documentElement.style.overflow='auto';
  107. }
  108. //调用下载接口
  109. function getAppDownload(){
  110. $.ajax({
  111. url: baseUrl + '/api/user/v1/ditchClient/addChannelAppDownload',
  112. type: 'post',
  113. data:JSON.stringify({
  114. code:"IvM92GZoWHvs",
  115. type: "5",
  116. platform:"1",
  117. version:""
  118. }),
  119. contentType: "application/json",
  120. dataType: 'json',
  121. cache: false,
  122. success: function (res) {
  123. if(res.status === 0){
  124. window.location.href = 'https://wjzx.androidscloud.com:9091/file-center/fileOperate/downloadFile?id=173773';
  125. }else{
  126. stopManyClick(() =>{
  127. toastr.error(res.msg)
  128. })
  129. }
  130. },
  131. })
  132. }
  133. //保存到相册
  134. $('.btn-text')[0].addEventListener('click',savePic,false);
  135. function savePic(){
  136. var picurl= $("#picurl").attr("src");
  137. savePicture(picurl);
  138. }
  139. //保存图片
  140. function savePicture(Url){
  141. var blob=new Blob([''], {type:'application/octet-stream'});
  142. var url = URL.createObjectURL(blob);
  143. var a = document.createElement('a');
  144. a.href = Url;
  145. a.download = Url.replace(/(.*\/)*([^.]+.*)/ig,"$2").split("?")[0];
  146. var e = document.createEvent('MouseEvents');
  147. e.initMouseEvent('click', true, false, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
  148. a.dispatchEvent(e);
  149. URL.revokeObjectURL(url);
  150. stopManyClick(() =>{
  151. toastr.error('保存成功!')
  152. })
  153. }
  154. //防止提示一秒内重复显示
  155. function stopManyClick(fn) {
  156. if (flag) {
  157. fn();
  158. }
  159. flag = false;
  160. if(timer){clearTimeout(timer);}
  161. timer = setTimeout(() => {flag = true}, 1500);
  162. }
  163. </script>
  164. </body>
  165. </html>