maJiaBaoGoApp.html 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  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. </head>
  14. <body>
  15. <div class="code-container">
  16. <div class="top-Text">
  17. <img class="img-container" src="../static/img/maJiaBaoGoAppText.png" />
  18. </div>
  19. <div class="btn-content">
  20. <img class="download-app" src="../static/img/downLoadApp.png" />
  21. <img class="download-text" src="../static/img/downLoadText.png" />
  22. </div>
  23. <div class="mask">
  24. <div class="dialog">
  25. <img class="border" src="../static/img/border.png" />
  26. <img class="border-close" src="../static/img/border-close.png" />
  27. <img class="border-text" src="../static/img/border-text.png" />
  28. <img class="ios-text" src="../static/img/ios-text.png" />
  29. <img class="ios-title" src="../static/img/ios-title.png" />
  30. </div>
  31. </div>
  32. </div>
  33. <script>
  34. toastr.options.positionClass = 'toast-center-center';
  35. toastr.options.timeOut = '1500';
  36. </script>
  37. <script type="text/javascript">
  38. // var baseUrl = 'http://14.215.128.96/'
  39. let timer,flag = true;
  40. var url = window.location.href;
  41. url = url.split('/')
  42. var loc = window.location.search,
  43. n1 = loc.length,//地址的总长度
  44. n2 = loc.indexOf("="),//取得=号的位置
  45. id = loc.substr(n2 + 1, n1 - n2),//从=号后面的内容
  46. u = navigator.userAgent,
  47. isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/),
  48. isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; //android终端
  49. //埋点
  50. operate(3);
  51. function operate(accessType){
  52. $.ajax({
  53. url: baseUrl + '/api/public/v1/game/user/operate',
  54. type: 'post',
  55. headers: {
  56. 'Authorization': 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJyYW5kb20iOiIwNDM1MyIsImNsaWVudCI6IjIiLCJleHAiOjE2MzEwNjc1NDksInVzZXJuYW1lIjoiQ3Fvd3QxNjAzMjYyMjU4In0.kaqR4ObPdr336zkr26xdrdmOlPgI9xych2qJ2pSd1lI' //id
  57. },
  58. data:JSON.stringify({
  59. accessType: accessType,
  60. entrance: id,
  61. url: window.location.href
  62. }),
  63. contentType:"application/json",
  64. dataType: 'json',
  65. cache: false,
  66. success: function (res) {
  67. if(accessType === 1 && isAndroid){
  68. getAppDownload();
  69. }
  70. },
  71. })
  72. }
  73. //点击下载APP
  74. $('.btn-content')[0].addEventListener('click',()=>{
  75. if(isAndroid){
  76. operate(1);
  77. }else if(isiOS){
  78. operate(1);
  79. $('.dialog').animate({top: '4.36rem'},"fast");
  80. $('.mask').show();
  81. document.documentElement.style.overflow='hidden';
  82. }
  83. },false);
  84. //关闭
  85. $('.border-close')[0].addEventListener('click',handleClose,false);
  86. function handleClose() {
  87. $('.dialog').animate({top: '-6.96rem'},"fast");
  88. $('.mask').hide();
  89. document.documentElement.style.overflow='auto';
  90. }
  91. //调用下载接口
  92. function getAppDownload(){
  93. $.ajax({
  94. url: baseUrl + '/api/user/v1/ditchClient/addChannelAppDownload',
  95. type: 'post',
  96. data:JSON.stringify({
  97. code:"Q4796f4k26ST",
  98. platform:"1",
  99. version:""
  100. }),
  101. contentType: "application/json",
  102. dataType: 'json',
  103. cache: false,
  104. success: function (res) {
  105. if(res.status === 0){
  106. window.location.href = baseUrl + '/file-center/fileOperate/downloadFile?id=169403';
  107. }else{
  108. stopManyClick(() =>{
  109. toastr.error(res.msg)
  110. })
  111. }
  112. },
  113. })
  114. }
  115. //防止提示一秒内重复显示
  116. function stopManyClick(fn) {
  117. if (flag) {
  118. fn();
  119. }
  120. flag = false;
  121. if(timer){clearTimeout(timer);}
  122. timer = setTimeout(() => {flag = true}, 1500);
  123. }
  124. </script>
  125. </body>
  126. </html>