info.html 4.4 KB
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <title>十方台公众号</title>
    <script src="__TMPL__/public/assets/js/jquery-2.1.0.js"></script>
    <script src="__TMPL__/public/assets/js/fontsize.js"></script>
    <script src="__TMPL__/public/assets/js/weui.js"></script>
    <script src="__TMPL__/public/assets/js/myweui.js"></script>
    <link href="__TMPL__/public/assets/css/weui.css" rel="stylesheet">
    <link href="__TMPL__/public/assets/css/myweui.css" rel="stylesheet">
    <link href="__TMPL__/public/assets/css/personal-info.css" rel="stylesheet">
</head>
<body>
<div class="content">
    <div class="name-box">
        <div class="input-box">
            <text>姓名</text>
            <input class="input" type="text" placeholder="请输入姓名" cursor="100" placeholder-class="placeholder-style"
                   id="user_name" value="" bindinput="inputName"/>
        </div>
    </div>
    <div class="age-box">
        <div class="input-box">
            <text>年龄</text>
            <input class="input" type="number" placeholder="请输入年龄" cursor="100" placeholder-class="placeholder-style"
                   id="age" value="" bindinput="inputName"/>
        </div>
    </div>
    <div class="age-box" id='showDatePicker'>
        <div class="input-box">
            <text>生日</text>
            <text id="date" class="date"></text>
            <!--<input type="text" id='showDatePicker' bindblur="birthBlur"/>-->
        </div>
    </div>
    <div class="sex-box">
        <div class="input-box">
            <text>性别</text>
            <div class="man active" data-id="1"></div>
            <div class="women" data-id="2"></div>
        </div>
    </div>
    <div class="family-box">
        <div class="input-box">家庭住址(选填)</div>
        <div class="address-input">
            <input class="input" type="text" placeholder="请填写您的家庭住址(选填)" cursor="100"
                   placeholder-class="placeholder-style"
                   value="" id="address" bindinput="inputName"/>
        </div>
    </div>
    <div class="footer" onclick="goNext()">
        <div class="confirm-btn">
            <text>确定</text>
        </div>
    </div>
</div>
</body>
<script>
//    $("#showDatePicker").blur(function(){$("keyboard").hide();});
     $('#showDatePicker').on('click', function () {
                weui.datePicker({
                        start: 1990,
                        end: new Date().getFullYear(),
                        onChange: function (result) {
                            // console.log(result);
                            },
                   onConfirm: function (result) {
                           $('#date').text(result[0].label + result[1].label + result[2].label)
                        }
                });
            });

    $(".man").click(function () {
        $(".man").addClass('active');
        $(".women").removeClass('active');
    })
    $(".women").click(function () {
        $(".women").addClass('active');
        $(".man").removeClass('active');
    })

    function goNext() {
        var user_name = $('#user_name').val()
        var age = $('#age').val()
        var sex = $('.active').data("id")
//        console.log(sex)
        var address = $('#address').val()
        if (user_name == "") {
            alert('请输入姓名')
            return false
        }
        if (age == "") {
            alert('请输入年龄')
            return false
        }
        alert($('#date').text());
        if ($('#date').text()==""){
            alert('请选择出生日期')
            return false
        }
        $.ajax({
            url: "{:url('user/register/postInfo')}",
            type: "post",
            data: {
                birthday:$('#date').text(),
                user_name: user_name,
                age: age,
                sex: sex,
                address: address,
            },
            success: function (data) {
                if (data == 1) {
                    alert('十方台温馨提示:\n注册成功')
                    window.location.href = "{:url('portal/index/index')}";
                } else {
                    alert('十方台温馨提示:\n注册失败')
                    return false
                }
            }
        })
    }
</script>
</html>