<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html;charset=utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width,initial-scale=1.0" />
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="format-detection" content="telephone=no">
    <link rel="stylesheet" href="./css//rest.css">
    <title>小课帮</title>
    <script>
        var _hmt = _hmt || [];
        (function() {
            var hm = document.createElement("script");
            hm.src = "http://hm.baidu.com/hm.js?2b1104eb1264e4c3ac0a1b65df83c499";
            var s = document.getElementsByTagName("script")[0]; 
            s.parentNode.insertBefore(hm, s);
        })();
    </script>
        
    <style type="text/css">
        body {
            font-size: 22px;
            line-height: 30px;
            background:linear-gradient(-91deg,rgba(8,188,255,0.97),rgba(1,115,255,0.97));
            /* background:linear-gradient(192deg,rgba(8,188,255,0.97),rgba(1,115,255,0.97)); */
        }
        #ios-con {
            display: none;
        }
        .ios-mask {
            position: fixed; top: 0; right: 0;
            bottom: 0; left: 0;
            background: #F5F5F5;
            display: flex; flex-direction: column;
            align-items: center;
            z-index: 999999999;
        }
        .ios-mask .ios-icon {
            width: 105px; height: 86px;
            align-self: flex-end;
        }
        .ios-mask .ios-desc{
            text-align: center;
            font-size:17px;
            font-family:PingFangSC-Regular,PingFang SC;
            font-weight:400;
            color:rgba(51,51,51,1);
            line-height:27px;
        }
        .ios-mask .ios-bg{
            width: 375px; height: 277px;
            margin: 112px 0;
        }
        #android-con {
            display: none;
        }
        .android-mask {
            position: fixed; top: 0; right: 0;
            bottom: 0; left: 0;
            background: #F5F5F5;
            display: flex; flex-direction: column;
            z-index: 999999999;
            align-items: center;
        }
        .android-mask .android-tip {
            width: 154px; height: 74px;
            align-self: flex-end;
            background: url(./images//img_liulanqi@2x.png) no-repeat;
            background-size: 100% 100%;
            display: flex; flex-direction: column;
            align-items: center;
            justify-content: center;
            margin-right: 15px;
        }
        .android-tip .android-tip-txt {
            text-align: center;
            font-size:15px;
            font-family:PingFangSC-Regular,PingFang SC;
            font-weight:400;
            color:rgba(255,255,255,1);
            line-height:23px;
        }
        .android-mask .android-logo{
            width: 127px; height: 127px;
            margin-top: 150px;
        }
        .android-mask .android-tit{
            font-size:18px;
            font-family:PingFangSC-Medium,PingFang SC;
            font-weight:500;
            color:rgba(51,51,51,1);
            line-height:26px;
            padding: 8px 0;
        }
        .android-mask .android-desc{
            font-size:15px;
            font-family:PingFangSC-Regular,PingFang SC;
            font-weight:400;
            color:rgba(5,148,255,1);
            line-height:21px;
        }
        .wrap {
            padding: 0 73px;
        }
        .header {
            display: flex; 
            justify-content: space-between;
            padding-top: 45px;
        }
        .logo .logo-icon {
            width: 254px; height: 106px;
        }
        .nav {
            z-index: 20;
        }
        .nav .nav-item {
            /* padding: 0 20px; */
            /* border-right: 1px solid #fff; */
        }
        .nav-item .nav-item-txt {
            font-size: 20px;
            font-weight: 500;
            border-right: 1px solid #fff;
            padding: 0 20px;
        }
        .nav-item .nobd {
            border: none;;
        }
        .main {
            width: 642.4px; height: 641.4px;
            margin: 0 auto;
            margin-top: -100px;
        }
        .main .main-img {
            width: 100%; height: 100%;
        }
        .footer {
            display: flex; justify-content: center;
            margin-top: 30px;
            margin-bottom: 30px;
        }
        .footer .btn-item {
            width:320px;
            height:88px;
            border:1px solid #fff;
            border-radius:44px;
            outline-style: none;
            font-size:30px;
            font-weight:500;
            line-height:88px;
            background-color: rgba(0, 0, 0, 0);
            /* transform-origin: 0 0;
            transform: scale(0.5, 0.5);
            box-sizing: border-box; */
            color: #fff;
            cursor: pointer;
            margin-right: 133px;
            text-align: center;
        }
        .footer .btn-item:last-of-type {
            margin-right: 0;
        }
        .copyright {
            text-align: center;
            color: #fff;
            margin: 0 auto;
        }        

        /* @media screen and (min-width: 1366px) and (max-height:768px) */
        @media screen and (min-width: 1024px) and (min-width: 1280px) { 
            body {
                /* background: red; */
            }
            .main {
                width: 542.4px; height: 542.4px;
                margin: 0 auto;
                /* margin-bottom: 60px; */
            }   
            .footer {
                display: flex; justify-content: center;
                margin-top: 20px;
            }
            .footer .btn-item {
                width:220px;
                height:48px;
                border:1px solid #fff;
                border-radius:44px;
                outline-style: none;
                font-size:16px;
                font-weight:500;
                line-height:48px;
                background-color: rgba(0, 0, 0, 0);
                /* transform-origin: 0 0;
                transform: scale(0.5, 0.5);
                box-sizing: border-box; */
                color: #fff;
                cursor: pointer;
                margin-right: 133px;
                text-align: center;
            }
            .footer .btn-item:last-of-type {
                margin-right: 0;
            }
            .copyright {
                bottom: 10px;
                width: 200px;
                padding-top: 30px;
            }
        }
        @media all and (min-width: 320px) and (max-width: 823px) {
            .wrap {
                padding: 0;
                padding-top: 120px;
            }
            .header {
                display: flex; flex-direction: column;
                align-items: flex-start;
                padding: 20px 10px;
                text-align: left;
                position: fixed;
                top: 0;
                width: 100%;
            }
            .logo .logo-icon {
                width: 84px; height: 35px;
            }
            .nav .nav-item {
                /* padding: 0 5px; */
                /* padding: 0; */
            }
            .nav-item .nav-item-txt {
                font-size: 12px;
                font-weight: 500;
                padding: 0 8px;
            }  
            .main {
                width: 324px; height: 324px;
                margin: 0 auto;
                margin-bottom: 60px;
            }   
            .footer .btn-item {
                width:140px;
                height:35px;
                border:1px solid #fff;
                border-radius:66px;
                outline-style: none;
                font-size: 12px;
                font-weight:500;
                line-height:35px;
                background-color: rgba(0, 0, 0, 0);
                /* transform-origin: 0 0;
                transform: scale(0.5, 0.5);
                box-sizing: border-box; */
                color: #fff;
                cursor: pointer;
                margin-right: 23px;
            }
            .copyright {
                text-align: center;
                font-size: 12px;
                color: #fff;
                width: 200px;
                padding: 20px 0;
                margin: 0 auto;
                /* position: absolute;
                bottom: 20px;
                left: 50%; transform: translateX(-50%); */
            }
        }
        @media all and (min-width: 300px) and (max-width: 320px) {
            .logo .logo-icon {
                width: 74px; height: 30px;
            }
            .nav .nav-item {
                /* padding: 0 5px; */
                /* padding: 0; */
            }
            .nav-item .nav-item-txt {
                font-size: 12px;
                font-weight: 500;
                padding: 0 4px;
                /* padding: 0 8px; */
            }     
            .main {
                width: 264px; height: 264px;
                /* width: 324px; height: 324px; */
                margin: 0 auto;
                margin-bottom: 60px;
            }   
            .footer .btn-item {
                width:120px;
                height:35px;
                border:1px solid #fff;
                border-radius:66px;
                outline-style: none;
                font-size: 12px;
                font-weight:500;
                line-height:35px;
                background-color: rgba(0, 0, 0, 0);
                /* transform-origin: 0 0;
                transform: scale(0.5, 0.5);
                box-sizing: border-box; */
                color: #fff;
                cursor: pointer;
                margin-right: 23px;
            }
            .copyright {
                text-align: center;
                font-size: 12px;
                color: #fff;
                position: relative;
                left: 0;
                bottom: 0;
                transform: translateX(0);
                width: 200px;
                margin: 0 auto;
                padding: 20px 0;
                padding-top: 30px;
                /* bottom: 20px;
                left: 50%; transform: translateX(-50%); */
            }
        }
        
    </style>
</head>
<body>
    <div class="wrap">
        <div id="ios-con">
            <div class="ios-mask">
                <img class="ios-icon" src="./images//img_jiantou@3x.png" alt="引导箭头">
                <div class="ios-desc">点击屏幕右上角[…]</div>
                <div class="ios-desc">在Safari中打开</div>
                <img class="ios-bg" src="./images//img_safari@3x.png" alt="引导图">
            </div>
        </div>
        <div id="android-con">
            <div class="android-mask">
                <div class="android-tip">
                    <div class="android-tip-txt">请点击右上角</div>
                    <div class="android-tip-txt">选择"浏览器中打开"</div>
                </div>
                <img class="android-logo" src="./images//img_logo@2x.png" alt="小课班logo">
                <div class="android-tit">小课帮</div>
                <div class="android-desc">微信/QQ内无法下载应用</div>
            </div>
        </div>
        <header class="header">
            <h1 class="logo">
                <a href="./index.html">
                    <img class="logo-icon" src="./images//logo@3x.png" alt="小课帮logo">
                </a>
            </h1>
            <nav class="nav">
                <a class="nav-item" href="/index.html">
                    <span class="nav-item-txt">首页</span>
                </a>
                <a class="nav-item" href="/about.html">
                    <span class="nav-item-txt">关于我们</span>
                </a>
                <a class="nav-item" href="/privacy.html">
                    <span class="nav-item-txt">隐私政策</span>
                </a>
                <a class="nav-item" href="/user_agreement.html">
                    <span class="nav-item-txt">用户协议</span>
                </a>
                <a class="nav-item" href="/help.html">
                    <span class="nav-item-txt nobd">帮助</span>
                </a>
            </nav>
        </header>
        <main class="main">
            <img class="main-img" src="./images/img@3x.png" alt="小课帮主图">
        </main>
        <footer class="footer">
            <button class="btn-item" id="android_btn">Android下载</button>
            <button class="btn-item" id="apple_btn">Apple store 下载</button>
        </footer>
        <footer class="copyright">Copyright 版权所有 小课帮2021 <a id="copyright_txt" href="http://beian.miit.gov.cn/">粤ICP备16088419号</a></footer>
    </div>
</body>
<script>
    window.onload = function() {
        _hmt.push(['_trackEvent', 'official_page_view', '浏览']);
        let android_btn = document.getElementById('android_btn')
        let apple_btn = document.getElementById('apple_btn')
        if (os.isAndroid) { 
            android_btn.style.display = 'block'
            apple_btn.style.display = 'none'
            android_btn.style.marginRight = 0
            android_btn.innerHTML = '下载APP'
        }
        if (os.isPhone) {
            apple_btn.style.display = 'block'
            android_btn.style.display = 'none'
            apple_btn.innerHTML = '下载APP'
        }
    }
    let os =  function() { 
        var ua = navigator.userAgent, 
        isWindowsPhone = /(?:Windows Phone)/.test(ua), 
        isSymbian = /(?:SymbianOS)/.test(ua) || isWindowsPhone,  
        isAndroid = /(?:Android)/.test(ua),  
        isFireFox = /(?:Firefox)/.test(ua),  
        isChrome = /(?:Chrome|CriOS)/.test(ua), 
        isTablet = /(?:iPad|PlayBook)/.test(ua) || (isAndroid && !/(?:Mobile)/.test(ua)) || (isFireFox && /(?:Tablet)/.test(ua)), 
        isPhone = /(?:iPhone)/.test(ua) && !isTablet, 
        isWechat = ua.toLowerCase().match(/MicroMessenger/i) == "micromessenger",
        isQQ = ua.toLowerCase().match(/\sQQ/i) !== null,
        isDD = ua.indexOf("DingTalk") > -1,
        isPc = !isPhone && !isAndroid && !isSymbian; 
        return { 
            isTablet: isTablet, 
            isPhone: isPhone, 
            isAndroid : isAndroid, 
            isPc : isPc,
            isWechat: isWechat,
            isQQ: isQQ,
            isDD: isDD
        }; 
    }()
    const downloadHref = [
        'http://api.course01.net/apk/version',
        'http://apps.apple.com/cn/app/%E5%B0%8F%E8%AF%BE%E5%B8%AE/id1527721417'
    ]
    let btns = document.querySelectorAll('.btn-item')
    btns.forEach((v,idx) => {
        v.onclick = e => {
            e.preventDefault();
            if (os.isAndroid || os.isPhone) {
                if(idx == 0) {
                    if(os.isPhone) return
                    // if(os.isQQ || os.isDD || os.isWechat) {
                    //     document.getElementById('android-con').style.display = 'block'
                    // } else {
                        _hmt.push(['_trackEvent', 'official_download_Android_click', '安卓点击下载']);
                        $.ajax({url:"http://api.course01.net/apk/version",cache : false,dataType:'json',success:function(result){
                            console.log(result)
                            window.open(result.downloadApkUrl)
                        },error:function(err) {
                            window.alert('失败了')
                            window.alert(JSON.stringify(err))
                        }});
                        // window.open(downloadHref[idx])
                    // }
                } else {
                    if(os.isAndroid) return
                    // if(os.isQQ || os.isDD || os.isWechat) { 
                    //     document.getElementById('ios-con').style.display = 'block'
                    // } else {
                        _hmt.push(['_trackEvent', 'official_download_ios_click', 'ios点击下载']);
                        window.open(downloadHref[idx])
                    // }
                }
            } else {
                $.ajax({url:"http://api.course01.net/apk/version",cache : false,success:function(result){
                    console.log('result:', result)
                    window.open(result.downloadApkUrl)
                }});
                console.log('执行了。')
                // window.open(downloadHref[idx])
            }
        }})
    // console.log("btns", btns)
</script>
<script src="http://cdn.staticfile.org/jquery/1.10.2/jquery.min.js">
</script>
</html>

