<?php if (!defined('THINK_PATH')) exit(); /*a:2:{s:44:"./application/admin/template/admin\login.htm";i:1580691229;s:65:"D:\ejucms\ejucms0.hk\application\admin\template\public\footer.htm";i:1580691229;}*/ ?>
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>后台登录</title>
  <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, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  <meta name="robots" content="noarchive">
  <link rel="shortcut icon" type="image/x-icon" href="/favicon.ico?v=<?php echo $version; ?>" media="screen"/>
  <link rel="stylesheet" href="/public/plugins/layui/css/layui.css?v=<?php echo $version; ?>" media="all">
  <link rel="stylesheet" href="/public/static/admin/css/admin.css?v=<?php echo $version; ?>" media="all">
  <link rel="stylesheet" href="/public/static/admin/css/login.css?v=<?php echo $version; ?>" media="all">
</head>
<body>
  <div class="layadmin-user-login layadmin-user-display-show" id="LAY-user-login" style="display: none;">
    <div class="layadmin-user-login-main">
      <div class="layadmin-user-login-box layadmin-user-login-header">
       <div style="margin-bottom: 10px;"><img height="34" src="/public/static/admin/images/logo_login.png" alt=""></div>
        <p><?php echo $web_name; ?>后台管理</p>
      </div>
      <div class="layadmin-user-login-box layadmin-user-login-body layui-form">
        <div class="layui-form-item">
          <label class="layadmin-user-login-icon layui-icon layui-icon-username" for="LAY-user-login-username"></label>
          <input type="text" name="user_name" id="LAY-user-login-user_name" lay-verify="required" placeholder="用户名" class="layui-input">
        </div>
        <div class="layui-form-item">
          <label class="layadmin-user-login-icon layui-icon layui-icon-password" for="LAY-user-login-password"></label>
          <input type="password" name="password" id="LAY-user-login-password" lay-verify="required" placeholder="密码" class="layui-input">
        </div>
        <div class="layui-form-item">
          <div class="layui-row">
            <div class="layui-col-xs7">
              <label class="layadmin-user-login-icon layui-icon layui-icon-vercode" for="LAY-user-login-vercode"></label>
              <input type="text" name="vertify" id="LAY-user-login-vertify" lay-verify="required" placeholder="图形验证码" class="layui-input">
            </div>
            <div class="layui-col-xs5">
              <div style="margin-left: 10px;">
                <img src="<?php echo url('Admin/vertify', ['r'=>$version]); ?>" class="layadmin-user-login-codeimg" id="LAY-user-get-vercode">
              </div>
            </div>
          </div>
        </div>
<!--
        <div class="layui-form-item" style="margin-bottom: 20px;">
          <a href="javascript:void(0);" id="LAY-user-login-forget_pwd" class="layadmin-user-jump-change layadmin-link" style="margin-top: 7px;">忘记密码？</a>
        </div>
-->
        <div class="layui-form-item">
          <button class="layui-btn layui-btn-fluid" lay-submit lay-filter="LAY-user-login-submit" data-href="<?php echo url('Admin/login', ['_ajax'=>1]); ?>">登 录</button>
        </div>
      </div>
    </div>
  </div>

  <script src="/public/plugins/layui/layui.js"></script>  
  <script>
    layui.config({
      base: '/public/static/admin/' //静态资源所在路径
      ,version: '<?php echo $version; ?>'
    }).extend({
      index: 'lib/index' //主入口模块
    }).use(['index', 'user'], function(){
      var $ = layui.$
      ,layer = layui.layer
      ,admin = layui.admin
      ,form = layui.form;

      form.render();

      $('#LAY-user-login-user_name').focus();

      $("#LAY-user-login-forget_pwd").click(function(){
          layer.msg('请联系网站管理员！');
      });

      $(document).on('click','#LAY-user-get-vercode', function(){
          var src = "<?php echo url('Admin/vertify'); ?>";
          if (src.indexOf('?') > -1) {
              src += '&';
          } else {
              src += '?';
          }
          src += 'r='+Math.floor(Math.random()*100);
          $(this).attr('src', src);//重载验证码
      });

      $(document).keydown(function(event){
          if(event.keyCode ==13){
            $('div button[lay-filter=LAY-user-login-submit]').trigger('click');
          }
      });

      //提交
      form.on('submit(LAY-user-login-submit)', function(obj){
        obj.field._ajax = 1;
    
        //请求登入接口
        admin.req({
          url: obj.elem.attributes['data-href'].value
          ,data: obj.field
          ,done: function(res){
            if (1 == res.code) {
              //登入成功的提示与跳转
              layer.msg(res.msg, {
                offset: '15px'
                ,icon: 1
                ,time: 1000
              }, function(){
                top.location.href = res.url; //后台主页
              });
            } else {
              $('#LAY-user-get-vercode').trigger('click');
              layer.msg(res.msg, {icon: 5, title:false});
              return false;
            }
          }
        });

      });
    });

  </script>
  
  
</body>
</html>