<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>飞天素材网-后台登录</title>
  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
  <link rel="stylesheet" media="screen" href="../css/login.css">
  <link rel="stylesheet" type="text/css" href="../css/reset.css"/>
  <link href="../css/bootstrap.min.css" rel="stylesheet">
</head>
<body>

<div id="particles-js" style="background-image: url('../images/login_bg.jpg');">
        <form name="userForm" method="post" id="form">
		<div class="login">
			<div class="login-top">用户登录{$login_msg}</div>
			<div class="login-center clearfix">
				<div class="login-center-img"><img src="../images/name.png"/></div>
				<div class="login-center-input">
					<input type="text" name="txtName" id="txtName" value="" placeholder="请输入您的用户名" onFocus="this.placeholder=''" onBlur="this.placeholder='请输入您的用户名'"/>
					<div class="login-center-input-text">用户名</div>
				</div>
			</div>
			<div class="login-center clearfix">
				<div class="login-center-img"><img src="../images/password.png"/></div>
				<div class="login-center-input">
					<input type="password" name="txtPwd" id="txtPwd" value="" placeholder="请输入您的密码" onFocus="this.placeholder=''" onBlur="this.placeholder='请输入您的密码'"/>
					<div class="login-center-input-text">密码</div>
				</div>
			</div>
			<div class="login-button">登录</div>
		</div>
		<div class="sk-rotating-plane"></div>
		<input name="returnurl" type="hidden" id="returnurl" value="{$returnurl}" />
		</form>
</div>

<script src="../js/jquery.min.js"></script>
<script src="../js/bootstrap-notify.min.js"></script>
<script src="../js/tips.js"></script>
<script type="text/javascript">
	function hasClass(elem, cls) {
	  cls = cls || '';
	  if (cls.replace(/\s/g, '').length == 0) return false;
	  return new RegExp(' ' + cls + ' ').test(' ' + elem.className + ' ');
	}
	 
	function addClass(ele, cls) {
	  if (!hasClass(ele, cls)) {
	    ele.className = ele.className == '' ? cls : ele.className + ' ' + cls;
	  }
	}
	 
	function removeClass(ele, cls) {
	  if (hasClass(ele, cls)) {
	    var newClass = ' ' + ele.className.replace(/[\t\r\n]/g, '') + ' ';
	    while (newClass.indexOf(' ' + cls + ' ') >= 0) {
	      newClass = newClass.replace(' ' + cls + ' ', ' ');
	    }
	    ele.className = newClass.replace(/^\s+|\s+$/g, '');
	  }
	}
	document.querySelector(".login-button").onclick = function(){
		if (document.getElementById("txtName").value=="")
		{
			//tips.notify('用户名不能为空', 'warning', 200000);
			document.getElementById("txtName").focus();
			return false;
		}else if (document.getElementById("txtPwd").value==""){
			//tips.notify('用户密码不能为空', 'warning', 200);
    		document.getElementById("txtPwd").focus();
    		return false;
		}else{
			addClass(document.querySelector(".login"), "active")
			setTimeout(function(){
				addClass(document.querySelector(".sk-rotating-plane"), "active")
				document.querySelector(".login").style.display = "none"
			},800)

            
			setTimeout(function(){
				removeClass(document.querySelector(".login"), "active")
				removeClass(document.querySelector(".sk-rotating-plane"), "active")
				//document.querySelector(".login").style.display = "block"
				//document.forms["userForm"].submit()
				$.post("../htui/adminlogin.php", $("#form").serialize(), function(data) {
					var rs  = eval('('+data+')');
					if(rs.status==1){
					   window.location.href='../htui/index.php';
					}else{
					   //tips.notify(rs.message, 'danger', 1000);
					   //window.location.reload();
					   window.location.href='../admin.php?msg='+rs.message;
					}
				});
			},2000)
		}
	}
</script>
</body>
</html>