index.html 5.1 KB

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