<!--{include file="<!--{$mpath}-->block_header.tpl"}-->
<!--loading页开始-->
<style>
    .login_weixin {
        width: 100%;
        position: fixed;
        bottom: 0;
        padding-bottom: 40px;
        text-align: center;
        background: #fff;
    }
    .login_weixin ul li {
        display: block;
        text-align: center;
        font-size: 0.6rem;
        color: #ccc;
    }
    .login_weixin img {
        width: 50px;
        height: 50px;
    }
    * {
</style>
<div class="loading">
    <div class="loader">
        <div class="loader-inner pacman">
            <div></div>
            <div></div>
            <div></div>
            <div></div>
            <div></div>
        </div>
    </div>
</div>
<!--loading页结束-->
<body>
<header class="mui-bar mui-bar-nav report-header box-s" id="header">
    <a href="javascript:history.go(-1)" id="fan"><i class="iconfont icon-fanhui fl"></i></a>
    <p>登陆</p>
    <a href="index.php?c=user&a=register" id="fan" style="width: 60px;"><p>注册</p></a>
</header>
<div style="padding-top: 55px; background: rgb(240,242,245);">
    <input type="hidden" id="res" value="<!--{$type}-->"/>
    <div class="sign clearfloat">
        <div class="list clearfloat">
            <ul>
                <li>
                    <i class="iconfont icon-gerenzhongxin fl"></i>
                    <input type="text" name="username" id="username" value="" class="text fl" placeholder="请输入手机号码" />
                </li>
               <!-- <li>
                    <i class="iconfont icon-yanzhengma fl"></i>
                    <input type="text" name="" id="" value="" class="text yzma fl" placeholder="请输入验证码" />
                    <input type="button" name="" id="" value="获取验证码" class="btn fr" />
                </li>-->
                <li>
                    <i class="iconfont icon-mima fl"></i>
                    <input type="password" name="password" id="password" value="" class="text fl" placeholder="请输入6-16位密码" />
                </li>
            </ul>
            <a href="javascript:void(0);" class="tui-btn" id="login-button">
                登陆
            </a>
        </div>
    </div>
    <div class="login_weixin ">
        <ul>
            <li>
                <a href="index.php?c=user&a=wx_login"><img src="<!--{$mpath}-->img/icon_wechat.png"></a>
                <p>其他方式登录</p>
            </li>
        </ul>
    </div>
</div>
</body>
<script type="text/javascript" src="<!--{$mpath}-->js/jquery-1.8.3.min.js" ></script>
<script src="<!--{$mpath}-->layer_mobile/layer.js"></script>
<script src="<!--{$mpath}-->js/fastclick.js"></script>
<script src="<!--{$mpath}-->js/mui.min.js"></script>
<script type="text/javascript" src="<!--{$mpath}-->js/hmt.js" ></script>
<script>
    $("#login-button").click(function(event) {

        var username=document.getElementById("username").value;//获取form中的用户名
        var password=document.getElementById("password").value;
        var regex=/^[/s]+$/;//声明一个判断用户名前后是否有空格的正则表达式
        if(regex.test(username)||username.length==0)//判定用户名的是否前后有空格或者用户名是否为空
        {
            layer.open({
                content: '用户名格式不对'
                ,skin: 'msg'
                ,time: 2 //2秒后自动关闭
            });
            return false;
        }
        if(regex.test(password)||password.length==0)//同上述内容
        {
            layer.open({
                content: '密码格式不对'
                ,skin: 'msg'
                ,time: 2 //2秒后自动关闭
            });
            return false;
        }

        $.post("<!--{$urlpath}-->index.php?c=user&a=ajaxlogin", {
            username: username,
            password: password,
        }, function (data) {
            var res= $('#res').val();
            if (data.response == '1') {
                layer.open({
                    content: data.result
                    ,skin: 'msg'
                    ,time: 2 //2秒后自动关闭

                });
                setTimeout( function(){
                    if(res == 1){
                        window.location.href = 'index.php';
                    }else {
                        javascript:history.go(-1);  // 这个方法是刷新当前页面
                    }

                }, 2 * 1000 );//延迟5000毫米
            } else {
                layer.open({
                    content: data.result
                    ,skin: 'msg'
                    ,time: 2 //2秒后自动关闭
                });
            }
        }, "json");
    });
</script>
</html>
