登陆



<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>XXXX</title>
<link type="text/css" rel="stylesheet" href="css/main.css" />
<script type="text/javascript" src="jquery/1.9.0/jquery.min.js"></script>
<script type="text/javascript" src="bootstrap/3.0.3/js/bootstrap.min.js"></script>
<script type="text/javascript" src="config/ServiceConfig.js"></script>
</head>
<body οnkeydοwn="keyDown(event)" οnlοad="initPage()">
<script>
 init();
 function initPage(){
 	if(getCookie('SG_REMEMBER_USER')=='1'){
 			var cb = document.getElementById('isRememberUser');
 			$('#username')[0].value=getCookie('SG_LOGIN_NAME');
 			$('#password')[0].value=getCookie('SG_LOGIN_PWD');
 			$('#isRememberUser')[0].checked=true;
 		}else{
 			$('#isRememberUser')[0].checked=false;
 		}
 }
 function init(){
 	var sid =getCookie('sgSid'),
 		url = SERVICECONFIG.getConfig('SERVER_PATH') + SERVICECONFIG.getConfig('OAUTHPATH') + '/userinfo?sid=' + sid;	
 		if(!sid || sid==""){
 			return;
 		}

	//获取用户信息
	$.ajax({
		url: url,
		async: true,
		dataType:'json',
		success: function(response) {
			var responseData = response;			
			if (!responseData.error) { //错误
				if (window.top) {
					window.top.location = SERVICECONFIG.getConfig('MAIN_URL');
				} else {
					window.location = SERVICECONFIG.getConfig('MAIN_URL');
				}
			} 
		},
		failure: function(response) {
		}
	});
 }

 function login(){
	var cb = document.getElementById('isRememberUser');
	 if( cb.checked){
		 setCookie("SG_REMEMBER_USER", "1", 60*60*24*30);
		 setCookie("TEMP_PASSWORD", $('#password')[0].value, 60*60*1); 
	 }else{
		 setCookie("SG_REMEMBER_USER", "0", 60*60*24*30); 
		 delCookie('SG_LOGIN_NAME');
		 delCookie('SG_LOGIN_PWD');
	 }
	 document.getElementById("myform").submit();
 }
 
 function setCookie(name, value, seconds) {  
	 seconds = seconds || 0;  
	 var expires = "";  
	 if (seconds != 0 ) {
	 	var date = new Date();  
	 	date.setTime(date.getTime() + (seconds*1000));  
	 	expires = ";expires=" + date.toGMTString();  
	 }   
	 document.cookie = name + "=" + escape(value) + expires + ";path=/";
	} 


function getCookie(c_name) {
	if (document.cookie.length > 0) {
		c_start = document.cookie.indexOf(c_name + "=")
		if (c_start != -1) {
			c_start = c_start + c_name.length + 1
			c_end = document.cookie.indexOf(";", c_start)
			if (c_end == -1) c_end = document.cookie.length
			return unescape(document.cookie.substring(c_start, c_end))
		}
	}
	return ""
}
function delCookie(name) //删除cookie
	{
		var exp = new Date();
		exp.setTime(exp.getTime() - 1);
		var cval = getCookie(name);
		if (cval != null) document.cookie = name + "=" + cval + ";expires=" + exp.toGMTString();
	}

function keyDown(e){
	var keycode = 0;
	if(CheckBrowserIsIE())
		keycode = event.keyCode;
	else
		keycode = e.which;
	
	if(keycode == 13)
		login();
}
 
function CheckBrowserIsIE(){
	var browser = navigator.appName;
	return (browser == "Microsoft Internet Explorer");
} 
</script>
<div id="headarea">
   <div id="logodiv">
     <img src="img/login_lg.png" />
   </div>
</div>
<div id="loginarea">
 <div id="logindiv">

 <form action="/authserver/login.do" method="post" role="form" id="myform" name="myform">
    <div class="inputdiv bg1">
      <span>用户名:</span><input id="username" name="username"  type="text" maxlength=32 value=""/>
    </div>
    <div class="inputdiv bg2">
      <span>密    码:</span><input id="password" name="password" type="password" value="" maxlength=32/>
    </div>
    <div id="rememberpwd">
       <label for="remember">记住密码</label>
       <input type="checkbox" id="isRememberUser" />
    </div>
    <div id="loginbtdiv">
      <a href="javascript:login();"><img src="img/btn.png"  /></a>
      
    </div>
 </form>
 </div>
</div>
</body>
</html>


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值