Login页面


@{
Layout = null;
}

<!DOCTYPE html>

<html>
<head>
<meta name="viewport" content="width=device-width" />
<title>Login</title>
<script src="~/Content/jquery-3.1.1.js"></script>
<script src="~/Content/yzmJS.js"></script>
<link href="~/Content/yzmStyle.css" rel="stylesheet" />
<style>
* {
margin:0;
padding:0;
}
a {
text-decoration:none;
}
.form {
margin-left: 500px;
margin-top: 150px;
}
ul {
list-style:none;
}
.tiao {
font-size:12px;
margin-left:30px;
}
.Text1 {
width:285px;
height:35px;
margin-top:10px;
border:1px solid #d0cece;

}
.Text2 {
width: 285px;
height: 35px;
margin-top: 20px;
border: 1px solid #d0cece;
}
.Text3 {
height: 35px;
width: 150px;
border: 1px solid #d0cece;
margin-top: 20px;
}
.Checkbox1 {
margin-top: 20px;
}
.ck {
font-size:12px;
}
.password {
margin-left:170px;
font-size:12px;
}
.Button1 {
background-color: #0094ff;
color: white;
width: 285px;
height: 35px;
border: 1px solid #0094ff;
margin-top:20px;
}
.tp {
width: 80px;
height: 35px;
}
.yz {
font-size: 12px;
}
#cuo {
color:red;
font-size:14px;
margin-left:80px;
padding-top:8px;
}
</style>
</head>
<body>
<div class="form">
<span class="head">Hi,欢迎登陆!</span><span class="tiao">还不是金象网会员?<a href="/Login/Add">免费注册</a></span>
<p id="cuo"></p>
<ul>
<li>
<input class="Text1" type="text" placeholder="邮箱/用户名/已验证手机" name="UserName"/>
</li>
<li>
<input class="Text2" type="password" placeholder="密码" name="UserPassword"/>
</li>
<li>
<input class="Text3" type="text" name="Yanz"/>
<input type="button" id="code" onclick="createCode" class="tp"/>
<a href="javascript:void(0)" onclick="createCode" class="yz">看不清,再换一张</a><span id="Yanz"></span>
</li>
<li>
<input class="Checkbox1" type="checkbox" /> <span class="ck">自动登陆</span><span class="password">忘记密码?</span>
</li>
</ul>
<input class="Button1" type="button" value="立即登陆" id="btnAdd"/>
</div>
</body>
</html>
<script>
$(function () {
$("input").focus();
$("[name=UserName]").blur(function () {
$.ajax({
url: "/Login/GetUser?Name=" + $("[name=UserName]").val(),
type: "post",
success: function (data) {
if (data == 0) {
$("#cuo").html("用户名不能存在")
location.href = "/Login/Add"
}
else {
$("#btnAdd").click(function () {
Add();
})
}
}
})
})
$("[name=UserPassword]").blur(function () {
if ($("[name=UserPassword]").val() == "") {
$("#cuo").html("!密码不能为空")
}
else {
$("#cuo").html("")
}
})
})

function Add() {
var oValue = $("[name=Yanz]").val().toUpperCase()
if (oValue == "") {
$("#cuo").html("请输入验证码")
}
else if (oValue != code) {
$("#cuo").html("验证码输入有误")
}
else {
$("#cuo").html("")
$.ajax({
url: "/Login/UserLogin?Name=" + $("[name=UserName]").val() + "&Password=" + $("[name=UserPassword]").val(),
type: "post",
success: function (data) {
if (data > 0) {
location.href="/Login/Updata"
}
else {
$("#cuo").html("密码有误,或用户被冻结")
}
}
})
}

}
</script>

猜你喜欢

转载自www.cnblogs.com/Wangyang11/p/10002913.html