index.html 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>
  6. <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
  7. <meta http-equiv="Pragma" content="no-cache" />
  8. <meta http-equiv="Expires" content="0" />
  9. <title>点击下载应用</title>
  10. <style>
  11. html, body { margin:0;padding:0;width: 100%;height: 100%; }
  12. .layui-btn {
  13. outline: 0;
  14. -webkit-appearance: none;
  15. transition: all .3s;
  16. -webkit-transition: all .3s;
  17. box-sizing: border-box;
  18. }
  19. .layui-btn {
  20. display: inline-block;
  21. height: 38px;
  22. line-height: 38px;
  23. padding: 0 18px;
  24. background-color: #009688;
  25. color: #fff;
  26. white-space: nowrap;
  27. text-align: center;
  28. font-size: 14px;
  29. border: none;
  30. border-radius: 2px;
  31. cursor: pointer;
  32. }
  33. .layui-btn-warm {
  34. background-color: #FFB800;
  35. }
  36. </style>
  37. </head>
  38. <body style="overflow: hidden;background-image:url('/download/board.png');background-position:center;background-size:100%;">
  39. <div id="d1" style="display:none;text-align:center;">
  40. <div style="margin-top:15%;">
  41. <img src="./logo.png" style="width: 50%;" />
  42. </div>
  43. <button type="button" class="layui-btn layui-btn-warm" onclick="download();">点击下载</button>
  44. </div>
  45. <div id="d2" style="display:none;">
  46. <img src="./path.png" style="width:30%;position:absolute;right:10%;top:3%;" />
  47. <div style="text-align: center;border: 1px dashed #979797;margin: 30% 10% 30px;font-weight: bold;color: #414141;line-height: 1;">
  48. <p>点击右上角</p>
  49. <p>选择在浏览器中打开</p>
  50. </div>
  51. <img src="./snapshot.png" style="width:100%;" />
  52. </div>
  53. </body>
  54. </html>
  55. <script type="text/javascript">
  56. function getEnv() {
  57. var hasOwnProp = Object.prototype.hasOwnProperty;
  58. var brands = {
  59. "IPHONE": "IPHONE|IPAD|IPOD|IOS",
  60. "OPPO": "OPPO",
  61. "VIVO": "VIVO",
  62. "HONOR": "HONOR",
  63. "HUAWEI": "HUAWEI",
  64. "XIAOMI": "XIAOMI|REDMI",
  65. "360": "1801-A01|1707-A01|1509-A00",
  66. "SAMSUNG": "SAMSUNG"
  67. };
  68. var userAgent = window.navigator.userAgent.toUpperCase();
  69. var is_weixin = (function () {
  70. if (userAgent.match(/MicroMessenger/i) == "MICROMESSENGER") {
  71. return true;
  72. } else {
  73. return false;
  74. }
  75. })();
  76. var is_dingtalk = (function () {
  77. if (userAgent.match(/DingTalk/i) == "DINGTALK") {
  78. return true;
  79. } else {
  80. return false;
  81. }
  82. })();
  83. for (var key in brands) {
  84. if (hasOwnProp.call(brands, key)) {
  85. brands[key] = new RegExp(brands[key], 'i');
  86. }
  87. }
  88. /**
  89. * 获取系统名称,安卓或者ios
  90. */
  91. function getOS() {
  92. if (userAgent.indexOf("ANDROID") > -1) {
  93. return "ANDROID";
  94. } else if (userAgent.indexOf("IPHONE") > -1) {
  95. return "IOS";
  96. }
  97. }
  98. /**
  99. * 获取设备品牌
  100. */
  101. function getBrand() {
  102. var result = [];
  103. for (var key in brands) {
  104. if (hasOwnProp.call(brands, key)) {
  105. if (brands[key].test(userAgent)) {
  106. result.push(key);
  107. }
  108. }
  109. }
  110. return result[0];
  111. }
  112. return {
  113. os:getOS(),
  114. brand: getBrand(),
  115. is_weixin: is_weixin,
  116. is_dingtalk: is_dingtalk
  117. };
  118. }
  119. var env = getEnv();
  120. if (env.os === "IOS") {
  121. window.location.href ="ltapp233973://app";
  122. window.setTimeout(function() {
  123. // window.location.href = "https://apps.apple.com/cn/app/%E9%93%AD%E5%AD%A6%E7%99%BE%E4%BC%98/id1535907152";
  124. window.location.href = "";
  125. }, 2000);
  126. } else {
  127. if (env.is_weixin || env.is_dingtalk) {
  128. document.getElementById('d2').style.display = 'block';
  129. } else {
  130. document.getElementById('d1').style.display = 'block';
  131. window.location.href = "ltapp233973://app";//安卓协议
  132. window.setTimeout(function() {
  133. download(env);
  134. }, 2000)
  135. }
  136. }
  137. function download(env) {
  138. env = env ? env : getEnv();
  139. switch (env.brand) {
  140. //case "HONOR":
  141. // window.location.href = 'intent://details?id=apk的包名#Intent;package=com.huawei.appmarket;scheme=market;end;';
  142. // break;
  143. //case "HUAWEI":
  144. //case "OPPO":
  145. // window.location.href = "market://details?id=apk的包名";
  146. // break;
  147. //case "XIAOMI":
  148. // window.location = 'intent://details?id=apk的包名#Intent;package=com.xiaomi.market;scheme=market;end;';
  149. // break;
  150. //case "VIVO":
  151. // window.location.href = 'intent://details?id=apk的包名#Intent;package=com.bbk.appstore;scheme=market;end;';
  152. // break;
  153. //case "SAMSUNG":
  154. // window.location.href = "http://www.samsungapps.com/appquery/appDetail.as?appId=apk的包名";
  155. // break;
  156. //case "360":
  157. // window.location.href = 'intent://details?id=apk的包名#Intent;package=com.qihoo.appstore;scheme=market;end;';
  158. // break;
  159. default:
  160. window.location.href = "https://mingxuejingbang.oss-cn-beijing.aliyuncs.com/app/apk/mxby_pro_2.0.0.apk";
  161. break;
  162. }
  163. }
  164. </script>