123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170 |
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>
- <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
- <meta http-equiv="Pragma" content="no-cache" />
- <meta http-equiv="Expires" content="0" />
- <title>点击下载应用</title>
- <style>
- html, body { margin:0;padding:0;width: 100%;height: 100%; }
- .layui-btn {
- outline: 0;
- -webkit-appearance: none;
- transition: all .3s;
- -webkit-transition: all .3s;
- box-sizing: border-box;
- }
- .layui-btn {
- display: inline-block;
- height: 38px;
- line-height: 38px;
- padding: 0 18px;
- background-color: #009688;
- color: #fff;
- white-space: nowrap;
- text-align: center;
- font-size: 14px;
- border: none;
- border-radius: 2px;
- cursor: pointer;
- }
- .layui-btn-warm {
- background-color: #FFB800;
- }
- </style>
- </head>
- <body style="overflow: hidden;background-image:url('/download/board.png');background-position:center;background-size:100%;">
- <div id="d1" style="display:none;text-align:center;">
- <div style="margin-top:15%;">
- <img src="./logo.png" style="width: 50%;" />
- </div>
- <button type="button" class="layui-btn layui-btn-warm" onclick="download();">点击下载</button>
- </div>
- <div id="d2" style="display:none;">
- <img src="./path.png" style="width:30%;position:absolute;right:10%;top:3%;" />
- <div style="text-align: center;border: 1px dashed #979797;margin: 30% 10% 30px;font-weight: bold;color: #414141;line-height: 1;">
- <p>点击右上角</p>
- <p>选择在浏览器中打开</p>
- </div>
- <img src="./snapshot.png" style="width:100%;" />
- </div>
- </body>
- </html>
- <script type="text/javascript">
- function getEnv() {
- var hasOwnProp = Object.prototype.hasOwnProperty;
- var brands = {
- "IPHONE": "IPHONE|IPAD|IPOD|IOS",
- "OPPO": "OPPO",
- "VIVO": "VIVO",
- "HONOR": "HONOR",
- "HUAWEI": "HUAWEI",
- "XIAOMI": "XIAOMI|REDMI",
- "360": "1801-A01|1707-A01|1509-A00",
- "SAMSUNG": "SAMSUNG"
- };
- var userAgent = window.navigator.userAgent.toUpperCase();
- var is_weixin = (function () {
- if (userAgent.match(/MicroMessenger/i) == "MICROMESSENGER") {
- return true;
- } else {
- return false;
- }
- })();
- var is_dingtalk = (function () {
- if (userAgent.match(/DingTalk/i) == "DINGTALK") {
- return true;
- } else {
- return false;
- }
- })();
- for (var key in brands) {
- if (hasOwnProp.call(brands, key)) {
- brands[key] = new RegExp(brands[key], 'i');
- }
- }
- /**
- * 获取系统名称,安卓或者ios
- */
- function getOS() {
- if (userAgent.indexOf("ANDROID") > -1) {
- return "ANDROID";
- } else if (userAgent.indexOf("IPHONE") > -1) {
- return "IOS";
- }
- }
- /**
- * 获取设备品牌
- */
- function getBrand() {
- var result = [];
- for (var key in brands) {
- if (hasOwnProp.call(brands, key)) {
- if (brands[key].test(userAgent)) {
- result.push(key);
- }
- }
- }
- return result[0];
- }
- return {
- os:getOS(),
- brand: getBrand(),
- is_weixin: is_weixin,
- is_dingtalk: is_dingtalk
- };
- }
- var env = getEnv();
- if (env.os === "IOS") {
- window.location.href ="ltapp233973://app";
- window.setTimeout(function() {
- // window.location.href = "https://apps.apple.com/cn/app/%E9%93%AD%E5%AD%A6%E7%99%BE%E4%BC%98/id1535907152";
- window.location.href = "";
- }, 2000);
- } else {
- if (env.is_weixin || env.is_dingtalk) {
- document.getElementById('d2').style.display = 'block';
- } else {
- document.getElementById('d1').style.display = 'block';
- window.location.href = "ltapp233973://app";//安卓协议
- window.setTimeout(function() {
- download(env);
- }, 2000)
- }
- }
- function download(env) {
- env = env ? env : getEnv();
- switch (env.brand) {
- //case "HONOR":
- // window.location.href = 'intent://details?id=apk的包名#Intent;package=com.huawei.appmarket;scheme=market;end;';
- // break;
- //case "HUAWEI":
- //case "OPPO":
- // window.location.href = "market://details?id=apk的包名";
- // break;
- //case "XIAOMI":
- // window.location = 'intent://details?id=apk的包名#Intent;package=com.xiaomi.market;scheme=market;end;';
- // break;
- //case "VIVO":
- // window.location.href = 'intent://details?id=apk的包名#Intent;package=com.bbk.appstore;scheme=market;end;';
- // break;
- //case "SAMSUNG":
- // window.location.href = "http://www.samsungapps.com/appquery/appDetail.as?appId=apk的包名";
- // break;
- //case "360":
- // window.location.href = 'intent://details?id=apk的包名#Intent;package=com.qihoo.appstore;scheme=market;end;';
- // break;
- default:
- window.location.href = "https://mingxuejingbang.oss-cn-beijing.aliyuncs.com/app/apk/ymxzy_V1.0.1_prod.apk";
- break;
- }
- }
- </script>
|