Parcourir la source

web 忘记密码

西昌分支
yxq il y a 4 mois
Parent
révision
aea2319291
2 fichiers modifiés avec 362 ajouts et 14 suppressions
  1. +145
    -14
      Learun.Framework.Ultimate V7/Learun.Application.Web/Views/Login/ForgotPassword.cshtml
  2. +217
    -0
      Learun.Framework.Ultimate V7/Learun.Application.Web/Views/Login/ForgotPassword.js

+ 145
- 14
Learun.Framework.Ultimate V7/Learun.Application.Web/Views/Login/ForgotPassword.cshtml Voir le fichier

@@ -1,18 +1,149 @@

@{
Layout = null;
}

<!DOCTYPE html>
<html>
<!DOCTYPE html>
<html lang="zh-cn">
<head>
<title>ForgotPassword</title>
<meta name=”renderer” content=”webkit|ie-comp|ie-stand” />
<meta name="viewport" content="width=device-width" />
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta http-equiv="X-UA-Compatible" content="chrome=1,IE=edge">

<link rel="icon" href="~/favicon.ico">
<title>数字化校园 - 登录页面</title>
<style>
/* for Chrome */
body::-webkit-scrollbar {
display: none;
}

.lr-login-logo .lr-login-title:before {
background-color: transparent !important
}

.lr-login-footer .OnlineUserNumBox {
float: right;
}

.lr-login-footer > p {
width: 880px;
margin: auto;
}

.tips {
position: absolute;
left: 50%;
bottom: 35px;
color: #fff;
font-size: 13px;
margin-left: -91px;
}

.tips > * {
display: inline-block;
vertical-align: middle;
}

.tips img {
margin-right: 8px
}

.titleImg {
border: none !important;
}

.titleImg img {
width: 35px !important;
}

.wxLogin {
color: #53b947 !important;
}

.titleImg {
color: #da9835 !important;
}

.wxLogin img {
width: 35px !important;
top: -2px;
}

.downBox {
width: 100%;
height: 60px;
/*background: red;*/
position: absolute;
bottom: -40px;
right: 0 color:#fff !important;
}

.downBox a {
color: #fff !important;
border: 1px solid #fff
}

.codeBtn {
border: 1px solid #DCDFE6;
padding: 6px 10px;
color: #606266;
font-size: 12px;
cursor: pointer;
border-radius: 2px;
position: absolute;
left: 260px;
top: 10px;
}

.codeBtn:hover {
border-color: #CBCFD5;
}
</style>
</head>

<body>
ForgotPassword
@Html.AppendCssFile("/Views/Login/Default/Index.css")
<link href="~/Content/css/process.css" rel="stylesheet" />
<!-- <img src="~/Content/images/Logins/loginBg.jpg" /> -->
<input id="errornum" type="hidden" value="@ViewBag.errornum" />
<div class="lr-login-body">
<div class="lr-login-logo">
<div class="lr-login-title" style="left: 0%;margin-left: 0;width: 100%;text-align: center;">
<img src="/Content/images/logins/login4.png" alt="">
</div>
</div>
<div class="lr-login-middle" style="height:480px">
<img src="~/Content/images/logins/login2.png" />
<!--修改密码框-->
<div class="lr-login-main lr-login-normal" id="updatepwBox">
<!--表单-->
<div class="lr-login-bypsw">
<div class="error_info">*&nbsp;<span></span></div>
<div class="lr-login-input">
<img class="inp_icon" src="~/Content/images/Login/default_account0.png" alt=""> <input id="phone" type="text" placeholder="请输入手机号">
</div>
<div class="lr-login-input">
<img class="inp_icon" src="~/Content/images/Login/default_psw0.png" alt=""><input id="newpassword" type="password" placeholder="请输入新密码">
<span id="psw_change" class="psw_change"></span>
</div>
<div class="lr-login-input">
<img class="inp_icon" src="~/Content/images/Login/default_psw0.png" alt=""><input id="newpassword1" type="password" placeholder="请再次输入新密码">
<span id="psw_change" class="psw_change"></span>
</div>
<div class="lr-login-input">
<img class="inp_icon" src="~/Content/images/Login/default_psw0.png" alt=""><input id="verifycode" type="text" placeholder="验证码">
<span id="sendCode" class="codeBtn">发送验证码</span>
</div>
<div class="lr-login-btn" id="confirmUpdate"><span>确认</span></div>
</div>
</div>
<a href="Javascript:void(0)" id="goLogin" class="down titleImg" title="去登陆">
<img src="~/Content/images/LoginPage/title.jpg" alt="" /> <span>去登陆</span>
</a>
</div>
</div>
<img id="loginFoot" src="~/Content/images/logins/login1.png" alt="">
<script src="~/Content/jquery/jquery-1.10.2.min.js"></script>
<script src="~/Content/jquery/jquery.md5.min.js"></script>
<script src="~/Content/jquery/qrcode.min.js"></script>
<script src="~/Content/jquery/plugin/layer/layer.js"></script>
@Html.AppendJsFile("/Views/Login/ForgotPassword.js")
</body>
</html>
<script src="~/Content/jquery/jquery-1.10.2.min.js"></script>
<script type="text/javascript">
</script>
</html>

+ 217
- 0
Learun.Framework.Ultimate V7/Learun.Application.Web/Views/Login/ForgotPassword.js Voir le fichier

@@ -0,0 +1,217 @@
/*!
* 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园(http://www.learun.cn)
* Copyright (c) 2013-2018 北京泉江科技有限公司
* 创建人:陈彬彬
* 日 期:2017.03.08
* 描 述:登录页面前端脚本
*/
(function ($) {
"use strict";
var codeType = 'forgetpwd', hasSendCode = false, time = 0, timeT = '', isSending = false;
var lrPage = {
init: function () {
lrPage.bind();
},
bind: function () {
// 去登陆
$('#goLogin').click(function () {
window.location.href = "/";
})

// 确认修改按钮
$("#confirmUpdate").on('click', function () {
lrPage.confirmUpdate();
});

// 发送验证码事件
$("#sendCode").on('click', function () {
lrPage.sendCode();
});

$('.psw_change').css({
'background': 'url(' + '/Content/images/Login/psw0.png) no-repeat center center'
});

//点击密码icon 显示/隐藏
$('.psw_change').click(function (event) {
var event = event || window.event;
event.stopPropagation();
var $this = $(this);
$this.toggleClass('psw_show');
//如果当前隐藏 变显示
if ($this.hasClass('psw_show')) {
$this.css({
'background': 'url(' + '/Content/images/Login/psw1.png) no-repeat center center'
});
$this.prev().attr('type', 'text');
} else {
$this.css(
'background', 'url(/Content/images/Login/psw0.png) no-repeat center center'
);
$this.prev().attr('type', 'password');
}
});
},
updating: function (isShow) {
if (isShow) {
$('#updatepwBox input').attr('disabled', 'disabled');
$("#confirmUpdate").addClass('active').attr('disabled', 'disabled').find('span').hide();
$("#confirmUpdate").css('background', '#eeecec url(/Content/images/Login/loading.gif) no-repeat center 10px');

}
else {
$('#updatepwBox input').removeAttr('disabled');
$("#confirmUpdate").removeClass('active').removeAttr('disabled').find('span').show();
$("#confirmUpdate").css('background', '#268fe2');
}
},
sendCode: function () {
if (isSending || hasSendCode) return;
let phone = $('#phone').val()
if (!phone) {
$('#updatepwBox .error_info span').text('请输入手机号')
$('#updatepwBox .error_info').show()
return
} else if (!/^1[0-9]{10}$/.test(phone)) {
$('#updatepwBox .error_info span').text('手机号格式不正确')
$('#updatepwBox .error_info').show()
return
}
$('#updatepwBox .error_info').hide()
isSending = true
$.ajax({
url: "/Login/Sendcode",
data: { phone, codeType },
dataType: 'json',
type: "post",
success: (res) => {
isSending = false;
if (res.code == 200) {
$('#updatepwBox .error_info span').text('短信已发送')
$('#updatepwBox .error_info').show()

hasSendCode = true
time = 60
$('#sendCode').text(`重新发送(${time}s)`)
timeT = setInterval(() => {
time--
if (time == 0) {
hasSendCode = false
clearInterval(timeT)
timeT = ''
}
$('#sendCode').text(`重新发送${time ? '(' + time + 's' + ')' : ''}`)
}, 1000);
} else {
$('#updatepwBox .error_info span').text(res.info)
$('#updatepwBox .error_info').show()
}
}
});
},
checkverifycode: function () {
return new Promise((resolve) => {
let verifycode = $('#verifycode').val()
let phone = $('#phone').val()
if (!verifycode) {
$('#updatepwBox .error_info span').text('请输入验证码')
$('#updatepwBox .error_info').show()
resolve(false)
return
}
$('#updatepwBox .error_info').hide()
$.ajax({
url: "/Login/LoginCodeVerify",
data: { phone, verifycode, codeType },
dataType: 'json',
type: "post",
success: (res) => {
if (res.code == 200) {
resolve(true)
} else {
$('#updatepwBox .error_info span').text(res.info)
$('#updatepwBox .error_info').show()
resolve(false)
}
},
error: () => {
$('#updatepwBox .error_info span').text('验证码校验失败')
$('#updatepwBox .error_info').show()
resolve(false)
}
});
})
},
confirmUpdate: async function () {
let phone = $('#phone').val()
let verifycode = $('#verifycode').val()
let newpassword = $('#newpassword').val()
let newpassword1 = $('#newpassword1').val()
if (!phone) {
$('#updatepwBox .error_info span').text('请输入手机号')
$('#updatepwBox .error_info').show()
return
} else if (!/^1[0-9]{10}$/.test(phone)) {
$('#updatepwBox .error_info span').text('手机号格式不正确')
$('#updatepwBox .error_info').show()
return
}

if (!newpassword) {
$('#updatepwBox .error_info span').text('请输入新密码')
$('#updatepwBox .error_info').show()
return
}
if (!/^(?=.*[0-9])(?=.*[A-Z])(?=.*[a-z])(?=.*[!@#$%^&*,\.])[0-9a-zA-Z!@#$%^&*,\.]{8,20}$/.test(newpassword)) {
$('#updatepwBox .error_info span').text('您的密码不满足强度要求,请重新输入')
$('#updatepwBox .error_info').show()
return
}
if (!newpassword1) {
$('#updatepwBox .error_info span').text('请再次输入新密码')
$('#updatepwBox .error_info').show()
return
}
if (newpassword != newpassword1) {
$('#updatepwBox .error_info span').text('两次密码输入不一致')
$('#updatepwBox .error_info').show()
return
}

if (!verifycode) {
$('#updatepwBox .error_info span').text('请输入验证码')
$('#updatepwBox .error_info').show()
return
}
$('#updatepwBox .error_info').hide()
lrPage.updating(true);
let codeRes = await lrPage.checkverifycode()
if (!codeRes) {
lrPage.updating(false);
return
}
$.ajax({
url: "/Login/ForgotPasswordHandle",
data: { phone, codeType, newpassword },
dataType: 'json',
type: "post",
success: (res) => {
if (res.code == 200) {
$('#updatepwBox .error_info span').text('修改密码成功')
$('#updatepwBox .error_info').show()
setTimeout(() => {
window.location.href = "/";
},1500)
} else {
lrPage.updating(false);
$('#updatepwBox .error_info span').text(res.info)
$('#updatepwBox .error_info').show()
}
}
});
}
};
$(function () {
lrPage.init();
});
})(window.jQuery)

Chargement…
Annuler
Enregistrer