<%@ page import="java.net.URLDecoder" %>
<%@ page import="com.manage.encrypt.Base64" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ include file="/WEB-INF/jspf/common.jspf" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
    String password="";
    String userName="";
    String checked="";
    Cookie[] cookies = request.getCookies();        //取出cookie对象组
    for(int i = 0; cookies != null && i < cookies.length;i++){
        Cookie cookie = cookies[i];       //  取出其中的一个对象，含有name ,value
        if(cookie != null && "name".equals(cookie.getName())){      //获取第一个cookie对象的name
            userName = URLDecoder.decode(cookie.getValue(), "UTF-8");//进行解码
            checked = "checked";
        }
        if(cookie != null && "password".equals(cookie.getName())){
            password = cookie.getValue();
            password = Base64.decodeBase64(password);
        }
    }
%>
<html>
<head>
    <title>嘉时软件</title>
    <!--导入CSS -->
    <link rel="stylesheet" href="${path}/static/css/login.css">
    <script>
        var path = "${path}";
    </script>
</head>
<body style="background:url('${path}/static/img/login/bg.png')">
    <!--头部-->
    <div class="login_head">
        <!--头部文字-->
        <div class="head_left left">
            <div class="head_left_span">
                <span>${loginSet.context}</span></div>
            </div>
        <!--右边logon-->
        <div class="head_right left">
            <c:if test="${loginSet.logoPath != ''}">
                <img src="${path}/${loginSet.logoPath}" width="${loginSet.logoWidth}px" height="${loginSet.logoHeight}px">
            </c:if>
        </div>
    </div>
    <!--中间-->
    <div class="login_content">
        <div class="content_left left">
            <c:if test="${loginSet.pic1Path != ''}">
                <div class="image1" style="background:url('${path}/${loginSet.pic1Path}') no-repeat">
                </div>
            </c:if>
        </div>
        <div class="content_login left">
            <form method="post" action="${path}/login">
                <div class="login_div" style="background:url('${path}/static/img/login/登录框.png') no-repeat">
                    <div class="login_title">
                        <h3 style="text-align: center">账号登录</h3>
                    </div>
                    <div class="inputDiv">
                        <input type="text" id="userName" name="userName" class="form-control uname left" placeholder="用户名" required  value="<%=userName%>"/>
                    </div>
                    <div class="inputDiv">
                        <input type="password" id="userPwd"  name="userPwd" class="form-control pword m-b" placeholder="密码"  required value="<%=password%>" autocomplete="new-password"/>
                    </div>
                    <div class="inputDiv">
                        <label><input type="checkbox" name="rememberMe" id="rememberMe"  value="yes" style="vertical-align:middle; margin-top:0;" <%=checked%>>记住密码</label>
                    </div>
                    <%--<a href="#" id="forgetPwd" style="float: right;">忘记密码了？</a>--%>
                    <div class="inputDiv">
                        <button class="btn btn-success btn-block">登录</button>
                        <p class="text-danger">${msg}</p>
                    </div>
                </div>
            </form>
        </div>
    </div>
    <!--尾部-->
    <div class="login_foot">
        <div class="span_div"><span>${loginSet.footContext}</span></div>
    </div>
<script type="text/javascript" src="${path}/static/js/login.js"></script>
</body>
</html>
