maJiaBaoGoApp.html 3.8 KB

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