maJiaBaoGoApp.html 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  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. data:JSON.stringify({
  56. accessType: accessType,
  57. entrance: id,
  58. url: window.location.href
  59. }),
  60. contentType:"application/json",
  61. dataType: 'json',
  62. cache: false,
  63. success: function (res) {
  64. if(accessType === 1 && isAndroid){
  65. getAppDownload();
  66. }
  67. },
  68. })
  69. }
  70. //点击下载APP
  71. $('.btn-content')[0].addEventListener('click',()=>{
  72. if(isAndroid){
  73. operate(1);
  74. }else if(isiOS){
  75. operate(1);
  76. $('.dialog').animate({top: '4.36rem'},"fast");
  77. $('.mask').show();
  78. document.documentElement.style.overflow='hidden';
  79. }
  80. },false);
  81. //关闭
  82. $('.border-close')[0].addEventListener('click',handleClose,false);
  83. function handleClose() {
  84. $('.dialog').animate({top: '-6.96rem'},"fast");
  85. $('.mask').hide();
  86. document.documentElement.style.overflow='auto';
  87. }
  88. //调用下载接口
  89. function getAppDownload(){
  90. $.ajax({
  91. url: baseUrl + '/api/user/v1/ditchClient/addChannelAppDownload',
  92. type: 'post',
  93. data:JSON.stringify({
  94. code:"Q4796f4k26ST",
  95. platform:"1",
  96. version:""
  97. }),
  98. contentType: "application/json",
  99. dataType: 'json',
  100. cache: false,
  101. success: function (res) {
  102. if(res.status === 0){
  103. window.location.href = baseUrl + '/file-center/fileOperate/downloadFile?id=169403';
  104. }else{
  105. stopManyClick(() =>{
  106. toastr.error(res.msg)
  107. })
  108. }
  109. },
  110. })
  111. }
  112. //防止提示一秒内重复显示
  113. function stopManyClick(fn) {
  114. if (flag) {
  115. fn();
  116. }
  117. flag = false;
  118. if(timer){clearTimeout(timer);}
  119. timer = setTimeout(() => {flag = true}, 1500);
  120. }
  121. </script>
  122. </body>
  123. </html>