index.html 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  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. function getEnv() {
  59. var hasOwnProp = Object.prototype.hasOwnProperty;
  60. var brands = {
  61. "IPHONE": "IPHONE|IPAD|IPOD|IOS",
  62. "OPPO": "OPPO",
  63. "VIVO": "VIVO",
  64. "HONOR": "HONOR",
  65. "HUAWEI": "HUAWEI",
  66. "XIAOMI": "XIAOMI|REDMI",
  67. "360": "1801-A01|1707-A01|1509-A00",
  68. "SAMSUNG": "SAMSUNG",
  69. "NUBIA": "NX"
  70. };
  71. var userAgent = window.navigator.userAgent.toUpperCase();
  72. var is_weixin = (function() {
  73. if (userAgent.match(/MicroMessenger/i) == "MICROMESSENGER") {
  74. return true;
  75. } else {
  76. return false;
  77. }
  78. })();
  79. var is_dingtalk = (function() {
  80. if (userAgent.match(/DingTalk/i) == "DINGTALK") {
  81. return true;
  82. } else {
  83. return false;
  84. }
  85. })();
  86. for (var key in brands) {
  87. if (hasOwnProp.call(brands, key)) {
  88. brands[key] = new RegExp(brands[key], 'i');
  89. }
  90. }
  91. /**
  92. * 获取系统名称,安卓或者ios
  93. */
  94. function getOS() {
  95. if (userAgent.indexOf("ANDROID") > -1) {
  96. return "ANDROID";
  97. } else if (userAgent.indexOf("IPHONE") > -1) {
  98. return "IOS";
  99. }
  100. }
  101. /**
  102. * 获取设备品牌
  103. */
  104. function getBrand() {
  105. var result = [];
  106. for (var key in brands) {
  107. if (hasOwnProp.call(brands, key)) {
  108. if (brands[key].test(userAgent)) {
  109. result.push(key);
  110. }
  111. }
  112. }
  113. return result[0];
  114. }
  115. return {
  116. os: getOS(),
  117. brand: getBrand(),
  118. is_weixin: is_weixin,
  119. is_dingtalk: is_dingtalk
  120. };
  121. }
  122. var env = getEnv();
  123. if (env.os === "IOS") {
  124. //window.location.href = "ltapp233307://app"; // IOS打开APP协议如:taobao://
  125. window.setTimeout(function() {
  126. window.location.href = "https://apps.apple.com/cn/app/%E5%90%8D%E5%AD%A6%E9%87%91%E6%A6%9C/id1583513014";
  127. }, 2000);
  128. } else {
  129. if (env.is_weixin || env.is_dingtalk) {
  130. document.getElementById('d2').style.display = 'block';
  131. } else {
  132. document.getElementById('d1').style.display = 'block';
  133. //window.location.href = "ltapp233307://app"; //安卓协议
  134. window.setTimeout(function() {
  135. download(env);
  136. }, 2000)
  137. }
  138. }
  139. function download(env) {
  140. env = env ? env : getEnv();
  141. switch (env.brand) {
  142. //case "HONOR":
  143. // window.location.href = 'intent://details?id=apk的包名#Intent;package=com.huawei.appmarket;scheme=market;end;';
  144. // break;
  145. //case "HUAWEI":
  146. //case "OPPO":
  147. // window.location.href = "market://details?id=apk的包名";
  148. // break;
  149. //case "XIAOMI":
  150. // window.location = 'intent://details?id=apk的包名#Intent;package=com.xiaomi.market;scheme=market;end;';
  151. // break;
  152. //case "VIVO":
  153. // window.location.href = 'intent://details?id=apk的包名#Intent;package=com.bbk.appstore;scheme=market;end;';
  154. // break;
  155. //case "SAMSUNG":
  156. // window.location.href = "http://www.samsungapps.com/appquery/appDetail.as?appId=apk的包名";
  157. // break;
  158. //case "360":
  159. // window.location.href = 'intent://details?id=apk的包名#Intent;package=com.qihoo.appstore;scheme=market;end;';
  160. // break;
  161. default:
  162. window.location.href = "https://a.app.qq.com/o/simple.jsp?pkgname=com.mingxuejinbang.mxjb";
  163. break;
  164. }
  165. }
  166. </script>