<%@ page language="C#" autoeventwireup="true" inherits="ims.regPage, ims.web" enableviewstatemac="false" enableEventValidation="false" %>
<!DOCTYPE html>
<html id="reg" runat="server">
<head runat="server">
    <title></title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge" /><meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0">
</head>
<body>
    <form id="form1" runat="server" defaultbutton="btnSubmit">
    <div class="hide"><input type="password" /></div>
        <asp:ScriptManager ID="s1" runat="server" OnAsyncPostBackError="AsyncError">
            <CompositeScript Path="js/msajax.js" ScriptMode="Release">
                <Scripts>
                    <asp:ScriptReference Name="WebForms.js" Assembly="System.Web" /><asp:ScriptReference Name="MicrosoftAjax.js" /><asp:ScriptReference Name="MicrosoftAjaxWebForms.js" />
                </Scripts>
            </CompositeScript>
        </asp:ScriptManager>
        <asp:ValidationSummary ID="ValSum" runat="server" ShowMessageBox="True" ShowSummary="False"></asp:ValidationSummary>
        <div runat="server" id="titler" visible="false">
            <img src="images/logo.png" id="logoico" /><span><%= ims.Sys.OrgName + ims.Sys.SysName + " > 用户注册" %></span>
        </div>
        <div runat="server" id="pageTitle" class="pageTitle"><%= Title %></div>
        <div id="mainArea">
        <div id="lArea">
        <table class="hr">
            <tbody runat="server" id="tbody">
            <tr runat="server" id="tr_UserName">
                <td class="col1">用户名<span class="required">*</span></td>
                <td class="col2">
                    <asp:UpdatePanel ID="up1" RenderMode="inline" runat="server">
                        <ContentTemplate>
                            <asp:TextBox runat="server" ID="userName" OnTextChanged="chkName" autocomplete="off" AutoPostBack="true" MaxLength="50"></asp:TextBox>
                        </ContentTemplate>
                    </asp:UpdatePanel>
                    <asp:RequiredFieldValidator SetFocusOnError="true"
                        ID="RequiredVal_userName" ControlToValidate="userName" runat="server" Display="None" ErrorMessage="请输入用户名！"></asp:RequiredFieldValidator></td>
            </tr>
            <tr runat="server" id="tr_realName">
                <td class="col1">真实姓名<span class="required" runat="server" id="required_realName">*</span></td>
                <td class="col2">
                    <asp:TextBox runat="server" ID="realName" autocomplete="off" MaxLength="50"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="RequiredVal_realName" runat="server" ControlToValidate="realName" ErrorMessage="请输入真实姓名！" Display="None"></asp:RequiredFieldValidator>
                    <asp:RegularExpressionValidator ID="RegularVal_realName" runat="server" SetFocusOnError="true" ValidationExpression=".{2,50}" ControlToValidate="realName" Display="None" ErrorMessage="姓名长度必须介于2到50之间！"></asp:RegularExpressionValidator>
                </td>
            </tr>
            <tr runat="server" id="tr_Sex">
                <td class="col1">性别</td>
                <td class="col2">
                    <asp:RadioButtonList runat="server" ID="sex" RepeatDirection="Horizontal" RepeatLayout="Flow">
                        <asp:ListItem Text="男 " Value="true" Selected="True" />
                        <asp:ListItem Text="女" Value="false" />
                    </asp:RadioButtonList></td>
            </tr>
            <tr runat="server" id="tr_PassWord">
                <td class="col1">登录密码<span class="required">*</span></td>
                <td class="col2">
                    <asp:TextBox runat="server" TextMode="Password" ID="passWord" autocomplete="new-password" MaxLength="128"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="RequiredVal_passWord" runat="server" ControlToValidate="passWord" ErrorMessage="请输入密码！" Display="None"></asp:RequiredFieldValidator>
                    <asp:RegularExpressionValidator ID="RegularVal_passWord" runat="server" SetFocusOnError="true" ValidationExpression="^\S{3,128}$" ControlToValidate="passWord" Display="None" ErrorMessage="输入的密码不符合要求！"></asp:RegularExpressionValidator></td>
            </tr>
            <tr runat="server" id="tr_rePassWord">
                <td class="col1">确认密码<span class="required">*</span></td>
                <td class="col2">
                    <asp:TextBox ID="rePassWord" TextMode="Password" runat="server" autocomplete="off" MaxLength="128" ToolTip="请再输入一次密码，以确认输入是正确的"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="RequiredVal_rePassWord" runat="server" ControlToValidate="rePassWord" ErrorMessage="请输入确认密码！" Display="None"></asp:RequiredFieldValidator>
                    <asp:CompareValidator ID="CompareVal_rePassWord" runat="server" ControlToCompare="passWord"
                        ControlToValidate="rePassWord" Display="None" ErrorMessage="两次密码输入不一致！"></asp:CompareValidator></td>
            </tr>
            <tr runat="server" id="tr_Phone">
                <td class="col1">手机号码<span class="required" runat="server" id="required_phone">*</span></td>
                <td class="col2">
                    <asp:TextBox runat="server" autocomplete="off" AutoCompleteType="BusinessPhone" ID="phone"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="RequiredVal_phone" runat="server" ControlToValidate="phone" ErrorMessage="请输入手机号码！" Display="None"></asp:RequiredFieldValidator>
                    <asp:RegularExpressionValidator ID="RegularVal_phone" runat="server" SetFocusOnError="true" ValidationExpression=".{7,}" ControlToValidate="phone" Display="None" ErrorMessage="请输入有效的手机号码！"></asp:RegularExpressionValidator>
                </td>
            </tr>
            <tr runat="server" id="tr_smscode" class="hide">
                <td class="col1">手机验证码<span class="required" runat="server" id="required_smscode">*</span></td>
                <td class="col2" id="smsbox">
                    <asp:TextBox runat="server" autocomplete="off" ID="smscode"></asp:TextBox><a href='#' id='aSms' onclick='return sendSmsCode();'>获取验证码</a>
                    <asp:RequiredFieldValidator ID="RequiredVal_smscode" runat="server" ControlToValidate="smscode" ErrorMessage="请输入手机短信验证码！" Display="None"></asp:RequiredFieldValidator>
                    <asp:RegularExpressionValidator ID="RegularVal_smscode" runat="server" SetFocusOnError="true" ValidationExpression="^\d{6}$" ControlToValidate="smscode" Display="None" ErrorMessage="请输入有效的短信验证码！"></asp:RegularExpressionValidator>
                </td>
            </tr>
            <tr runat="server" id="tr_Address">
                <td class="col1">地址<span class="required" runat="server" id="required_address">*</span></td>
                <td class="col2">
                    <asp:TextBox runat="server" autocomplete="off" AutoCompleteType="BusinessStreetAddress" ID="address" ToolTip="请输入详细的联系地址，以便必要时提供递送服务"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="RequiredVal_address" runat="server" ControlToValidate="address"
                        Display="None" ErrorMessage="请输入地址！"></asp:RequiredFieldValidator>
                    <asp:RegularExpressionValidator ID="RegularVal_address" runat="server" ControlToValidate="address"
                        Display="None" ErrorMessage="请输入有效的联系地址！" SetFocusOnError="true" ValidationExpression=".{2,}"></asp:RegularExpressionValidator>
                </td>
            </tr>
            <tr runat="server" id="tr_Zip">
                <td class="col1">邮编<span class="required" runat="server" id="required_zip">*</span></td>
                <td class="col2">
                    <asp:TextBox runat="server" autocomplete="off" AutoCompleteType="BusinessZipCode" ID="zip"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="RequiredVal_zip" runat="server" ControlToValidate="zip"
                        Display="None" ErrorMessage="请输入邮编！"></asp:RequiredFieldValidator>
                    <asp:RegularExpressionValidator ID="RegularVal_zip" runat="server" ControlToValidate="zip"
                        Display="None" ErrorMessage="请输入有效的邮政编码！" SetFocusOnError="true" ValidationExpression="\d{6}"></asp:RegularExpressionValidator>
                </td>
            </tr>
            <tr runat="server" id="tr_Question">
                <td class="col1">密码问题<span class="required" runat="server" id="required_question">*</span></td>
                <td class="col2">
                    <asp:TextBox runat="server" autocomplete="off" ID="question" ToolTip="找回密码的提示问题"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="RequiredVal_question" runat="server" ControlToValidate="question"
                        Display="None" ErrorMessage="请输入密码问题！"></asp:RequiredFieldValidator>
                </td>
            </tr>
            <tr runat="server" id="tr_Answer">
                <td class="col1">问题答案<span class="required" runat="server" id="required_answer">*</span></td>
                <td class="col2">
                    <asp:TextBox runat="server" autocomplete="off" ID="answer" ToolTip="找回密码的问题答案"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="RequiredVal_answer" runat="server" ControlToValidate="answer"
                        Display="None" ErrorMessage="请输入问题答案！"></asp:RequiredFieldValidator>
                </td>
            </tr>
            <tr runat="server" id="tr_Email">
                <td class="col1">电子邮箱<span class="required" runat="server" id="required_email">*</span></td>
                <td class="col2">
                    <asp:TextBox runat="server" autocomplete="off" AutoCompleteType="Email" ID="email" ToolTip="请输入邮箱地址，以便必要时联系或取回密码"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="RequiredVal_email" runat="server" ControlToValidate="email"
                        Display="None" ErrorMessage="请输入电子邮箱！"></asp:RequiredFieldValidator>
                    <asp:RegularExpressionValidator ID="RegularVal_email" runat="server" ControlToValidate="email"
                        Display="None" ErrorMessage="请输入有效的电子邮箱！" SetFocusOnError="true" ValidationExpression="^\w[\w\.-]*@\w[\w\.-]*\.[a-zA-Z]{2,4}"></asp:RegularExpressionValidator>
                </td>
            </tr>
            <tr runat="server" id="tr_Vcode">
                <td class="col1">验证码<span class="required" runat="server" id="required_Vcode">*</span></td>
                <td class="col2">
                    <asp:TextBox runat="server" autocomplete="off" ID="vcode" ToolTip="请输入右边图片中显示的字符"></asp:TextBox>
                    <img src="vcode.aspx" title="验证码。若看不清楚，可点击刷新" id="imgVcode" onclick="this.src='vcode.aspx?time='+new Date().getTime();" /></td>
            </tr>
            </tbody>
        </table>
        <asp:CheckBox runat="server" ID="AutoLogin" Checked="true" Text="注册后自动登录" CssClass="hide" />
        <div runat="server" id="agreement" visible="false" class="middle">
            <asp:CheckBox runat="server" ID="cbArgee" Text="同意" /><a href="agreement.htm" onclick="return toPopup(this.href);">用户协议</a>
        </div>
        <asp:UpdatePanel ID="footup" RenderMode="Block" runat="server">
            <ContentTemplate>
                <asp:Button runat="server" ID="btnSubmit" CssClass="btn" Text="立即注册" OnClick="submit" OnClientClick="return toReg();" />
                <input type="button" runat="server" id="btnChgpwd" value="修改密码" class="btn" onclick="return ShowPop('pwd_popup');" />
                <input type="button" runat="server" id="btnBack" onclick="back();" value="返回" class="btn" />
            </ContentTemplate>
        </asp:UpdatePanel>
        </div>
        <div id="rArea" runat="server">
            <div id="loginLink" runat="server">
                已有账号？<a href="login.aspx">立即登录 &gt;</a>
            </div>
        </div>
        <div id="bottomline"></div>
        </div>
        <ims:Pop runat="server" ID="pwd" Title="修改密码" Width="366" OnOkClick="ChangePwd" OnOkClientClick="return PreChangePwd();" HideOnOkClientClick="false">
        <ContentTemplate>
            <table class="mtop_m comm">
                <tr><td class="right" style="width:33%;min-width:6.1em">原密码：</td><td><asp:TextBox runat="server" autocomplete="off" TextMode="Password" ID="tbOldPwd"></asp:TextBox></td></tr>
                <tr><td class="right">新密码：</td><td><asp:TextBox runat="server" TextMode="Password" ID="tbNewPwd" autocomplete="off"></asp:TextBox></td></tr>
                <tr><td class="right">确认新密码：</td><td><asp:TextBox runat="server" TextMode="Password" ID="tbVerify" autocomplete="off"></asp:TextBox></td></tr>
            </table>
        </ContentTemplate>
        </ims:Pop>
        <script src="js/comm.js"></script>
        <script>
            $(function () {
                $("#phone[old]").on("change", function () {
                    var newValue = $(this).val();
                    $("#tr_smscode").toggleClass("hide", !newValue || newValue == $(this).attr("old"));
                });
                if (isPc) $("td input[title]").poshytip();
            });
            function toReg() {
                var ok = $("#cbArgee").length == 0 || $("#cbArgee").prop("checked");
                if (!ok) return showAndExit("必须勾选\"同意用户协议\"才能注册！");
                if (typeof (Page_ClientValidate) == 'function') Page_ClientValidate('');
                __doPostBack('btnSubmit', '');
                return false;
            }
            function PreChangePwd() {
                if ($("#pwd_tbOldPwd").val() == "") return showAndExit("请输入原密码！");
                if ($("#pwd_tbNewPwd").val().length < 3) return showAndExit("请输入有效的新密码！");
                if ($("#pwd_tbVerify").val() == "") return showAndExit("请输入确认新密码！");
                if ($("#pwd_tbVerify").val() != $("#pwd_tbNewPwd").val()) return showAndExit("两次输入的新密码不一致！");
                return true;
            }
            function sendSmsCode() {
                if (!$("#aSms").is(".dead")) {
                    var tel = $("#phone").val();
                    if (/^\d{11}$/.test(tel)) {
                        showLoading();
                        timer = 60;
                        $("#aSms").addClass("dead");
                        doTimer();
                        $.get("ajax.aspx", { action: "sendSmsVcode", tel: tel }, function (res) {
                            ShowMsgPop(res);
                            hideLoading();
                        });
                    } else {
                        alert("请输入有效的手机号！");
                    }
                }
                return false;
            }
            function doTimer() {
                if (timer > 1) {
                    timer -= 1;
                    $("#aSms").text(timer + " 秒后重发");
                    setTimeout(doTimer, 1000);
                } else {
                    $("#aSms").removeClass("dead").text("发送验证码");
                }
            }
        </script>
    </form>
</body>
</html>
