maJiaBaoGoApp.html 3.4 KB

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