<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no">
    <link href="{{cdn_asset('/assets/css/bootstrap.min.css')}}" rel="stylesheet">
    <title>tijian</title>
    <script type="text/javascript">
        (function (doc, win) {
            var docEl = doc.documentElement,
                resizeEvt = 'orientationchange' in window ? 'orientationchange' : 'resize',
                recalc = function () {
                    var clientWidth = docEl.clientWidth;
                    if (!clientWidth) return;
                    if(clientWidth>=640){
                        docEl.style.fontSize = '100px';
                    }else{
                        docEl.style.fontSize = 100 * (clientWidth / 640) + 'px';
                    }
                };

            if (!doc.addEventListener) return;
            win.addEventListener(resizeEvt, recalc, false);
            doc.addEventListener('DOMContentLoaded', recalc, false);
        })(document, window);
    </script>
    <style type="text/css">
        .all{
            width: 100%;
            height: auto;
        }
        img{
            width: 50px;
            height: 50px;
            margin-top: 18px;
        }
        h3{
            text-align: center;
        }
        .all .main{
            flex-wrap: wrap;
            display: flex;
        }
        .all .input-group{
            margin:4px 6%;
        }
        .all .danxuan{
            width: 66.66%;
            margin: 4px 16.66%;
        }
        #tanchuang{
            position: fixed;
            z-index: 999;
            width: 100%;
            height: 100%;
            top: 0;
            left: 0;
            background: rgba(0,0,0,0.5);
        }
        #tanchuang .tanbox{
            width: 240px;
            height: auto;
            background: #fff;
            position: absolute;
            left: 50%;
            top: 50%;
            margin-left: -120px;
            margin-top: -60px;
            border-radius: 15px;
        }
        .tanbox .status{
            width: 80%;
            height: 70%;
            margin: 10%;
        }
        .tanbox .status text{
            display: inline-block;
            width: 100%;
            text-align: center;
            margin-top: 10px;
        }
        .tanbox .status .title{
            display: inline-block;
            width: 100%;
            font-size: 20px;
            font-weight: 700;
            text-align: center;
            color: #f04;
            margin-top: 10px;
        }
        .tanbox .status button{
            width: 80px;
            margin-left: 52px;
            margin-top: 10px;
        }
        .tanbox .b2 button{
            width: 90px;
            margin-left: 7px;
            margin-top: 10px;
            margin-bottom: 30px;
        }
        .imgbox img{
            height: 40px;
        }
    </style>
</head>
<body>
<script type="text/javascript">
    var url = '';
    var downurl = '';
    var yan = 0;
    var countdown = 60;
    var sending = false;
    function settime(obj) { //发送验证码倒计时
        console.log(obj)

        if (countdown == 0) {
            obj.attr('disabled', false);
            obj.val("发送验证码");
            countdown = 60;
            sending = false;
            return;
        } else {
            obj.attr('disabled', true);
            obj.val("重新发送(" + countdown + ")");
            countdown--;
        }
        setTimeout(function () {
            settime(obj);
        }, 1000)
    }

    function submits(){
        var array = new Array();
           var items = document.getElementsByName("sample_type");   
            for(var i = 0; i < items.length; i++){
                 if(items[i].checked){
                    var p = Number(items[i].value);
                    array.push(p);
                 } 
            }
            var l = array.length;
            var arr = '';
            if(l>=1){
                arr = array[0];
                for(var t = 1;t < l;t++){
                    arr = arr+','+array[t]
                }
            }else{
                arr = array;
            }
        // var mobile = $('#mobile').val();
        // if(mobile == '' || !phonenum(mobile)){
        //     alert('请输入正确手机号');
        // }else{
            $.ajax({
                url:"{{ url('/web/Index/sms') }}",
                traditional:true,
                headers: {
                    'X-CSRF-TOKEN': "{{ csrf_token() }}"
                },
                type:'POST',
                data:{
                    // mobile:mobile,
                    name:$('#name').val(),
                    mobile:$('#mobile').val(),
                    age:$('#age').val(),
                    sex:$('input[name="sex"]:checked ').val(),
                    sample_type:arr,
                    nationality:$('#nationality').val(),
                    native_place:$('#native_place').val(),
                    email:$('#email').val(),
                    work:$('#work').val(),
                    address:$('#address').val(),
                },
                success:function (msg) {
                    console.log(msg)
                    if(msg.state ==0){
                        alert("提交失败！")
                    } else if(msg.state ==1){
                        window.location.href=msg.redirect_url;
                    }
                }
            });
        // }

    }
</script>
<div class="all">
        <div class="col-xs-0 col-lg-2"></div>
        <div class="col-xs-12 col-lg-8 main" style="margin: 0 auto;margin-top: 10px;">
            <div class="col-xs-12 col-lg-12 imgbox" style="width:100%;margin-bottom:20px;display: flex;height: auto;" >
                <img  class="col-xs-3 col-lg-2" src="{{cdn_asset('/assets/img/logo.jpg')}}">
                <img  class="col-xs-9 col-lg-10" src="{{cdn_asset('/assets/img/top.jpg')}}" alt="">
            </div>
            
            <form id="tform" class="bs-example bs-example-form main" role="form">
                <input type="hidden" name="mobile" id="mobile" value="{{$mobile['mob']}}">
                <div class="col-xs-10 col-lg-4 input-group input">
                    <span class="input-group-addon">姓名：</span>
                    <input type="text" class="form-control" name="name" id="name" placeholder="请输入姓名" required>
                </div>
                <div class="col-xs-10 col-lg-4 input-group input">
                    <span class="input-group-addon">籍贯：</span>
                    <input type="text" class="form-control" name="native_place" id="native_place" placeholder="请输入籍贯" required>
                </div>
                <div class="col-xs-10 col-lg-4 input-group input">
                    <span class="input-group-addon">民族：</span>
                    <input type="text" class="form-control" name="nationality" id="nationality" placeholder="请输入民族" required>
                </div>
                <div class="col-xs-10 col-lg-4 input-group input">
                    <span class="input-group-addon">年龄：</span>
                    <input type="text" class="form-control" name="age" id="age" placeholder="请输入年龄" required>
                </div>
                <div class="col-xs-10 col-lg-4 input-group input">
                    <span class="input-group-addon">职业：</span>
                    <input type="text" class="form-control" name="work" id="work" placeholder="请输入职业" required>
                </div>
                <div class="col-xs-10 col-lg-4 input-group input">
                    <span class="input-group-addon">邮箱：</span>
                    <input type="text" class="form-control" name="email" id="email" placeholder="请输入邮箱" required>
                </div>
                <!-- <div class="col-xs-10 col-lg-4 input-group" style="display:flex">
                    <span class="input-group-addon" style="width: 21%;line-height: 20px;font-size: 10px;">手机号</span>
                    <input style="display:inline-block;width:34%;font-size: 10px;" class="btn btn-default" id="fasong" value="获取验证码" onclick="yanzhengma()">
                    <input style="width: 45%;" type="text" name="mobile" id="mobile" class="form-control" placeholder="请输入手机号" required="">
                </div>
                <div id="yzma" class="col-xs-10 col-lg-4 input-group">
                    <span  class="input-group-addon">验证码:</span>
                    <input type="text" name="verify" id="verify" class="form-control" placeholder="请输入验证码" required="">
                </div> -->
                <div class="col-xs-10 col-lg-4 input-group">
                    <span class="input-group-addon">住址：</span>
                    <input type="text" class="form-control" name="address" id="address" placeholder="请输入住址" required>
                </div>
                <div class="danxuan">
                    <label for="name">性别：</label>
                    <div>
                        <label class="checkbox-inline">
                            <input name="sex" type="radio" value="1" checked>男
                        </label>
                        <label class="checkbox-inline">
                            <input name="sex" type="radio" value="0">女
                        </label>
                    </div>
                    <label for="name">样本类型:</label>
                    <div class="checkbox">
                        <label><input type="checkbox" value="1" name="sample_type">EDTA抗凝静脉血</label>
                    </div>
                    <div class="checkbox">
                        <label><input type="checkbox" value="2" name="sample_type">口腔拭子</label>
                    </div>
                    <div class="checkbox">
                        <label><input type="checkbox" value="3" name="sample_type">宫颈刷</label>
                    </div>
                    <button style="margin-left: 80%;margin-bottom: 20px;" type="button" onclick="submits()" class="btn btn-default">提交</button>
                </div>
                <div id="tanchuang" style="display: none;">
                    <div class="tanbox">
                        <div style="width: 20px;height: 20px;text-align: center;position: absolute;top: -5px;right: -5px;background: #000;font-weight:700;color:#fff;border-radius: 20px;" onclick="closebox()">X</div>
                        <div class="status b0">
                            <text id="txt1" class="title"></text>
                        </div>
                        <div class="status b1">
                            <text id="txt2" class="title"></text>
                            <button class="btn btn-default" id="yeah" type="button" onclick="thebtn(this)">查看详情！</button>
                        </div>
                        <div class="status b2">
                            <text id="txt3" class="title"></text>
                            <button class="btn btn-default" id="next" type="button" onclick="thebtn(this)">查看详情！</button>
                            <button class="btn btn-default" id="download" type="button" onclick="thebtn(this)">查看反馈！</button>
                        </div>
                    </div>
                </div>
            </form>
        </div>
    </div>
<!-- jQuery (Bootstrap 的 JavaScript 插件需要引入 jQuery) -->
<script src="{{cdn_asset('/assets/js/jquery-3.2.1.js')}}"></script>
<script src="{{cdn_asset('/assets/js/bootstrap.min.js')}}"></script>

</body>
</html>