<%@page import="java.util.Date"%>
<%@ page language="java" pageEncoding="utf-8"%>
<%@ taglib uri="/struts-tags" prefix="s" %>
<%@ page import="com.gaowj.business.util.Java_tool" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<%
Java_tool jt = new Java_tool();
%>
 <%--  富客户端环境引用文件  --%> 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head> 
<title>系统登陆</title>
<!-- fancyBox的css -->
<link rel="stylesheet" type="text/css" href="${ctx}/lib/plug/fancyBox-2.1.5/source/jquery.fancybox.css" media="screen">
<script type="text/javascript" src="js/jquery-1.7.2.min.js"></script>
<!-- fancyBox的js -->
<script type="text/javascript" src="${ctx}/lib/plug/fancyBox-2.1.5/source/jquery.fancybox.js"></script>
<script type="text/javascript" src="system/pages/login/js/jquery.cookie.js"></script>
<script type="text/javascript" src="${ctx}/custom/plug/inputTips/inputTips.js"></script>
<link rel="shortcut icon" href="images/main/logo.ico" />
<link rel="icon" type="image/gif" href="images/main/logo.png" />
<style>
body{
	font-size: 14px;
	color: #666;
	font-family:"Microsoft YaHei";
	margin:0;
	padding:0;
}
a{
	color:inherit;
	text-decoration:none !important;
}
*{
	box-sizing:border-box;
	-moz-box-sizing:border-box; /* Firefox */
	-webkit-box-sizing:border-box; /* Safari */
}
.login_center{
	background: url(custom/images/login3_bg.jpg);
    background-size: cover;
    position: absolute;
    bottom: 102px;
    top: 0;
    left: 0;
    right: 0;
}
.login_container{
	position:absolute;
	top:50%;
	left:50%;
	margin-left:-217px;
	margin-top:-215px;
	background:#5f5f5f;
	width:434px;
	box-shadow:0 0 10px #403a3a;
	border-radius:5px;
	padding-bottom:30px;
	height:430px;
}
.login_logo{
	width:348px;
	margin:33px auto 25px;
	padding:0 25px 18px;
	border-bottom:1px solid white;
}
.login_logo>span{
	color:white;
	font-size:24px;
	font-weight:bold;
	margin-left:15px;
    vertical-align: top;
    margin-top:9px;
    display: inline-block;
}
.login_item{
	width:298px;
	margin:18px auto 0;
}
.login_item>input{
	color:#c8c8c8;
	width:298px;
	background:rgba(255,255,255,0.15);
	padding-left:10px;
	border:none;
	outline:none;
	height:32px;
}
.login_item_password{
	overflow: hidden;
	font-size:12px;
	width:298px;
	margin:18px auto 0;
}
.login_item_password label{
	cursor: pointer;
}
.login_yzm{
	width:298px;
	margin:18px auto 0;
}
.login_yzm>input{
    color: #c8c8c8;
    width: 234px;
    background: rgba(255,255,255,0.15);
    padding-left: 10px;
    border: none;
    outline: none;
    height: 32px;
    vertical-align:top;
}
.login_yzm>img{
	cursor: pointer;
}
.login_item_password input{
	vertical-align: sub;
}
.login_item_password>div:first-child{
	float:left;
	color:#c8c8c8;
}
.login_item_password>div:first-child+div{
	float:right;
	color:white;
	margin-top:2px;
}
.login_item_password>div:first-child+div:hover,.login_item_password span:hover{
	text-decoration: underline;
	cursor: pointer;
}
.login_item_login{
	height:40px;
	width:298px;
	background:#6aaeee;
	text-align:center;
	color:white;
	line-height: 40px;
	border-radius:5px;
	margin:0 auto 13px;
}
.login_item_login:hover{
	opacity:0.8;
	cursor: pointer;
}
.login_item_text{
	width:298px;
	margin:auto;
	text-align: center;
	color:#c8c8c8;
}
.login_item_text>a:hover{
	text-decoration:underline !important;
}
.footer{
    width: 100%;
    background: #eff2f5;
    overflow: hidden;
	position:absolute;
	left:0;
	right:0;
	bottom:0px;
}
.footer_inside{
    width: 900px;
    margin: 0 auto;
}
.footer_logo{
    float: left;
    background:  url("system/pages/login/img/footer_logo.png") center  no-repeat;
    width: 20px;
    height: 60px;
    margin: 10px 0 ;
}
.footer_company_info{
    float: left;
    margin: 10px 20px ;
    overflow: hidden;
}
.footer_company_info h1{
    margin: 12px 0 8px 0;
    padding: 0;
    font-size: 16px;
    font-weight: lighter;
    font-family: "微软雅黑";
    color: #184962;
}
.footer_company_info p{
    margin: 0 ;
    padding: 0;
    font-size: 12px;
    font-family: "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
    color: #a5a5a5;
}
.footer_links{
    float: right;
    margin: 28px 0 ;
    padding: 0;
    text-align: right;
}
.links_about{
    list-style: none;
}
.links_about li{
    float: right;
    font-size: 12px;
    color: #899ba6;
    font-weight: lighter;
    margin-left: 10px;
}
.links_about li a{
    color: #899ba6;
    -webkit-transition: 0.3s 0.2s ease;
    -moz-transition: 0.3s 0.2s ease;
}
.links_about li a:hover{
    color: #61747f;
}
.footer_links h1{
    overflow: hidden;
}
.footer_links p{
    clear: both;
    font-size: 12px;
    color: #899ba6;
    margin: 10px 0 20px 0 ;
}
form input:focus{
	background:white;
	color:#333;
}
</style>
</head>
<body>
<div class="login_center">
<div class="login_container">
	<div class="login_logo">
		<img src="custom/images/login3_logo.png" width="139" height="44"/><span>统一身份认证</span>
	</div>
	<form id="loginForm" name="login" method="post" action="login">
		<div class="login_item">
			<input type="text" id="username" name="loginusername" />
		</div>
		<div class="login_item">
			<input type="password" id="password" name="loginuserpass"/>
		</div>
		<s:if test="#session.chkyzm!=null && #session.chkyzm==1">
        	<div class="login_yzm"><input name="loginyzm" type="text"/><img src="images/image.jsp" height="32" onclick="changeImg(this)"/></div>
        </s:if>
	</form>
	<div class="login_item_password">
		<div><input type="checkbox" name="remember" id="remember"/><label for="remember">记住账号</label></div>
		<div><a href="#">忘记密码</a></div>
	</div>
	<%-- <div style="margin-top:10px;*margin-top:0px;text-align:center;background: #ffebeb;color: #e4393c;border: 1px solid #faccc6;height:42px;line-height:42px;"><s:property value="#request.err"/></div> --%>
	<div style="text-decoration:none;cursor:text;color:red;margin-top:5px;*margin-top:0px;text-align:center;"><s:property value="#request.err"/></div>
	<div style="text-decoration:none;cursor:text;color:red;margin-top:5px;margin-bottom:7px;*margin-top:0px;text-align:center;">
     <%
        if(session.getAttribute("beforeUser")!=null){
             java.util.Map<String,Object> beforeUser = (java.util.Map<String,Object>)session.getAttribute("beforeUser");
             request.removeAttribute("beforeUser");
             System.out.println(beforeUser);
             String loginDate = (String)beforeUser.get("BEFORETIME");
             out.println("登陆用户已存在,之前登时间："+loginDate+" 登陆IP:"+beforeUser.get("LOGINIP"));
       }
      %>
   	</div>
	<div class="login_item_login" id="b_login">登  录</div>
	<div class="login_item_text"><a href="#">统一身份认证在线帮助入口</a></div>

</div>
</div>	

<div class="footer">
    <div class="footer_inside">
        <div class="footer_logo"></div>
        <div class="footer_company_info">
            <h1>杰夫V5微应用服务平台</h1>
            <p>Powered By  © 2014-<%=jt.now_year() %> www.jfbrother.com </p>
        </div>
        <div class="footer_links">
            <p>建议使用IE9.0及以上版本浏览器/现代浏览器访问本站</p>
        </div>
    </div>
</div>
<script type="text/javascript">
$(document).ready(function () {

	//判断ie浏览器ie8以下执行
	if(IEVersion()<='8'&&IEVersion()!='-1'){
		$.fancybox.open('<div style="line-height:20px;">ie浏览器版本过低,请使用高版本浏览器</div>')
	}
	
	//初始化所有的文本提示框
	init_login_tip($('#username'),'请输入账号');
	init_login_tip($('#password'),'请输入密码');
	init_login_tip($('.login_yzm>input'),'请输入验证码');

	document.onkeydown = function(e) {
		var ev = document.all ? window.event : e;
		if (ev.keyCode == 13) {
			$("#b_login").click(); //处理事件
		}
	}

	// 判断记住密码的操作
	if ($.cookie("username") != '' && $.cookie("username") != null && $.cookie("username") != 'undefined') {
		$("#username").val(BASE64.decode($.cookie("username")));
		$("#username").next().hide();
		if ($.cookie("password") != '' && $.cookie("password") != null && $.cookie("password") != 'undefined') {
			$("#password").val(BASE64.decode($.cookie("password")));
			$("#remember").attr('checked', 'checked');
			$("#password").next().hide();
		}
	}
	
	// 点击记住密码
	$("#remember").live('click', function() {
		updateCookie();
	});
	// 点击重置
	$("#b_cancel").live('click', function() {
		$("#remember").removeAttr('checked');
		$("#username").val('');
		$("#password").val('');
		updateCookie();
	});
	// 输入用户名清空密码
	$("#username").live('keyup', function() {
		$("#password").val('');
		$("#password").next().show();
	});

	/**
	 * cookie操作
	 */
	function updateCookie() {
		if ($("#remember").attr('checked') == 'checked') {
			$.cookie("username", BASE64.encode($("#username").val()), {
				expires : 1000
			});
			$.cookie("password", BASE64.encode($("#password").val()), {
				expires : 1000
			});
		} else {
			$("#remember").removeAttr('checked');
			$.cookie("username", null);
			$.cookie("password", null);
		}
	}
	// 设置cookie 默认7天
	function SetCookie(name, value) // 两个参数，一个是cookie的名子，一个是值
	{
		$.cookie(name, value, {
			expires : 1000
		});
	}

	//提交操作
	$("#b_login").live('click', function() {
		updateCookie();
		$("#loginForm").submit();
	});
});

//变更验证码
function changeImg(handler){
	var date = new Date();
	$(handler).attr('src','images/image.jsp?date='+date.getTime());
}

//初始文本框的提示信息
function init_login_tip(handler,text){
	$(handler).inputTips({
		tip : {
			color : '#c8c8c8',
			text : text,
			fontSize : '14px'
		}
	});
}

//判断ie浏览器
function IEVersion() {
    var userAgent = navigator.userAgent; //取得浏览器的userAgent字符串  
    var isIE = userAgent.indexOf("compatible") > -1 && userAgent.indexOf("MSIE") > -1; //判断是否IE<11浏览器  
    var isEdge = userAgent.indexOf("Edge") > -1 && !isIE; //判断是否IE的Edge浏览器  
    var isIE11 = userAgent.indexOf('Trident') > -1 && userAgent.indexOf("rv:11.0") > -1;
    if(isIE) {
        var reIE = new RegExp("MSIE (\\d+\\.\\d+);");
        reIE.test(userAgent);
        var fIEVersion = parseFloat(RegExp["$1"]);
        if(fIEVersion == 7) {
            return 7;
        } else if(fIEVersion == 8) {
            return 8;
        } else if(fIEVersion == 9) {
            return 9;
        } else if(fIEVersion == 10) {
            return 10;
        } else {
            return 6;//IE版本<=7
        }   
    } else if(isEdge) {
        return 'edge';//edge
    } else if(isIE11) {
        return 11; //IE11  
    }else{
        return -1;//不是ie浏览器
    }
}
</script>
</body>
</html>
