<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<%@ include file="/common/taglibs.jsp" %>
<%@ include file="/common/meta.jsp" %>
<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@ page import="java.io.*,java.util.*" %>
<%@ page import="com.palmnest.application.core.util.PropertiesKit" %>

<%
    /*
    跑旧项目需要注释,
    跑生产需要解注
    */
    String f = request.getParameter("f");
    String error = request.getParameter("error");
    if (!"_inner".equals(f) && !"true".equals(error)) {//重定向
        String webUrl = PropertiesKit.readPropertiesValue("adminWebUrl", "wechat.properties");
        response.sendRedirect(webUrl);
        return;
    }
%>

<head>
    <title><fmt:message key="login.title"/></title>
    <meta http-equiv="Content-Type" content="charset=UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <title><fmt:message key="login.title"/></title>
    <link rel="stylesheet" type="text/css" media="all" href="<c:url value='/styles/login.css?v=1.0'/>"/>
    <script type="text/javascript" src="<c:url value='/scripts/lib/jquery-1.8.2.min.js'/>"></script>
    <style>
        .isnot-ie, is-ie {
            display: none;
        }

        .download-btn {
            padding: 0;
            border: none;
            width: 250px;
            height: 40px;
            line-height: 40px;
            background: #FFA400;
            font-size: 18px;
            color: #fff;
            text-align: center;
            -webkit-border-radius: 3px;
            -moz-border-radius: 3px;
            border-radius: 3px;
            cursor: pointer;
            outline: none;
        }

        .download-btn a {
            color: #fff;
            font: 18px Microsoft YaHei, 微软雅黑, tahoma, arial, \5b8b\4f53;

        }
    </style>
    <script>
        $(function () {

            function isIE() {
                if (!!window.ActiveXObject || "ActiveXObject" in window) {
                    return true;
                } else {
                    return false;
                }
            };
            if (isIE()) {
                $(".is-ie").show();
                $(".isnot-ie").hide();
            } else {
                $(".is-ie").hide();
                $(".isnot-ie").show();
            }
        });

        function handle() {
            window.open('https://www.google.cn/chrome/')
            //window.location.href='https://www.google.cn/chrome/';
        }

        function stringBase64(str) {
            return window.btoa(unescape(encodeURIComponent(str)));
        }

        function login() {

            var j_username = $("#j_username").val();
            var j_password = $("#j_password").val();
            var errormsg = $("#errormsg").val();
            // var str_password = stringBase64(j_password);
            if ($.trim(j_username) == "") {
                $("#lblMessage").html(errormsg);
                $("#j_username").focus();
                return;
            }
            if ($.trim(j_password) == "") {
                $("#lblMessage").html(errormsg);
                $("#j_password").focus();
                return;
            }
            // console.log('j_password == ', str_password);
            // $("#j_password").val(str_password);
            $('#loading-mask').show();
            $("#form").submit();
        }


        $(".user-wrapper").keypress(function (event) {
            var keycode = (event.keyCode ? event.keyCode : event.which);
            if (keycode == '13') {
                login();
            }
        });
        //});


    </script>
</head>
<body>
<div id="loading-mask">
    <div id="pageloading" class="loading">
        <img src="${ctx}/images/progressBar_m.gif" align="absmiddle"><fmt:message key="login.loading"/>
    </div>
</div>
<div class="login-wrapper">
    <div class="login-content clearfloat">
        <div class="login-con-left">
            <img class="img" src="${ctx}/images/icons/new_left_icon.png"/>
        </div>

        <div class="login-con-right">
            <form method="post" action="<c:url value='/j_security_check'/>" id="form">
                <div class="con-right-title clearfloat">
                    <fmt:message key="login.helloTip"/>
                    <fmt:message key="login.WelcomeTit"/>
                    <div class="btm-icon"></div>
                </div>
                <div class="isnot-ie">
                    <div class="user-wrapper">
                        <div class="user-wp">
                            <input type="text" class="account user-info" name="j_username" id="j_username"
                                   value="${userName }" placeholder="<fmt:message key="login.accountTip" />"
                                   autocomplete="off"/>
                            <span class="account-icon icon"></span>
                        </div>
                    </div>
                    <div class="user-wrapper">
                        <div class="user-wp">
                            <input type="password" class="psd user-info" name="j_password"
                                   id="j_password" placeholder="<fmt:message key="login.psdTip" />" autocomplete="off"/>
                            <span class="psd-icon icon"></span>
                        </div>
                    </div>
                    <div class="login-btn-wp">
                        <div class="error-tip">
                            <c:if test="${param.error eq 'true'}">
                                <c:if test="${!fn:contains(SPRING_SECURITY_LAST_EXCEPTION, 'User account is locked') && (pwdErrorNum==null || pwdErrorNum=='') }">
                                    <fmt:message key="errors.password.mismatch"/>
                                </c:if>
                            </c:if>
                        </div>
                        <button class="login-btn">
                            <a href="javascript:login();"><fmt:message key="login.button"/></a>
                        </button>
                    </div>
                </div>
                <div class="is-ie">
                    <div class="ie-tip" style="line-height:76px;font-size: 20px;position: relative;top:-21px;">
                        <fmt:message key="login.ieTip"/></div>
                    <button class="download-btn" onclick="handle()">
                        <fmt:message key="login.downloadTip"/>
                        <%-- <a href="javascript:handle();"><fmt:message key="login.downloadTip"/></a> --%>
                    </button>
                </div>
            </form>
            <div class="company-tip">Copyright &#169; 2018 SuperDesk</div>
        </div>
        <div class="bg-mask"></div>
    </div>
</div>

<%--<div class="login-wp">
   <div class="login-left">
     <div class="company-logo"></div>
     <div class="company-name">
       <div class="company-zh-name">SUPER SERVICE MANAGEMENT CONSOLE</div>
       <div class="company-en-name"><fmt:message key="login.companyName" /></div>
     </div>

   </div>
   <div class="login-right">
       <form method="post" action="<c:url value='/j_security_check'/>" id="form">
             <div class="login-right-wp">
               <h2 class="login-title"><fmt:message key="login.WelcomeTit" /></h2>
               <div class="user-wp">
                 <input type="text" class="account user-info" name="j_username" id="j_username"  value="${userName }" placeholder="<fmt:message key="login.accountTip" />" autocomplete="off"/>
                 <span class="account-icon icon"></span>
               </div>
               <div class="user-wp">
                 <input type="password" class="psd user-info"  name="j_password"
                           id="j_password" placeholder="<fmt:message key="login.psdTip" />" autocomplete="off"/>
                 <span class="psd-icon icon"></span>
               </div>
               <div class="login-btn-wp">
                 <div class="error-tip">
                     <c:if test="${param.error eq 'true'}">
                       <c:if
                           test="${!fn:contains(SPRING_SECURITY_LAST_EXCEPTION, 'User account is locked') && (pwdErrorNum==null || pwdErrorNum=='') }">
                            <fmt:message
                                   key="errors.password.mismatch" />
                       </c:if>
                   </c:if>
                 </div>
                 <button class="login-btn" >
                     <a href="javascript:login();"><fmt:message key="login.button" /></a>
                   </button>
               </div>
             </div>
        </form>
   </div>
 </div>--%>
<%-- <input type="hidden" id="errormsg" value="<fmt:message key='errors.password.mismatch' />">
<div id="loading-mask">
    <div id="pageloading"  class="loading">
        <img src="${ctx}/images/progressBar_m.gif" align="absmiddle"><fmt:message key="login.loading" />
    </div>
</div>
<div class="logo-left"></div>
<form method="post" action="<c:url value='/j_security_check'/>" id="form">
    <div id="main" style="border-bottom: none;">
        <div class="login">
            <h1>
                <span><fmt:message key="login.logotext" /></span>
            </h1>
            <div class="login_content">
                <p class="bgg1">
                    <strong><img src="${ctx}/images/personal_icon.png"/></strong>
                    <input value="${userName }"
                        name="j_username" id="j_username" class="login_input" size="20"
                        onmouseover="this.style.borderColor='#05b5ef'"
                        onmouseout="this.style.borderColor='#dbdbdb'" type="text">
                </p>
                <p class="bgg3">
                    <strong><img src="${ctx}/images/password_icon.png"/></strong><input name="j_password"
                        id="j_password" class="login_input" size="20"
                        onmouseover="this.style.borderColor='#05b5ef'"
                        onmouseout="this.style.borderColor='#dbdbdb'" type="password">
                </p>
                <p class="bgg4">&nbsp;
                    <span id="lblMessage">
                    <c:if test="${param.error eq 'true'}">
                        <c:if
                            test="${!fn:contains(SPRING_SECURITY_LAST_EXCEPTION, 'User account is locked') && (pwdErrorNum==null || pwdErrorNum=='') }">
                             <fmt:message
                                    key="errors.password.mismatch" />
                        </c:if>
                    </c:if>
                    </span>
                </p>
                <p>
                    <span class="login_a"> <a id="btnLogin" href="javascript:login();"><fmt:message key="login.button" /></a>
                    </span>
                </p>
            </div>
        </div>
        <!--
        <p style="text-align: center; margin-top: 10px;">Copyright ÃÂÃÂÃÂÃÂ© 2015
        </p>
         -->
    </div>
</form>

<div class="copyright"><fmt:message key="login.copyright" /></div>  --%>
</body>
</html>
