<?php /* Smarty version Smarty-3.1.8, created on 2016-01-05 11:46:10
         compiled from "D:\wwwroot\o2o\htdocs\themes\default\xiche\passport\login.html" */ ?>
<?php /*%%SmartyHeaderCode:28970565037b3024b56-08817598%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
$_valid = $_smarty_tpl->decodeProperties(array (
  'file_dependency' => 
  array (
    'a953d411a49e07e0ef2eec8431ba4208e8d5160c' => 
    array (
      0 => 'D:\\wwwroot\\o2o\\htdocs\\themes\\default\\xiche\\passport\\login.html',
      1 => 1451959734,
      2 => 'file',
    ),
  ),
  'nocache_hash' => '28970565037b3024b56-08817598',
  'function' => 
  array (
  ),
  'version' => 'Smarty-3.1.8',
  'unifunc' => 'content_565037b31035e1_47834894',
  'variables' => 
  array (
    'reg_yzm' => 0,
    'pager' => 0,
    'backurl' => 0,
  ),
  'has_nocache_code' => false,
),false); /*/%%SmartyHeaderCode%%*/?>
<?php if ($_valid && !is_callable('content_565037b31035e1_47834894')) {function content_565037b31035e1_47834894($_smarty_tpl) {?><?php if (!is_callable('smarty_function_link')) include 'D:\\wwwroot\\o2o\\htdocs\\system\\plugins/smarty\\function.link.php';
?><?php $_smarty_tpl->tpl_vars['tpl_title'] = new Smarty_variable('登录', null, 0);?>
<!DOCTYPE HTML>
<html>
<head>
<?php echo $_smarty_tpl->getSubTemplate ("xiche/block/sheader.html", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, null, null, array(), 0);?>

</head>
<body>

<header>
	<i class="left"><a id="icon_goback" href="<?php echo smarty_function_link(array('ctl'=>'xiche/index'),$_smarty_tpl);?>
"></a></i>
    <div class="title">登录</div>
    <i class="right" id="l1" style="display:none;">密码登录</i>
    <i class="right" id="l2">验证码登录</i>
</header>
<section id="lg1" class="page_center_box" style="display:none;">
    <ul class="form_list_box mt10">
        <li class="pd">
            <table width="100%">
            	<tr>
                	<th><em class="ico_1"></em></th>
                    <td>
                        <input type="tel" id="mobile" placeholder="请输入手机号">
                        <div class="get_yzm on" login="sendsms">获取验证码</div>
                    </td>
                </tr>
            </table>
        </li>
        <li class="last pd">
        	<table>
            	<tr>
                	<th><em class="ico_2"></em></th>
                    <td>
                        <input type="number" id="yzm" maxlength="6" placeholder="请输入手机验证码">
                    </td>
                </tr>
            </table>
        </li>
        
        <?php if ($_smarty_tpl->tpl_vars['reg_yzm']->value=='on'){?>
            <li class="last pd">
                    <table>
                    <tr>
                            <th><em class="ico_2"></em></th>
                        <td>
                            <input type="number" id="verifycode" maxlength="6" placeholder="请输入验证码" style='width:50%'>
                            <span style='width:50%;text-align:right;'>
                                <img verify="#pass-verify" src="<?php echo smarty_function_link(array('ctl'=>'magic:verify','http'=>'ajax'),$_smarty_tpl);?>
&_=<?php echo $_smarty_tpl->tpl_vars['pager']->value['dateline'];?>
" id="pass-verify" />
                            </span>
                        </td>
                    </tr>
                </table>
            </li>
        <?php }?>
        
        
    </ul>


    <div class="long_btn_box">
        <input class="long_btn" type="submit" btn="passport:handle" value="立即登录" id="login1">
    </div>
</section>
    

    <section id="lg2" class="page_center_box">
    <ul class="form_list_box mt10">
        <li class="pd">
            <table width="100%">
            	<tr>
                	<th><em class="ico_1"></em></th>
                    <td>
                        <input type="tel" id="mobile2" placeholder="请输入手机号">
                    </td>
                </tr>
            </table>
        </li>
        <li class="last pd">
        	<table>
            	<tr>
                	<th><em class="ico_2"></em></th>
                    <td>
                        <input type="password" id="password" maxlength="32" placeholder="请输入密码">
                    </td>
                </tr>
            </table>
        </li>
    </ul>
    <div class="long_btn_box">
        <input class="long_btn" type="submit" btn="passport:handle2" value="立即登录"  id="login2">
    </div>
</section>
    
    
<script type="text/javascript">
require(["zepto", "underscore", "frozen"], function($, _, fz) {
    
    
    
            /*判断浏览器是否支持placeholder开始*/
$(function(){
if(!placeholderSupport()){   // 判断浏览器是否支持 placeholder
    $('[placeholder]').focus(function() {
        var input = $(this);
        if (input.val() == input.attr('placeholder')) {
            input.val('');
            input.removeClass('placeholder');
        }
    }).blur(function() {
        var input = $(this);
        if (input.val() == '' || input.val() == input.attr('placeholder')) {
            input.addClass('placeholder');
            input.val(input.attr('placeholder'));
        }
    }).blur();
};
})
function placeholderSupport() {
    return 'placeholder' in document.createElement('input');
}
/*判断浏览器是否支持placeholder结束*/
    
    
    
    
    $('#pass-verify').click(function(){
        var time = new Date();
        $('#pass-verify').attr('src','<?php echo smarty_function_link(array('ctl'=>"magic:verify",'http'=>"ajax"),$_smarty_tpl);?>
'+'?'+time);
    })

    
        var minute = 60;
	var mobile_timeout;
        var mobile_count = minute;
        var mobile_lock = 0;
            $("[login]").click(function () {
                if (mobile_lock == 0) {
                    var mobile = $('#mobile').val(); 
                    var link = "<?php echo smarty_function_link(array('ctl'=>'xiche/passport/sendsms'),$_smarty_tpl);?>
";
                     $.post(link,{mobile:mobile},function(ret){
                        if(ret.error){
                               $.tips({content: ret.message.join("")});
                                mobile_lock = 0;
                           }else{
                                BtnCount();
                                mobile_lock = 1;
                            $(".get_yzm").removeClass("on");
                            $('.get_yzm').attr("disabled", "disabled");  
                           }
                       },'json');
                    
                    
                    mobile_count = minute;                    
                }
        });        
        
        var right = 0;
        
        $('.right').click(function(){
            right = right + 1;
            if(right%2 == 0){
                $('#l1').show();$('#l2').hide();
                $('#lg1').show();$('#lg2').hide();
            }else{
                $('#l2').show();$('#l1').hide();
                $('#lg2').show();$('#lg1').hide();
            }
        })
        
        $('#login1').click(function(){
            var mobile = $('#mobile').val(); 
            var yzm = $('#yzm').val();
            var yzm_val = $('#verifycode').val();
            var link = "<?php echo smarty_function_link(array('ctl'=>'xiche/passport/handle','arg0'=>'#mobile#','arg1'=>'#yzm#','arg2'=>'#yzm_val#','http'=>'base'),$_smarty_tpl);?>
";
            $.getJSON(link.replace("#mobile#",mobile).replace("#yzm#",yzm).replace("#yzm_val#",yzm_val), function(ret){
                if(ret.error){
                    $.tips({content: ret.message.join("")});
                    return ;
                }else{
                    $.tips({content: ret.message.join("")});
                    setTimeout(function(){
                       window.location.href='<?php echo $_smarty_tpl->tpl_vars['backurl']->value;?>
';
                    },1000)
                    BtnCount();
                }
            });
        })
        
         $('#login2').click(function(){
            var mobile = $('#mobile2').val(); 
            var password = $('#password').val();
            var link = "<?php echo smarty_function_link(array('ctl'=>'xiche/passport/handle2','arg0'=>'#mobile#','arg1'=>'#password#','http'=>'base'),$_smarty_tpl);?>
";
            $.getJSON(link.replace("#mobile#",mobile).replace("#password#",password), function(ret){
                if(ret.error){
                    $.tips({content: ret.message.join("")});
                    return ;
                }else{
                    $.tips({content: ret.message.join("")});
                    setTimeout(function(){
                       window.location.href='<?php echo $_smarty_tpl->tpl_vars['backurl']->value;?>
';
                    },1000)
                    BtnCount();
                }
            });
        })

        BtnCount = function () {       
            if (mobile_count == 0) {
		      $(".get_yzm").removeClass("on");
                $('.get_yzm').removeAttr("disabled");
                $('.get_yzm').text("重新获取");
                mobile_lock = 0;
                clearTimeout(mobile_timeout);
		      $('.get_yzm').addClass("on");
            }else {
                mobile_count--;
                $('.get_yzm').text( + mobile_count.toString() + "秒...");
                mobile_timeout = setTimeout(BtnCount, 1000);
            }
        };
		//注册页获取验证码部分结束
});
</script>
<?php echo $_smarty_tpl->getSubTemplate ("xiche/block/sfooter.html", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, null, null, array(), 0);?>

</body>
</html><?php }} ?>