You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

150 lines
5.7 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<title>登录页面</title>
<link rel="stylesheet" type="text/css" href="__CSS__/index.css">
<link rel="stylesheet" type="text/css" href="__CSS__/iconfont.css">
<script src="__JS__/jquery-1.11.1.min.js" ></script>
<script src="__STATIC__/layer/layer.js" type="text/javascript"></script>
<script src="__STATIC__/jquery.validate.min.js" type="text/javascript"></script>
<script src="__JS__/common.js"></script>
<link href="{:get_cover(C('MB_SITE_ICON'),'path')}" type="image/x-icon" rel="shortcut icon">
</head>
<body>
<style>
.logintext .form-group {position:relative;}
.logintext .input-status {
position: absolute;left:0;
padding: 0 0 0 15px;bottom:-10px;
}
.logintext .input-status .error {
background: url(__IMG__/error.png) left center no-repeat;
background-size: auto 90%;
color: #f11;
padding-left: 20px;
}
.logintext .input-status .success {
background: url(__IMG__/success.png) left center no-repeat;
background-size: auto 90%;
color: #19bc9c;
}
.logintext .has-success~.input-status {left:auto;right:-90px;bottom:25px;}
</style>
<div class="login jssearch">
<div class="loginbox">
</div>
<div class="logintext">
<div class="login-h5">
<h1>手游商务专员后台</h1>
</div>
<form id="loginForm" action="{:U('Index/login')}" method="POST">
<div class="loginput">
<div class="form-group">
<div class="input-group input-format">
<i class="iconfont icon-user" style="color:#878A8A;"></i>
<input type="text" name="username" class="login-input" id="username" maxlength="15" placeholder="请输入管理员账号">
</div>
<div class="input-status"></div>
</div>
<div class="form-group">
<div class="input-group input-format">
<i class="iconfont icon-pwd" style="color:#878A8A;"></i>
<input type="password" name="password" id="password" class="login-input" placeholder="请输入密码" onkeyup="if (event.keyCode == 13) login();" maxlength="30">
</div>
<div class="input-status"></div>
</div>
<div class="form-group">
<div class="input-group input-format">
<i class="iconfont icon-key" style="color:#878A8A;"></i>
<input type="text" name="registerRandum" id="p_registerRandum" class="login-input-random" ajaxurl="kyunmember/checkIsrandCode.action" nullmsg="请输入图片验证码" errormsg="请输入3-4位验证码" datatype="*3-4" placeholder="请输入验证码">
<img class="verifyimg reloadverify" style="margin-left: 10px;margin-top: 13px;vertical-align: bottom;position: absolute;" width="90" height="45" title="点击切换" alt="验证码" src="{:U('Index/verify')}">
</div>
<div class="input-status"></div>
</div>
<div class="form-group">
<input type="submit" class="kylogin" value="登录">
<!-- <input type="submit" name="" value="登录"> -->
</div>
</div>
</form>
</div>
</div>
</body>
</html>
<script type="text/javascript">
$(document).ready(function(){
var verifyimg = $(".verifyimg").attr("src");
$(".reloadverify").click(function(){
if( verifyimg.indexOf('?')>0){
$(".verifyimg").attr("src", verifyimg+'&random='+Math.random());
}else{
$(".verifyimg").attr("src", verifyimg.replace(/\?.*$/,'')+'?'+Math.random());
}
});
$("#loginForm").validate({
rules:{
username:{
required:true,
rangelength:[6,15],
remote:{
url: "{:U('Index/checkAccount')}", //后台处理程序
type: "post", //数据发送方式
data: {username:function() {return $("#username").val();}}
}
},
password:{
required:true,
rangelength:[6,30],
},
registerRandum:{
required:true,
}
},
messages:{
username:{
required:"请输入管理员账号",
rangelength:"账号必须是6~15位字符串",
remote:"账号不存在或被禁用",
},
password:{
required:"请输入密码",
rangelength:"密码必须是6~30位字符串",
},
registerRandum:{
required:"请输入验证码",
}
},
submitHandler:function(form){
var account = $.trim($('.login-input').val());
var pwd = $.trim($("input[name='password']").val());
var code = $.trim($('.login-input-random').val());
$.ajax({
type:"POST",
url:"{:U('login')}",
data:{account:account,pwd:pwd,code:code},
dataType:"json",
success:function(res){
if(res.status==1){
layer.msg('登录成功', {icon: 1,});
setTimeout(function(){
window.location.href="{:U('Buydetail/summary')}";
},1500);
}else{
layer.msg(res.msg, {icon: 2,})
$(".verifyimg").attr("src", verifyimg+'&random='+Math.random());
}
},
error:function(XMLHttpRequest, textStatus, errorThrown){
alert(textStatus);
alert(XMLHttpRequest.readyState);
}
})
}
});
})
</script>