<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head th:replace="common/header :: common_head(~{::title},~{::meta},~{::link},~{})">
    <title th:text="'会员注册_'+#{website.name}"></title>
    <meta name="keywords" th:content="'会员注册,个人中心,'+#{website.name}+'小说,'+#{website.name}"/>
    <meta name="description"
          th:content="#{website.name}+'小说每日更新小说连载,小说排行榜,提供言情小说,都市小说,玄幻小说,穿越小说,青春小说,总裁豪门小说,网络小说,免费小说,全本小说,首发小说,最新章节免费小说阅读,精彩尽在'+#{website.name}+'小说！'"/>
    <link rel="stylesheet" href="/css/user.css" />
</head>
<body class="">

<div th:replace="common/top :: top('')">
</div>

<div class="main box_center cf">
    <div class="userBox cf">
        <form method="post" action="./register.html" id="form2">
            <div class="aspNetHidden">
                <input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE"
                       value="/wEPDwUKLTIzNjMxNDQxNw9kFgJmD2QWAmYPFgIeBFRleHQFqAE8YSBocmVmPSIvc2VhcmNoLmFzcHg/c2VhcmNoS2V5PeWWu+Wuiembr++8jOeLhOazve+8jOeBteW8gu+8jOWJjeS4luS7iueUn++8jOWGpeeOi+msvOWkqyIgdGFyZ2V0PSJfYmxhbmsiPuWWu+Wuiembr++8jOeLhOazve+8jOeBteW8gu+8jOWJjeS4luS7iueUn++8jOWGpeeOi+msvOWkqzwvYT5kZOquoASBvnvPbc/TYIQiLhSPJ8GKnYQrmk7jGhb5AC5Q"/>
            </div>

            <div class="aspNetHidden">

                <input type="hidden" name="__VIEWSTATEGENERATOR" id="__VIEWSTATEGENERATOR" value="23AA6834"/>
                <input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION"
                       value="/wEdAAVece19BIZ9HiByRfHz3pfnqKSXUE1UN51mNFrIuw38c3Y2+Mc6SrnAqio3oCKbxYZZ1lS+gZUZKpbsAea8j7ASAv40DHFcQ/NE7tJUnABeyQ3d9sFDIcFCYNqlVtprfLoh4JFy0U+R/CcMuyAiWTz7"/>
            </div>
            <div class="user_l">
                <h3 th:text="'注册'+#{website.name}+'小说账号'"></h3>
                <ul class="log_list">
                    <li><span id="LabErr"></span></li>
                    <li><input name="txtUName" type="text" id="txtUName" class="s_input icon_name"
                               placeholder="请输入您的手机号码"/></li>
                    <li><input name="txtPassword" type="password" id="txtPassword" class="s_input icon_key"
                               placeholder="请输入密码：6-20位字母/数字"/></li>
                    <li class="log_code cf"><input name="TxtChkCode" type="text" maxlength="4" id="TxtChkCode"
                                                   class="s_input icon_code" placeholder="请输入验证码"/><img
                            style="border: 1px solid #eee" class="code_pic" src="" id="chkd"
                            onclick="getVerify(this);"/></li>
                    <li><input type="button" name="btnRegister" value="注册" id="btnRegister" class="btn_red"/></li>
                </ul>
            </div>
        </form>
        <div class="user_r">
            <p class="tit">已有账号？</p>
            <a href="/user/login.html" class="btn_ora_white">立即登录</a>
            <div class="fast_login" style="display:none;">
                <div class="fast_tit">
                    <p class="lines"></p>
                    <span class="title">其他登录方式</span>
                </div>
                <ul class="fast_list">
                    <li class="login_wb"><a href="/"><img src="/images/login_weibo.png" alt="微博登录"
                                                                    class="img"><span>微博登录</span></a></li>
                    <li class="login_qq"><a href="/"><img src="/images/login_qq.png" alt="QQ登录"
                                                                    class="img"><span>QQ登录</span></a></li>
                    <li class="login_wx"><a href="/"><img src="/images/login_weixin.png" alt="微信登录"
                                                                    class="img"><span>微信登录</span></a></li>
                </ul>
            </div>
        </div>
    </div>
</div>

<div th:replace="common/footer :: footer">
</div>
<div th:replace="common/js :: js"></div>
<script language="javascript" type="text/javascript">
    $("#chkd").click();
    $(function () {
        $("#form2").submit(function () {
            if ($("#txtUName").val() != "" && $("#txtPassword").val() != "" && $("#TxtSmsCode").val() != "") {
            } else {
                layer.open({
                    content: '请填写全部资料',
                    style: UserUtil.msgStyle,
                    time: 2
                });
                return false;
            }
        });
    });

    //获取验证码
    function getVerify(obj) {
        obj.src = "/file/getVerify?" + Math.random();
    }

    $("#btnRegister").click(function () {
        var username = $("#txtUName").val();
        if (username.isBlank()) {
            $("#LabErr").html("手机号不能为空！");
            return;
        }
        if (!username.isPhone()) {
            $("#LabErr").html("手机号格式不正确！");
            return;
        }
        var password = $("#txtPassword").val();
        if (password.isBlank()) {
            $("#LabErr").html("密码不能为空！");
            return;
        }
        var velCode = $("#TxtChkCode").val();
        if (velCode.isBlank()) {
            $("#LabErr").html("验证码不能为空！");
            return;
        }
        $.ajax({
            type: "POST",
            url: "/user/register",
            data: {"username": username, "password": password,"velCode":velCode},
            dataType: "json",
            success: function (data) {
                if (data.code == 200) {
                    $.cookie('Authorization', data.data.token, {path: '/'});
                    window.location.href="/";
                } else {
                    $("#LabErr").html(data.msg);
                }

            },
            error: function () {
                layer.alert('网络异常');
            }
        })

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