<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>修改性别</title>
    <script src="__JS__/jquery-1.11.3.min.js"></script>
    <script type="text/javascript" src="__JS__/getRem.js"></script>
    <link rel="stylesheet" type="text/css" href="__CSS__/reset.css">
    <link rel="stylesheet" type="text/css" href="__CSS__/foot_tabbar.css">
    <link rel="stylesheet" type="text/css" href="__CSS__/step1.css">
    <link href="__CSS__/common.css" rel="stylesheet" >
    <link rel="stylesheet" type="text/css" href="__CSS__/gender.css">
    <style>
        body {
            background: white;
        }
    </style>
</head>
<body>


<div class="name">
    <!-- 子页公共头部 -->
    <div class="subpage-heard">修改性别
        <a href="javascript:window.history.go(-1);" class="arrows"></a>
    </div>

    <form action="" id="form">
    <div class="gender-info">
        <div class="gender-input">
            <div class="gender-inputBox">
                <img src="__IMG__/xingbie2.png" alt="">
                <div>性别</div>
            </div>
            <div class="gender-sel">
                <div class="radio">
                    <span>男</span>
                    <input id="radio-1" name="sex" type="radio" value="0" class="<if condition='$sex == 0'>on</if>" checked>
                    <label for="radio-1" class="radio-label"></label>
                </div>

                <div class="radio">
                    <span>女</span>
                    <input id="radio-2" name="sex" type="radio" value="1" class="<if condition='$sex == 1'>on</if>">
                    <label  for="radio-2" class="radio-label"></label>
                </div>
            </div>
        </div>
    </div>
    </form>

    <div class="save jssubmit">保存修改</div>
</div>

<div class="popmsg pop-dialog"></div>
<script src="__JS__/pop.lwx.min.js"></script>
<script>
    $(function() {
        $('input[name=sex]').click(function() {
            var that = $(this);
            $('input[name=sex]').removeClass('on');
            if (that.prop('checked')) {
                that.addClass('on');
            }
        });

        $('.jssubmit').click(function() {
            var pmsg = $('.popmsg').pop();
            $.ajax({
                cache:true,
                type:'post',
                url:"{:U('User/usersex')}",
                data:$('#form').serialize(),
                dataType:'json',
                success:function(result){
                    pmsg.msg(result.info);
                    if(result.url !=''){
                        setTimeout(function () {
                            window.location.href = result.url;
                        }, 2000);
                    }
                },
                error:function(){
                    alert("错误")
                }
            })
        });

    });
</script>
</body>
</html>