<!DOCTYPE HTML>
<html>
  <head>
    <meta charset="UTF-8">
    <title></title>
    <meta name="keywords" content="" />
    <meta name="description" content="" />
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta charset="utf-8">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <meta name="applicable-device" content="mobile">
    <link href="__CSS__/iconfont.css" rel="stylesheet" >
    <link href="__CSS__/common.css" rel="stylesheet" >
    <link href="__CSS__/unlr.css" rel="stylesheet" >
    <script src="__JS__/jquery-1.11.1.min.js"></script>
    
  </head>
  <body class="unlr">
    <header class="header forget-header">
      <div class="">
        <a href="{:U('login')}" class="hbtn back"><i class="iconfont icon-drop-left"></i></a>
        <h1 class="caption">找回密码</h1>
      </div>
    </header>
    <div class="occupy"></div>
    <section class="trunker">
      <section class="container">
        <div class="t-form forget-form">
          <form action="{:U('forget')}" method="post" class="forget-box">
            <div class="form-group clearfix">
              <div class="input-group clearfix">
                <input type="text" name="mobile" id="mobile" class="txt" placeholder="请输入手机号码">
                <a href="javascript:;" class="getcode jsgetcode">获取验证码</a>
              </div>
              <div class="input-group clearfix">
                <input type="text" id="code" name="code" class="txt" placeholder="请输入验证码">
              </div>
            </div>
            <div class="btn-group">
              <input type="button" class="submit" value="下一步">
            </div>
            <div>
              <p class="forget-notice">
                通过手机号找回密码只适用于手机号注册的账号<br>用户名注册的账号可
                <a href="http://wpa.qq.com/msgrd?v=3&amp;uin={:C('APP_QQ')}&amp;site=qq&amp;menu=yes" target="_blank">联系客服</a>
              </p>
            </div>
          </form>
        </div>
      </section>
    </section>
    <div class="popmsg pop-dialog"></div>
    <script src="__JS__/pop.lwx.min.js"></script>
    <script src="__JS__/common.js"></script>
    <script>
      $(function() {
        var pmsg = $('.popmsg').pop();

        $('.jsgetcode').click(function() {
          var tis = this,that = $(tis);
          if (that.hasClass('disabled')) {return false;}  
          var mobile = $.trim($('#mobile').val());
          if (mobile) {
            var is_true = true;
            if (/^1[0-9]{10}$/.test(mobile)) {
              $.ajax({
                url:"{:U('forget_send_msg')}",
                type:"POST",
                dataType:"json",
                async: false,
                data:{account:mobile},
                success:function(result){
                  if(result.status == 0){
                      is_true = false;
                  }
                  pmsg.msg(result.msg);
                },
                error:function(){
                  alert('服务器异常');
                }
              })
              if(is_true){
                  clock(tis);
              }
            } else {
              pmsg.msg('请输入正确的手机号码');
            }
          } else {
            pmsg.msg('请输入手机号码');
          }
          return false;
        });

        $(".submit").click(function(){
          var mobile = $.trim($("#mobile").val());
          var code = $.trim($("#code").val());
          if(mobile.length == 0){
            pmsg.msg('请输入手机号码');
            return false;
          }
          if(code.length == 0){
            pmsg.msg('请输入验证码');
            return false;
          }
          $.ajax({
            url:"{:U('forget')}",
            type:"POST",
            dataType:"json",
            data:{phone:$.trim($('#mobile').val()),code:$("#code").val()},
            success:function(result){
              pmsg.msg(result.info);
              if(result.status == 1){
                setTimeout(function () {
                  window.location.href = result.url;
                }, 2000);  
              }
            },
            error:function(){
              alert("服务器异常");
            }
          })
        })
      });
    </script>
  </body>
</html>