<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp" %>
<!DOCTYPE html>
<html>
<head lang="en">
    <title>能辉光伏</title>
    <%-- <link rel="stylesheet" href="${ctxPlugin}/lib/layuiAdmin/dist/layuiadmin/layui/css/layui.css" media="all">--%>
    <link rel="stylesheet" href="${ctxPlugin}/lib/layuiAdmin/dist/layuiadmin/style/admin.css" media="all">
    <LINK rel="Shortcut Icon" href="${ctxPlugin}/favicon.ico"/>
    <link rel="stylesheet" href="${ctxPlugin}/static/css/reset.css">
    <link rel="stylesheet" href="${ctxPlugin}/static/css/style.css">
    <%--    <meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests" />--%>
    <style>
        .foot-copy{background: #fff; text-align: center; line-height: 34px; position: absolute; left: 0; bottom: 0; right: 0;font-size: 13px; color: #666;}
        .foot-copy a{font-size: 13px; color: #666; text-decoration: none;}

        .code-box{text-align: center; cursor: pointer; font-size: 12px; height: 30px; line-height: 30px; margin-top: 10px; position: relative}
        .code-img{width: 324px; text-align: center;  height: 140px; padding: 10px; position: absolute; top: -155px; left: 0; display: none}
        .code-img>img{width: 140px}
        .code-box:hover .code-img{display: block}
    </style>
</head>
<body >

<div class="back-logo pos-r">
    <div style="padding-top: 30px; padding-right: 30px; text-align: right">
        <img src="${ctxPlugin}/static/img/login_logo.png" alt="">
    </div>
    <form  action="${ctx}/login" method="post" class="logo-box">
        <div class="box-title">
            <h1>欢迎登录能辉户用云</h1>
        </div>
        <div class="login-title-line">
            <div></div>
            <div></div>
        </div>
        <div>
            <div class="login-inp-title">账号</div>
            <div class="box-user">
<%--                <b class="user"></b>--%>
                <input type="text" id="username" name="username"   required  lay-verify="required" placeholder="请输入登录账号"  autocomplete="off" >
            </div>
            <div class="login-inp-title">密码</div>
            <div class="box-user">
<%--                <b class="password"></b>--%>
                <input type="password" id="password" name="password" required lay-verify="required" placeholder="请输入密码" autocomplete="off" >
            </div>
        </div>
        <div class="box-select">
            <label for="jiZhu" class="jiZhu">
                <input type="checkbox" id="jiZhu">记住密码
            </label>
            <a href="${ctx}/main/redirect/forgetPasswork" style="color: #0a6597; text-decoration: none">忘记密码?</a>
        </div>
        <button class="submit w-310 h-50" lay-submit lay-filter="formDemo">登录</button>
        <div class="code-box">
            微信扫码登陆小程序
            <div class="code-img"><img src="${ctxPlugin}/static/imgs/codeimg.png"/></div>
        </div>
    </form>
    <!-- 底部备案 -->
    <div class="foot-copy">
        域名备案号：<a href="https://beian.miit.gov.cn/" target="_blank">沪ICP备16000753号-2</a>
    </div>
</div>
<script src="${ctxPlugin}/lib/layuiAdmin/dist/layuiadmin/layui/layui.js"></script>
<script>

    layui.config({
        base: '${ctxPlugin}/lib/layuiAdmin/dist/layuiadmin/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index', 'form','jquery','cookie'],function () {
        var  $=layui.jquery
            , cookie=layui.cookie;
        $(".login").click(function(){
            var userName=$("#username").val();
            var passWord=$("#password").val();
            var obj=$('input[type="checkbox"]');
            if(obj.is(':checked')){
                $.cookie("username",userName,{
                    expires:2555,
                    path:'${ctx}/login'
                });
                $.cookie("password",passWord,{
                    expires:2555,
                    path:'${ctx}/login'
                });
            }else{
                $.cookie("username",null,{
                    expires:-1,
                    path:'${ctx}/login'
                });
                $.cookie("password",null,{
                    expires:-1,
                    path:'${ctx}/login'
                });
            }
            return;
        })

        $('.box-select').click(function () {
            $(this).children("i").toggleClass('select')
        })

        //记住密码
        $('input[type="checkbox"]').click(function () {
            if($(this).is(':checked')){
                $(this).parent().addClass('checked');
            }
            else {
                $(this).parent().removeClass('checked');
            }
        })

        $('.left-login').hover(function () {

            $('.bg-login').css({'backgroundSize':'110% 110%;','backgroundPosition':'left center','transform':'scale(1.1)'})
        },function () {
            $('.bg-login').css({'backgroundSize':'100% 100%;','backgroundPosition':'center center','transform':'scale(1)'})
        })
        $('.right-login').hover(function () {

            $('.bg-login').css({'backgroundSize':'110% 110%;','backgroundPosition':'right center'})
        },function () {
            $('.bg-login').css({'backgroundSize':'100% 100%;','backgroundPosition':'center center'})
        })

        /*      if("${isEmp}"){
            layer.msg("工程师人员账号暂无登录权限！",{icon:2})
       }*/
        if("${errormessage}"=='error'){
            layer.msg("账号或者密码错误,请重新输入！",{icon:2})
        }else if("${msg}"== 'notfind'){
            layer.msg("账号不存在,请重新输入！",{icon:2})
        }


        $().ready(function() {
            //获取cookie的值
            var username = $.cookie('username');
            var password = $.cookie('password');
            if(username != null && username != '' && password != null && password != ''){//选中保存秘密的复选框
                $('input[type="checkbox"]').attr('checked',true);
                $('input[type="checkbox"]').parent().addClass('checked');
                $("#username").val(username);
                $("#password").val(password);
            }
        })

    })

    if (window.parent !== window) {
        window.top.location="/nhet/a/login"
    }
</script>
</body>
</html>
