<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
    <meta content="telephone=no" name="format-detection">
    <meta name="wap-font-scale" content="no">
    <title>果冻直播登录</title>
    <link rel="stylesheet" href="css/base.css">
    <link rel="stylesheet" href="css/layer.css">
    <link rel="stylesheet" href="css/index.css?v=20190417202">
    <script src="lib/fsize.js"></script>
</head>

<body>
    <div class="bg">
        <div style="height: 2.5rem;"></div>
        <div class="logo-box"><img src="images/logo.png?v=20210105" alt=""></div>
        <div class="login-content">
            <div class="login-input-box">
                <span class="login-span1">+86</span>
                <span class="login-span2"><input class="login-phone-ipt" oninput="value=value.replace(/[^\d]/g,'')"maxlength="11" placeholder="请输入手机号" type="text"></span>
            </div>
            <div class="login-input-box">
                <span class="login-span1">验证码</span>
                <span class="login-span2"><input class="login-code-ipt" oninput="value=value.replace(/[^\d]/g,'')" placeholder="请输入验证码" maxlength="4" type="text"></span>
                <button class="code-btn">获取验证码</button>
            </div>
            <div class="login-btn">登录</div>
        </div>
    </div>
    <div style="display: none;" class="yanzheng-shadow">
        <div class="shadow-content">
            <div class="nimo">
                <img class="nimo-bg" src="" alt="">
                <img class="nimo-cover" src="" alt="">
            </div>
            <ul class="lanren">
                <li>
                    <!-- <span id="title">0</span> -->
                    <div class="scale_panel">
                 
                        <div class="scale" id="bar">
                            向右滑动滑块填充拼图
                            <div></div>
                            <span id="btn">→</span>
                        </div>
                    </div>
                </li>
            </ul>
        </div>
    </div>
</body>

<script src="lib/jquery-3.1.1.min.js"></script>
<script src="lib/fingerprint2.js"></script>
<script src="layer-v3.1.0/layer/layer.js"></script>
<script>
    $(function () {
            //    $ip = 'http://test.api.lvdou66.com:8036/';
        $ip = "https://zhiboweb.ishuaji.cn/";
        //$ip = 'https://zhibo.lvdou66.com/87server/'
        //    $ip = 'https://zhibo.lvdou66.com/';
        cdn = 'http://zhibocdn.ishuaji.cn/comm';
        var myPos
        var myId

        // 进度条代码
        var scale = function (btn, bar, title) {
            this.btn = document.getElementById(btn);
            this.bar = document.getElementById(bar);
            this.title = document.getElementById(title);
            this.step = this.bar.getElementsByTagName("div")[0];
            this.init();
        };
        scale.prototype = {
            init: function () {
                var f = this, g = document, b = window, m = Math;
                f.btn.ontouchstart = function (e) {
                    var x = (e || b.event).touches[0].clientX;
                    var l = this.offsetLeft;
                    var max = f.bar.offsetWidth - this.offsetWidth;
                    g.ontouchmove = function (e) {
                        var thisX = (e || b.event).touches[0].clientX;
                        var to = m.min(max, m.max(-2, l + (thisX - x)));
                        f.btn.style.left = to + 'px';
                        f.ondrag(m.round(m.max(0, to / max) * 100), to);
                        b.getSelection ? b.getSelection().removeAllRanges() : g.selection.empty();
                    };
                    g.ontouchend = new Function('this.οnmοusemοve=null');
                };
            },
            ondrag: function (pos, x) {
                this.step.style.width = Math.max(0, x) + 'px';
                // this.title.innerHTML = pos + '%';
                myPos=pos
                $(".nimo-cover").css("left",pos+"%")
            },
        
        }
        new scale('btn', 'bar', 'title');
        $("#btn").on("touchend",function(){
            $.ajax({
                url:'http://openapi.lvdou66.com/captcha/slide/check.html',
                data:{
                    data:myId+myPos*6,
                    checktype:2,
                    pkg:'gzh'
                },
                success:function(msg){
                    var data=JSON.parse(msg);
                    if(data.code==1){
                        $(".yanzheng-shadow").fadeOut(350)
                        layer.msg("验证码已发送")
                        try{
                            $(".code-btn").text('60s后获取').css("background", "#e5e5e5").attr("disabled", true);
                            eTime = 60
                            clearInterval(codeTime)
                            codeTime = setInterval(function () {
                                eTime--
                                if (eTime == 0) {
                                    clearInterval(codeTime)
                                    $(".code-btn").css("background", 'linear-gradient(to right, #FAE7AC, #F7CA6A)').attr("disabled", false);
                                    $(".code-btn").text('获取验证码')
                                    return;
                                }
                                $(".code-btn").text('' + eTime + 's后获取')
                            }, 1000)
                        }catch (e) {
                        }
                    }else{
                        layer.msg("模块验证错误")
                    }
                }
            })
        })
        var codeTime = null
        var eTime
        var fp = new Fingerprint2();
        fp.get(function(result, components) {
            canvasCode=result
        });
        // if(localStorage.uid!=undefined&&localStorage.uid!="undefined"){
        //     $.ajax({
        //         url:$ip+'activesys/getUserBaseInfo',
        //         type: "post",
        //         data: {
        //             uid:localStorage.uid,
        //             token:localStorage.token
        //         },
        //         success:function(msg){
        //             var data = JSON.parse(msg)
        //             console.log("获取用户基本信息",data)
        //             if(data.code==1){
        //                 window.location.href='index.html';
        //             }else{
        //                 layer.msg(data.msg)
        //             }
        //         }
        //     })
        // }

        $(".code-btn").on("click", function () {
            if ($(".login-phone-ipt").val().length > 10) {
                $(".yanzheng-shadow").fadeIn(350)
                $.ajax({
                    url:'http://openapi.lvdou66.com/captcha/slide/webget.html',
                    data:{
                        phone:$(".login-phone-ipt").val()
                    },
                    type:"post",
                    success:function(msg){
                        var data = JSON.parse(msg)
                        $(".nimo .nimo-bg").attr("src",""+data.background+"")
                        $(".nimo .nimo-cover").attr("src",""+data.cover+"")
                        var myTop=Math.floor((data.y/66.66)*100)/100
                        $(".nimo-cover").css("top",myTop+"rem")
                        myId=data.id
                    }
                })
                // $.ajax({
                //     url: $ip + 'wx/phonelogincap.html',
                //     type: "post",
                //     data: {
                //         phone: $(".login-phone-ipt").val()
                //     },
                //     success: function (msg) {
                //         var data = JSON.parse(msg)
                //         console.log('获取验证码', data)
                //         if (data.code == 1) {
                //             try{
                //                 $(".code-btn").text('60s后获取').css("background", "#e5e5e5").attr("disabled", true);
                //                 eTime = 60
                //                 clearInterval(codeTime)
                //                 codeTime = setInterval(function () {
                //                     eTime--
                //                     if (eTime == 0) {
                //                         clearInterval(codeTime)
                //                         $(".code-btn").css("background", 'linear-gradient(to right, #FAE7AC, #F7CA6A)').attr("disabled", false);
                //                         $(".code-btn").text('获取验证码')
                //                         return;
                //                     }
                //                     $(".code-btn").text('' + eTime + 's后获取')
                //                 }, 1000)
                //             }catch (e) {
                //             }
                //         } else {
                //             layer.msg(data.msg)
                //         }
                //     }
                // })
 
            } else {
                layer.msg("请输入手机号")
            }

        })
        $(".login-btn").on("click", function () {
            $.ajax({
                url:$ip+'wx/phonelogin.html',
                data:{
                    phone:$(".login-phone-ipt").val(),
                    cap:$(".login-code-ipt").val(),
                },
                type:"post",
                success:function(msg){
                    var data=JSON.parse(msg)
                        console.log(data);
                        if(data.code==1){
                            localStorage.uid=data.uid
                            localStorage.token=data.token
                            window.location.href='https://activity.ishuaji.cn/active2020/subsidy/index.html?uid='+data.uid+'&token='+data.token+'';
                            // $.cookie("tbb", data.token, {expires: 30, path: "/"});
                            // $.cookie("ukk", data.uid, {expires: 30, path: "/"});
                            // window.location.href='room.html?roomid='+goRoom+''
                        }else{
                            layer.msg(data.msg);
                        }
                }
            })
        })
    })


</script>

</html>