<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="userLogin.aspx.cs" Inherits="ZYDN.Web.webUser.userLogin" %>


<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>用户登录</title>
    <link rel="stylesheet" type="text/css" href="../system/skins/css/main.css" />
<link rel="stylesheet" type="text/css" href="../system/webos/css/webOS.css" />
<script language="javascript" src="../system/js/JFramework.js"></script>
<script language="javascript" src="../system/js/Sys.js"></script>
<script  language="javascript" >
    var refUrl=document.referrer;
   // alert(refUrl);
	var objAjax=new JAjax();
	function loadPage(){
		var out=objAjax.getText("post","../system/user/userLogin.aspx?type=test",null,null);
		if (out!="0"){
			location.href=refUrl;
		}
	}
	
	function logout(){
		var out=objAjax.getText("post","../system/user/userLogin.aspx?type=logout",null,null);
	}
	
	function login(){
		var objResponse=new JHttpResponse();
		objResponse.write("userName",userLogin.userName.value);
		objResponse.write("userPass",userLogin.userPass.value);
		objResponse.write("validate",userLogin.validate.value);
		if (userLogin.c1.checked==true){
			objResponse.write("userEx","2");
		}else{
			objResponse.write("userEx","0");
		}
		
		var out=objAjax.getText("post","../system/user/userLogin.aspx?type=login",objResponse,null);
		//alert(out);
		 //返回 99 未输入用户名和密码 1 用户未找到; 2 密码错误 -1正确输入登录
		  switch (out){
		  	 case "1":
			 	alert("用户未找到")
			 	break;
			  case "2":
			 	alert("密码错误")
			  	break;
			  case "3":
			 	alert("用户过期")
			  	break;
			   case "99":
					alert("未输入用户名和密码")
					break;
				case "0":
					alert("校验失败")
					//return;
					location.href="userLogin.aspx";
					retutn;
					break;
				case "-99":
					alert("验证码错误")
					location.href="userLogin.aspx";
					return;
					break;
				case "-1":
					location.href=refUrl;
					return;
					break;
				default:
					alert("未知错误:\n"+erStr(out));
					break;
		  }
		//  loadPage();

	}
	
	function keyDown(){
		var key=event.keyCode;
		if (key==13){
			login();
		}
		
	}
		
     function rImg(){
	 	$("vImg").src="../system/user/validateImg.aspx?t="+create_id();
	 }
</script>
</head>	
<body onload="loadPage()"  onkeydown="keyDown()" style="background-color: #D1F4F6" >
<center>
<div style="width:573px;height:338px;margin-top:50px;">
<div style="width:573px;height:108px; background-image:url('../system/webos/img/hiweb_03.jpg');"></div>
<div style="width:573px;height:115px; background-image:url('../system/webos/img/hiweb_05.jpg'); text-align:center;">


<form name="userLogin" id="userLogin" >
	<table border="0" width="320" id="table1">
		<tr>
			<td style="width:80px">用户名:&nbsp; </td>
			<td colspan="2" style="width:320px"> <input type="text" class="loginInputCss" name="userName" id="userName" ></td>
		</tr>
		<tr>
			<td style="width:80px">密码:&nbsp; </td>
			<td colspan="2" style="width:320px"> <input type="password" class="loginInputCss" name="userPass" id="userPass" ></td>
		</tr>
		<tr>
			<td  style="width:80px">验证码:</td>
			<td width="100" style="width:80px;">
			
			<input type=text class="loginInputCss" id="validate" name="validate" style="width:80px;height:20px;">
			
			</td>
		    <td ><span style="padding-top:5px;margin-top:5px;"><img onClick="rImg();" id="vImg" title="点击更换" src="../system/user/validateImg.aspx"></span></td>
		</tr>
		<tr>
			<td colspan="3"  style="width:400px">
	<input id="c1" type="checkbox" value="1" name="C1"  /><label for ="c1">记住登录</label>			</td>
		</tr>
	</table>
	<div  style="width:100%;height:34px;">
	<div style="width:243px;height:34px; float:left;background-image:url('../system/webos/img/hiweb_06.jpg');"></div>
	<div style="width:71px;height:34px;float:left; overflow:hidden; ">
	<img src="../system/webos/img/hiweb_07.jpg"  onclick="login()"/>
	</div>
	<div style="width:259px;height:34px; float:left;background-image:url('../system/webos/img/hiweb_08.jpg');"></div>
	</div>
</form>



</div>
<div style="width:573px;height:81px; background-image:url('../system/webos/img/hiweb_09.jpg');"></div>



</div>
</center>
</body>
</html>