<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <title>添加同行人</title>
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
    <script type="text/javascript" src="__TMPL__/static/js/base.js"></script>
    <link rel="stylesheet" type="text/css" href="__TMPL__/static/assets/css/weui.min.css" />
    <link rel="stylesheet" type="text/css" href="__TMPL__/static/assets/css/swiper-3.4.2.min.css" />
    <link rel="stylesheet" type="text/css" href="http://at.alicdn.com/t/font_773803_3se1rq7vwl5.css" />
    <script type="text/javascript" src="__TMPL__/static/assets/font/iconfont.js">
    </script>
    <link rel="stylesheet" href="__TMPL__/static/css/common.css" />
    <link rel="stylesheet" href="__TMPL__/static/css/addlPartner.css" />
</head>
<body>
<ul class="list">
    <li>
        <span class="real">真实姓名</span>
        <input class="add name" placeholder="请填写真实姓名" />
    </li>
    <li class=''>
        <span class="real">性别</span>
        <div class="sexs">
            <div class="circle_left circles" data-sex="1">
                <img src="__TMPL__/static/images/circle1.png" alt="" />
                <div class="woman"></div>
            </div>
            <div class="circle_right circles" data-sex="0">
                <img src="__TMPL__/static/images/circle.png" alt="" />
                <div class="man"></div>
            </div>
        </div>

    </li>
    <li>
        <span class="real">手机号</span>

        <input type="text" placeholder="请填写手机号码" class="add tel" />

    </li>
    <li>
        <span class="real">微信号码</span>
        <input type="text" placeholder="请填写微信号码" class="add weixin" />
    </li>
    <li>
        <span class="real">身份证号</span>
        <input type="text" placeholder="请填写身份证号" class="add zfzid" />
    </li>
</ul>
<!--====底部=====-->

<footer class="foot ok">
    保存
</footer>

<div id="toast" style='display: none;'>
    <div class="weui-mask_transparent"></div>
    <div class="weui-toast">
        <!--<i class="weui-icon-success-no-circle weui-icon_toast"></i>-->
        <p class="weui-toast__content">已完成</p>
    </div>
</div>
</body>
<script type="text/javascript" src="__TMPL__/static/assets/js/jquery-2.1.0.js"></script>
<script type="text/javascript" src="__TMPL__/static/assets/js/common.js"></script>
<script type='text/javascript' src='__TMPL__/static/assets/js/Augly_Verification.js'></script>
<script>
    var sex=1;
    $('.circles').click(function () {
        sex = $(this).attr('data-sex');
    });

    $(function() {
        $('.ok').click(function() {
            if($('.name').val() == '') {
                toast('请填入您的姓名');
            } else if($('.tel').val() == '') {
                toast('请输入电话号码');
            } else if(!AuglyTest_phone.test($('.tel').val())) {
                toast('电话号码格式不正确');
            } else if($('.weixin').val() == '') {
                toast('请输入微信号码');
            } else if($('.zfzid').val() == '') {
                toast('请输入身份证号');
            } else if(!AuglyTest_ID.test($('.zfzid').val())) {
                toast('身份证号输入不正确');
            } else {
                $.ajax({
                    url:"{:url('Escort/add')}",
                    data:{
                        name:$('.name').val(),
                        tel:$('.tel').val(),
                        identity:$('.zfzid').val(),
                        wechat:$('.weixin').val(),
                        sex:sex
                    },
                    type:"POST",
                    dataType:"JSON",

                    success: function () {
                        window.location.href="{:url('Escort/_list')}";
                    }
                })
            }
        })
        var $abs = $('.sexs .circle_left div.circle_iput');
        $('.circle_left').click(function(){
            $(this).find('.circle_black').css('background','#656565');
            $(this).find('.circle_black').css('opacity','1');
            $('.circle_right').find('.circle_black').css('background','#fff');
            $('.circle_right').find('.circle_black').css('opacity','0');

        });
        $('.circle_right').click(function(){
            $(this).find('.circle_black').css('background','#656565');
            $(this).find('.circle_black').css('opacity','1');
            $('.circle_left').find('.circle_black').css('background','#fff');
            $('.circle_left').find('.circle_black').css('opacity','0');

        });

        $('.check').click(function(){
            $(this).addClass('active').siblings().removeClass('active')
        })
        $('.circles img').click(function(event) {
            $(this).attr("src", "/themes/simpleboot3/static/images/circle1.png");
            $(this).parents('.circles').siblings().find('img').attr("src", "/themes/simpleboot3/static/images/circle.png");
        });
    })
</script>

</html>