<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="bindmobile.aspx.cs" Inherits="TW.UI.memb.bindmobile" %>

<!DOCTYPE html>
<html>
<head lang="en">
	
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv=X-UA-Compatible content=IE=EmulateIE9 />
<script type="text/javascript" src="/static/card/js/configweb.js"></script>
	<title>绑定手机号码_<%=config.SiteName %></title>
	<link rel="stylesheet" href="/static/card/css/public.css" />
    <link rel="stylesheet" href="/static/card/css/userCenter.css" />
    <script type="text/javascript" src="/static/card/js/jquery-1.11.3.js"></script>
    <script type="text/javascript" src="/static/card/js/tools.js"></script>
    <script type="text/javascript">
        var waitp = 30;
        function getPhoneCode() {
            var phone = $("#txtMobile").val();
            if (phone == '' || phone == null) {
                alert("请输入手机号码");
                return false;
            }
            var remobile = /^1[0-9]{10}$/;
            if (!remobile.test(phone)) {
                alert("手机号码格式不正确");
                return false;
            }
            $("#txtMobile").attr("disabled", "disabled");
            var v = $("#getPhoneCodeBtn");
            if (waitp == 30) {
                time(v);
                $.ajax({
                    type: "post",
                    url: "/ajax/ajax.aspx",
                    data: {
                        phoneNo: phone,
                        act: 'bindPhone'
                    },
                    dataType: "json",
                    timeout: 60 * 1000,
                    success: function (a) {
                        if (a.flag) {
                            $("#md16").val(a.md16);
                        } else {
                            alert(a.msg);
                        }
                    }
                });
            } else {
                alert("验证码已经发送请稍等...");
            }
        }

        function time(v) {
            if (waitp == 0) {
                v.html("发送验证码");
                waitp = 30;
            } else {
                v.html(waitp + "秒后重新发送");
                waitp--;
                setTimeout(function () {
                    time(v)
                }, 1000)
            }
        }

    </script>

</head>
<body>
<form id="form1" runat=server>
<TW:Header ID="Header1" runat="server" />
<div class="content">
    <div class="container">
    
<TW:UserHeader ID="UserHeader1" runat="server" />
        <div class="user-content clearfix">
            <TW:UserLeft ID="UserLeft1" runat="server" MenuId=1 SelLi=3 />

            <div class="user-right pull-left">
            <ul class="user-info-form">
                    <asp:PlaceHolder ID="phIsBinded" runat="server" Visible="False">
                    <li id="showMsgId" style="display: block;">
                        <label></label>
                        <div class="inp">您已绑定手机号码。</div>
                        <div class="tip"></div>
                    </li>
                    </asp:PlaceHolder>
                    <li>
                        <label>手机号码：</label>
                        <div class="inp">
                            <TW:ReplaceBox ID="txtMobile" runat="server" CssClass="input-text"></TW:ReplaceBox>
                        </div>
                        <asp:Panel ID="plSendMobVerfCode" runat="server" CssClass="tip">
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" 
                        Display="Dynamic" ErrorMessage="*" SetFocusOnError="True" 
                        ControlToValidate="txtMobile"></asp:RequiredFieldValidator>
                        <button type="button" id="getPhoneCodeBtn" class="vice-btn" onclick="getPhoneCode();">发送验证码</button>
                        </asp:Panel>
                    </li>
                    <asp:PlaceHolder ID="phMobileBindBox" runat="server">
                    <li>
                        <label>填写验证码：</label>
                        <div class="inp">
                            <TW:ReplaceBox ID="txtvCode" runat="server" CssClass="input-text"></TW:ReplaceBox>
                            <input type="hidden" name="md16" id="md16"/>
                        </div>
                        <div class="tip-icon pull-left" id="vCode_tip_icon">
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator6" runat="server" 
                            Display="Dynamic" ErrorMessage="*" SetFocusOnError="True" 
                            ControlToValidate="txtvCode"></asp:RequiredFieldValidator>
                        </div>
                    </li>
                    <li>
                        <label></label>
                        <div class="inp">
                            <asp:Button ID="btnSave" runat="server" Text="确 定" CssClass="default-btn user-info-btn" onclick="btnSave_Click" />
                        </div>
                    </li>
                    </asp:PlaceHolder>
                </ul>
            </div>
        </div>
    </div>
</div>
<TW:Footer ID="Footer1" runat="server" />
</form>
</body>
</html>