








<!DOCTYPE html>
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge"> 
		<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
		<title>系统登录</title>
		<meta charset="utf-8"/>
		<link rel="stylesheet" type="text/css" href="/css/FormBase.css" />
		<link rel="stylesheet" type="text/css" href="/css/Animation.css"/>
		<link rel="stylesheet" type="text/css" href="/logini/css/login.css"/>
        <script type="text/javascript" src="/js/CheckValid.js"></script>
		<script type="text/javascript" src="/js/FormBase.js"></script>
		<script type="text/javascript" src="/js/Dialog.js"></script>
		<script type="text/javascript" src="/js/HttpAjax.js"></script>
		<script type="text/javascript" src="/js/LocalStore.js"></script>
		<script type="text/javascript" src="/js/jsencrypt.js"></script>
		<script type="text/javascript" src="js/jquery.js"></script>
		<!--[if IE]>
		<![endif]-->
		<script type="text/javascript">
			window.onload=function(){
				if (!document.getElementsByClassName) {
 				   document.getElementsByClassName = function (className, element) {
        			   var children = (element || document).getElementsByTagName('*');
     				   var elements = new Array();
    			           for (var i = 0; i < children.length; i++) {
        		           var child = children[i];
         			   var classNames = child.className.split(' ');
      			           for (var j = 0; j < classNames.length; j++) {
        		           if (classNames[j] == className) {
                	           elements.push(child);
              		           break;
             			   }
          			  }
       				 }
      			   return elements;
 			 };
			}
			

				var apkImgPath='/app/whyy.png';
				var ipaImgPath=null;
				if(apkImgPath!=null){
				    var imgon=document.getElementById("an")
				   imgon.setAttribute("style","display:block");
				  var imgon11=document.getElementById("imgone");
				  imgon11.src=apkImgPath;
				}
				if(ipaImgPath!=null){
					var imgtw=document.getElementById("iphib")
				        imgtw.setAttribute("style","display:block");
					var imgtw111=document.getElementById("imgtwo"); 
					imgtw111.src=null;		
				}
				//登录框动画
				setTimeout(function(){
					document.getElementById("username").focus();
				},400)
				
				
				//显示帐号与密码
				var userName=LocalStore.getItem("loginname");
				if(userName!=undefined && userName.length>0 && userName!=null){
					document.getElementById("username").value=userName;
				}else{
					document.getElementById("username").placeholder="请输入用户名";
				}
				var userPass=LocalStore.getItem("userpass");
				if(userPass!=undefined && userPass.length>0 && userPass!=null){
					document.getElementById("pwd").value=userPass;
				}else{
					document.getElementById("pwd").placeholder="请输入密码";
				}
				var rememstr=LocalStore.getItem("remember");
				if(rememstr!=null && rememstr=="1"){
					var choose=document.getElementById("remebBox");
					choose.checked=true;
				}
			}
			
			//input回车键进入下一个input
			function focusNextInput(obj){
				var inpt=document.getElementsByTagName("input");
				for(var i=0;i<inpt.length;i++){
					if(i==inpt.length-1){
						if(inpt[i].type=="checkbox"){
							continue;
						}else{
							inpt[0].focus();
							break;
						}
					}else if(obj==inpt[i]){
						if(inpt[i+1].type=="checkbox"){
							inpt[i+2].focus();
							break;
						}else{
							inpt[i+1].focus();
							break;
						}
					}
				}
			}
			

           var publicKey = 'MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAxkScd239hqt6dvWUJ0c2\n' +
                           '1/B3pZNZxK5LBDx931OP1w0AXeIffOD+TNhOo78UO1zNUd87f4v27JU0yFfs/ij/\n' +
                           '7w/IWqegEIozgvZpoSWBkGf8yoDMqmgyw93D0z7t7NTnYcO9kl/rajU6WTlbqDWG\n' +
                           'pltffVml3aXfOp7H212gKrW86NzIF50vIfVHY7yvIe0PxtRkxEE7+7leMCnn92ss\n' +
                           'UPJN9hjOAbqsXpxd3gQzkeI0i7uKkh+98PIm8q1t5db8AMlWBQHu8KgXQWS2pUnv\n' +
                           'KOn1wq+VtrJ7ThGHqFx4vaCcQmVb69rY98PzDoH5Bue8mY2RChNS++29LmUDppnM\n' +
                           'PQIDAQAB';
          // 加密
          function encrypt(txt) {
             var encryptor = new JSEncrypt()
             encryptor.setPublicKey(publicKey) // 设置公钥
             return encryptor.encrypt(txt) // 对需要加密的数据进行加密
          }
			
			//登录系统
			function loginSystemPlate(){
				if(loginFailShow)return;
				
				//输入验证
				var userName=document.getElementById("username").value;
				if(userName==""){
					Dialog.showMessageDialog("提示","帐号不能为空",null);
					return;
				}
				var userPass=document.getElementById("pwd").value;
				if(userPass==""){
					Dialog.showMessageDialog("提示","密码不能为空",null);
					return;
				}
				
				//验证码
				var checkCodeTxt=null;
				var checkCodeObj=document.getElementById('checkCode');
				if(checkCodeObj){
					checkCodeTxt=checkCodeObj.value;
					if(checkCodeTxt==''){
						Dialog.showMessageDialog("提示","请输入验证码",null);
						return;
					}
				}

				//请求登录
				var urls="/interface/CheckLoginName.jsp";
				userPass = encrypt(userPass);
	            userPass = encodeEditorHtml(userPass);
				var parameter="userName="+userName+"&userPass="+userPass;
				if(checkCodeTxt!=null){
					parameter=parameter+"&checkCode="+checkCodeTxt;
				}
				HttpAjax.requestAjax(urls,parameter,"loginAfterResponse","loginAfterError");
			}

			//请求后处理
			function loginAfterResponse(responseTxt){
				var xmlDoc={};
				try{
					xmlDoc=eval("("+responseTxt+")");
				}catch(err){
					xmlDoc={"result":"failure","remark":"返回数据不对"};
				}
				if(xmlDoc.result!="success"){
					var remark=xmlDoc.remark;
					if(remark=="" || remark==undefined){
						remark="帐号密码不匹配";
					}
					if(remark == "密码须包含大小写字母、数字和特殊字符<br/>且长度是15位以上，修改密码后在登录"){
						Dialog.showMessageDialog("提示",remark,"hideTwoMessageDialog();");
					}else{
						Dialog.showMessageDialog("提示",remark,"hideMessageDialog();");
					}
					loginFailShow=true;
					return;
				}
						
				//缓存token和userid
				LocalStore.setItem("token",xmlDoc.token);
				LocalStore.setItem("userid",xmlDoc.userid);
				LocalStore.setItem("username",xmlDoc.username);
				LocalStore.setItem("deptid",xmlDoc.deptid);
				LocalStore.setItem("roleid",xmlDoc.roleid);
				LocalStore.setItem("compid",xmlDoc.compid);
                //缓存帐号密码
				var userName=document.getElementById("username").value;
				LocalStore.setItem("loginname",userName);
				var choose=document.getElementById("remebBox");
				if(choose.checked==true){
					var userPass=document.getElementById("pwd").value;
					LocalStore.setItem("userpass",userPass);
					LocalStore.setItem("remember","1");
				}else{
					LocalStore.setItem("remember","0");
					LocalStore.setItem("userpass","");
				}
						
				//进入到首页界面
				document.getElementById("token").value=xmlDoc.token;
				document.getElementById("randomnum").value=createRandomText(16);
				document.getElementById("mainframe").submit();
			}
			
			//关闭登录失败对话框，防止再弹出对话框
			var loginFailShow=false;
			function hideMessageDialog(){
				loginFailShow=false;
				Dialog.hideDialogLayer();
			}
			
			function hideTwoMessageDialog(){
				loginFailShow=false;
				Dialog.hideDialogLayer();
				Dialog.createIFrameDialog("修改密码",600,300,"/upPassword.jsp");
			}

			//请求问题
			function loginAfterError(rsponseText){
				Dialog.showMessageDialog("提示","登录请求失败");
			}

			//退出系统，此方法为filter调用
			function reloginPlate(){
				window.location.href="/index.jsp";
			}

			function choseBtn(e) {	
				var titleName = document.getElementsByClassName('topLi')[0].children
				var form = document.getElementsByClassName('form')
				for (var i = 0; i < titleName.length; i++) {
					titleName[i].className = 'titleName'
				   if (e == i + 1) {
					titleName[i].className = 'titleName active'
				   }
				}
				for (var c = 0; c < form.length; c++) {
				  form[c].style.display = 'none'
				  if (e == c + 1) {
					 form[c].style.display = ''
				  }
				}
			}
		</script>
		
	</head>
	<body style="height:100%">
		<form name="mainframe" id="mainframe" action="toMainPage.jsp" method="post">
			<input type="hidden" name="token" id="token" value="">
			<input type="hidden" name="randomnum" id="randomnum" value="">
		</form>
		<div class="login_header" id="login_header"></div>
		<a href="download.html" style="color:black;"><span style="float:right;position: absolute;left: 91%;top: 34px;font-size: 16px">常用下载</span></a>
		<div class="login_bg" id="login_bg">
			<div class="login_main">
				<!--<img src="/logini/images/login_img.png" alt="" class="login_img animated pulse"/>-->
				<div class="login_box animated move">
					<form method="post" action="">
						<div class="topLi">
						   <span class="titleName active" onclick="choseBtn('1')">账号登录</span>
						   <span class="titleName" onclick="choseBtn('2')">手机号登录</span>
						</div>
						<table style="width:100%;padding: 0px 23px 29px 23px;border-radius:0px 0px 5px 5px;margin-top: 1rem;" class="form">	
							<tr style="display:block;margin-bottom:15px;">
								<td colspan="2" style="height:38px;line-height:38px;display:block;">
									<span class="login_icon block text_center">
									  <img src="/logini/images/login_username.png" alt=""/>
								    </span>
									<div class="inp_login" style="border-radius:4px;border: none!important;">
										<input type="text" id="username" name="username"  class="inputfield inp_login" placeholder="请输入用户名" onfocus="if(this.placeholder=='请输入用户名'){this.placeholder='';}" onblur="if(this.placeholder==''){this.placeholder='请输入用户名';}" onkeydown="if(event.keyCode==13) focusNextInput(this);" style="color:#333"/>
									</div>
								</td>
							</tr>
							<tr    style="display:block;margin-bottom:15px;">
								<td colspan="2" style="height:38px;line-height:38px;display:block;">
									<span  class="login_icon block text_center">
									  <img src="/logini/images/login_pwd.png" alt=""/>
								    </span>
									<div class="inp_login" style="border-radius:4px;border: none!important;">
										<input type="password" id="pwd" class="inputfield inp_login" name="pwd" placeholder="请输入密码" onfocus="if(this.placeholder=='请输入密码'){this.placeholder='';}" onblur="if(this.placeholder==''){this.placeholder='请输入密码';}" onkeydown="if(event.keyCode==13) focusNextInput(this);" style="color:#333;"/>
									</div>
								</td>
							</tr>
							

							<tr>
								<td class=" login_btn" colspan="2">
								<input type="button" value="登录"   style="font-size:17px;height:44px;width:100%;background-color:#008ed7;border:none;color:#fff;cursor:pointer" onclick="loginSystemPlate();" onkeydown="if(event.keyCode==13) focusNextInput(this);"/>
							    </td>
							</tr>
							<tr>
							<td style="display:block;margin-top:10px;">









<div id="remeb" class="formCheckBoxDivClass">
	<input type="checkbox" class="formCheckBoxClass" id="remebBox" name="remeb" value="yes" checked>
	<span></span>
</div>
<label id="remebLabel" for="remebBox" class="formCheckBoxLabelClass" style="vertical-align:middle;height:24px;line-height:24px;">记住密码</label></td>
							</tr>
						</table>
						<table style="width:100%;padding: 0px 23px 29px 23px;border-radius:0px 0px 5px 5px;margin-top: 1rem;display: none" class="form">	
							<tr style="display:block;margin-bottom:15px;">
								<td colspan="2" style="height:38px;line-height:38px;display:block;">
									<span class="login_icon block text_center">
									  <img src="/logini/images/login_username.png" alt=""/>
								    </span>
									<div class="inp_login" style="border-radius:4px;border: none!important;">
										<input type="text" id="phoneNumber" name="phoneNumber"  class="inputfield inp_login" placeholder="请输入手机号"  style="color:#333"/>
									</div>
								</td>
							</tr>
							<tr    style="display:block;margin-bottom:15px;">
								<td colspan="2" style="height:38px;line-height:38px;display:block;">
									<div class="inp_login" style="border-radius:4px;border: none!important;">
										<input type="text" id="authCode" name="authCode" style="padding-left: 0.8rem;width: 70%;float: left;" id="pwd" class="inputfield inp_login" name="pwd" placeholder="请输入验证码" onfocus="if(this.placeholder=='请输入密码'){this.placeholder='';}" onblur="if(this.placeholder==''){this.placeholder='请输入密码';}" onkeydown="if(event.keyCode==13) focusNextInput(this);" style="color:#333;"/>
										<input type="button" id="get-code" value="获取验证码" onclick="getCode()">
									 </div>
								</td>
							</tr>
							<tr>
								<td class=" login_btn" colspan="2">
									<input type="button" value="登录" style="font-size:17px;height:44px;width:100%;background-color:#008ed7;border:none;color:#fff;cursor:pointer" onclick="loginIndex();" onkeydown="if(event.keyCode==13) focusNextInput(this);"/>
							    </td>
							</tr>
							<tr>
								<td style="display:block;margin-top:10px;">
									<div style="height:24px;width:100%"></div>
									
								</td>
							</tr>
						</table>
					</form>
				</div>
			</div>
		</div>
		<div class="footer" id="footer">
			<p>芜湖市第一人民医院 协同办公系统</p>
			<p>技术支持：协达软件 ；服务电话：0551-62556922；178-0560-9588（微信同号）；投诉电话：188-5510-4008</p>
		</div>
		
		<style>
			body{position:relative;overflow:hidden}
			.erweima{/*height:160px;*/
			position:fixed;top:53%;right:0;display:block;z-index:10000;}
			.erweima .saominao{/*display:none;*/position:absolute;width:136px;border:#e0e0e0 1px solid;padding:13px 0;background-color:white}

			.anzhuo p{font-size:13px;color: #999;line-height: 20px;margin:0 3px;}
			.erweima .saominao img{width:96px;height:96px;display:block;margin:0 auto;}
			.erweima .saominao p{font-size:11px;color:#333;text-align:center;line-height:17px;}
			.oneone{right: 90px;top: 0px;display:none;border-right:	1px solid #d1e3f8}
			.twotwo {right: 90px;top: 0px;display:none;border-right:1px solid #d1e3f8}
			.img_two,.img_fore{display:none;}
			.an:hover .img_two{display:block;cursor:pointer}
			.an:hover .anzhuo p{color:#227fd2;}
			.an:hover .img_one{display:none;cursor:pointer}
			.an:hover .oneone{display:block;cursor:pointer}
			.iphib:hover .twotwo{display:block;cursor:pointer}
			.iphib:hover .img_fore{display:block;cursor:pointer}
			.iphib:hover .img_there{display:none;cursor:pointer}
			.iphib:hover .anzhuo p{color: #227fd2;}
			.an,.iphib{display:none;position:relative;}
			.footer>span{
				font-weight:bold;
			}
			input::placeholder{
				font-family: MicrosoftYaHei;
				font-size: 16px;
				font-weight: normal;
				font-stretch: normal;
				line-height: 30px;
				letter-spacing: 0px;
				color: #a0a0a0;
			}
			.login_box>form{
				background-color:rgba(228,240,244,0.7);
				border-radius:10px;
			}
			.img_there{
				opacity:0.6
			}
			.img_one{
				opacity:0.6
			}
			#remeb{
			   background-color:rgba(228,240,244,0.7);
			}
			.topLi {
			   height: 70px;
			   line-height: 70px;
			   text-align: center;
			   width: 80%;
			   margin: auto;
			   position: relative;
			   top: 10px;
			}
			.titleName {
				font-weight: bold;
				color: #008ed7;
				font-size: 18px;
				display: inline-block;
				height: 50px;
				line-height: 50px;
				width: 45%;
				float: left;
				cursor: pointer;
				margin-left: 2.5%;
			}
			.active {
				color: #008ed7;
				border-bottom: 2px solid #008ed7!important;
				transition: all 0.1s ease;
			}
			#get-code {
				float: right;
				width: 30%;
				height: 45px;
				font-size: 16px;
				font-weight: 500;
				border: 1px solid #b3b3b3;
				cursor: pointer;
				background: transparent;
				color: #7d7d7d;
				border-left: none;
			}
		</style>
		<div class="erweima">
			<div class="one an" id="an">
				<div class="anzhuo ">
					<img src="/logini/images/hei.png" class="img_one"/>
					<img src="/logini/images/lan.png" class="img_two"/>
				</div>
				<div class="saominao oneone" id="img_er">

					<!--<img src="" id="imgone"/>-->
					<img src="/logini/images/erweiam.png" id="imgone"/>
					<p>二维码扫码登录</p>
				</div>
			</div>
			<div class="one iphib" id="iphib">
				<div class="anzhuo ">
					<img src="/logini/images/heii.png" class="img_there"/>
					<img src="/logini/images/lann.png" class="img_fore"/>
			    </div>
				<div class="saominao twotwo" id="img_wr">
					<!--<img src="" id="imgtwo"/>-->
					<img src="/logini/images/erweiam.png" id="imgtwo"/>
					<p>二维码扫码登录</p>
				</div>
			</div>
		</div>
	</body>
</html>
<script>

	function getCode(){
		var phoneNumber = document.getElementById('phoneNumber').value
	    if (phoneNumber == '') {
			Dialog.showMessageDialog("提示","手机号不能为空",null);
		 	return;
	    } 
		var flag=regPhoneNumber(phoneNumber);
		if(!flag){
			Dialog.showMessageDialog("提示","手机号格式有误",null);
		 	return;
		}
		var urls="/smsLogin/inter/smsSendLogin.jsp";	
      	var parameter="phoneNumber="+phoneNumber;
      	HttpAjax.requestAjax(urls,parameter,"loginYes","loginNo");
	}
	
	function loginYes(responseTxt) {
		var xmlDoc=eval("("+responseTxt+")");
	    if(xmlDoc.result!="success"){
			var remark=xmlDoc.remark;
			Dialog.showMessageDialog("提示",remark,"hideMessageDialog();");
			loginFailShow=true;
			return;
		}else{
			 countdown();
		}
	}
	
	function loginNo(responseTxt) {
		
	}
	
	function countdown() {
		var ele = document.getElementById("get-code");
		ele.style.cssText = "cursor: no-drop;"
		ele.setAttribute("onclick","doNotClick()");
        var time = 60;
		var interval= setInterval(function(){
             if (time > 0) {
                 time = time - 1;
                 ele.value = time + 's';
             } else {
               	ele.value = "重新获取";
               	ele.style.cssText = "cursor: point;"
               	ele.setAttribute("onclick","getCode()");
                clearInterval(interval)
             }
         }, 1000)
	}
	
	function loginIndex() {
	   var authCode = document.getElementById('authCode').value
	   var phoneNumber = document.getElementById('phoneNumber').value
	   if (phoneNumber == '') {
	   		Dialog.showMessageDialog("提示","手机号不能为空",null);
			 return;
  	   }
	   var flag=regPhoneNumber(phoneNumber);
	   if(!flag){
			Dialog.showMessageDialog("提示","手机号格式有误",null);
		 	return;
	   }
	   if (authCode == '') {
  			 Dialog.showMessageDialog("提示","验证码不能为空",null);
  			 return;
  	   }
	   var urls="/smsLogin/inter/singleLogin.jsp";	
 	   var parameter="phoneNumber="+phoneNumber+"&authCode="+authCode;
 	   HttpAjax.requestAjax(urls,parameter,"loginSuccess","loginError");
	}
	
	function loginSuccess(responseTxt) {
	    var xmlDoc=eval("("+responseTxt+")");
	    if(xmlDoc.result!="success"){
			var remark=xmlDoc.remark;
			Dialog.showMessageDialog("提示",remark,"hideMessageDialog();");
			loginFailShow=true;
			return;
		}
	    //缓存token和userid
		LocalStore.setItem("token",xmlDoc.token);
		LocalStore.setItem("userid",xmlDoc.userid);
		document.getElementById("token").value=xmlDoc.token;
		document.getElementById("randomnum").value=createRandomText(16);
		document.getElementById("mainframe").submit();
	}
	
	function loginError(responseTxt) {
		
	}
	
	function doNotClick(){}
	
	function regPhoneNumber(phoneNum){
		//var reg = /^1[3|4|5|7|8][0-9]{9}$/; //验证规则
		var reg = /^1[0-9]{10}$/;
		return reg.test(phoneNum); 
	}
</script>