<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>用户注册</title>
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
    <link rel="stylesheet" href="#(CPATH)/static/components/bootstrap/css/bootstrap.min.css">
    <link rel="stylesheet" href="#(CPATH)/static/components/font-awesome/css/font-awesome.min.css">
    <link rel="stylesheet" href="#(CPATH)/static/components/ionicons/css/ionicons.min.css">
    <link rel="stylesheet" href="#(CPATH)/static/adminlte/css/AdminLTE.min.css">

    <!--[if lt IE 9]>
    <script src="#(CPATH)/static/html5shiv/html5shiv.min.js"></script>
    <script src="#(CPATH)/static/respond/respond.min.js"></script>
    <![endif]-->
    <style>
        .login-page {
            background-image: url("#(CDN)#(CPATH)/static/commons/img/bg.png");
            background-size: cover;
        }

        .form-group {
            text-align: left;
        }

        .login-box {
            width: 360px;
            margin: 5% auto;
            padding: 0;
        }
    </style>

    <script>

        function doGetSmsCode() {
            var phone = $('#phone').val();
            var captcha = $('#captcha').val();

            if (phone == '') {
                alert('手机号不能为空....');
                return;
            }
            if (captcha == '') {
                alert('验证码不能为空....');
                return;
            }


            $.get("#(CPATH)/commons/getsmscode?phone=" + phone + "&captcha=" + captcha, function (result) {
                $('#captcha').val('');
                $('#captchaimg').attr("src", '#(CPATH)/commons/captcha?d=' + Math.random())
                alert(result.message);
            });
        }

    </script>
</head>
<body class="hold-transition login-page">

<div class="row">
    <div class="login-box text-center">
        <div class="login-box-body">
            <form action="#(CPATH)/user/doRegister" method="post" class="autoAjaxSubmit" data-ok-function="ok">
                <div class="form-group">
                    <label>账号</label>
                    <input type="text" class="form-control" placeholder="请输入账号" name="username">
                </div>
                #if(option('reg_sms_validate_enable'))
                <div class="form-group">
                    <label>手机号</label>
                    <input type="text" class="form-control" placeholder="请输入手机号" name="phone" id="phone">
                </div>
                <div class="form-group">
                    <label>手机验证码</label>
                    <div>
                        <input type="text" class="form-control" style="width: 120px;float: left;margin-right: 10px"
                               placeholder="请输入验证码" name="sms_code">
                        <button type="button" class="btn btn-primary btn-block btn-flat" style="width: 100px;"
                                onclick="doGetSmsCode()">
                            获取验证码
                        </button>
                    </div>
                </div>
                #end
                <div class="form-group">
                    <label>邮箱</label>
                    <input type="text" class="form-control" placeholder="请输入邮箱" name="email">
                </div>
                <div class="form-group">
                    <label>密码</label>
                    <input type="password" class="form-control" placeholder="密码..." name="pwd">
                </div>
                <div class="form-group">
                    <label>确认密码</label>
                    <input type="password" class="form-control" placeholder="及确认密码" name="confirmPwd">
                </div>
                <div class="form-group">
                    <label>验证码</label>
                    <input type="text" class="form-control" placeholder="请输入验证码" name="captcha" id="captcha">
                    <img src="#(CPATH)/commons/captcha" onclick="this.src='#(CPATH)/commons/captcha?d='+Math.random();"
                         cdn-exclude id="captchaimg">
                </div>
                <div class="row">
                    <div class="col-xs-12" style="padding-top: 15px">
                        <button type="submit" class="btn btn-primary btn-block btn-flat">注 册</button>
                    </div>
                </div>

            </form>

        </div>
    </div>
</div>

<script src="#(CPATH)/static/components/jquery/jquery.min.js"></script>
<script src="#(CPATH)/static/components/jquery/jquery.form.min.js"></script>
<script src="#(CPATH)/static/components/bootstrap/js/bootstrap.min.js"></script>
<script src="#(CPATH)/static/commons/jpresscommons.js"></script>
<script>
    function ok(){
        alert("注册成功，点击确定进行登录。")
        location.href = "#(CPATH)/user/login";
    }
</script>

</body>
</html>
