<%--
|
Created by IntelliJ IDEA.
|
User: Lenovo
|
Date: 2024/4/22
|
Time: 9:28
|
To change this template use File | Settings | File Templates.
|
--%>
|
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
|
<html>
|
<head>
|
<title>更改密码</title>
|
<style>
|
.form {
|
background-color: #fff;
|
display: block;
|
padding: 1rem;
|
max-width: 350px;
|
border-radius: 0.5rem;
|
box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
|
}
|
|
.form-title {
|
font-size: 1.25rem;
|
line-height: 1.75rem;
|
font-weight: 600;
|
text-align: center;
|
color: #000;
|
}
|
|
.input-container {
|
position: relative;
|
}
|
|
.input-container input, .form button {
|
outline: none;
|
border: 1px solid #e5e7eb;
|
margin: 8px 0;
|
}
|
|
.input-container input {
|
background-color: #fff;
|
padding: 1rem;
|
padding-right: 3rem;
|
font-size: 0.875rem;
|
line-height: 1.25rem;
|
width: 300px;
|
border-radius: 0.5rem;
|
box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
|
}
|
|
.submit {
|
display: block;
|
padding-top: 0.75rem;
|
padding-bottom: 0.75rem;
|
padding-left: 1.25rem;
|
padding-right: 1.25rem;
|
background-color: #4F46E5;
|
color: #ffffff;
|
font-size: 0.875rem;
|
line-height: 1.25rem;
|
font-weight: 500;
|
width: 100%;
|
border-radius: 0.5rem;
|
text-transform: uppercase;
|
}
|
|
.signup-link {
|
color: #6B7280;
|
font-size: 0.875rem;
|
line-height: 1.25rem;
|
text-align: center;
|
}
|
|
.signup-link a {
|
text-decoration: underline;
|
}
|
</style>
|
</head>
|
<body>
|
<div style="width: 100%;text-align: center;text-align: center;margin: auto;height: 100%">
|
<form class="form" action="javascript:;" style="margin-left: 38.5%;margin-top:15%">
|
<p class="form-title">请填写完整信息进行验证</p>
|
<div class="input-container" id="yz1">
|
<input type="text" id="phone" placeholder="请输入手机号">
|
<span>
|
</span>
|
</div>
|
<div class="input-container" id="yz2" style="">
|
<input type="password" id="yzm" style="width: 45%;float: left;margin-left: 7%" placeholder="请输入验证码">
|
<button id="yzm1" style="cursor:pointer;width: 34%;height: 5.7%;margin-top: 2.5%;border-radius: 5px" onclick="HqYzm()">获取短信验证码</button>
|
</div>
|
<div class="input-container" id="yz5" style="display: none">
|
<input type="text" id="pssword" placeholder="请输入新密码">
|
<span>
|
</span>
|
</div>
|
<button id="yz3" style="cursor:pointer;" type="submit" onclick="Sub()" class="submit">
|
下一步
|
</button>
|
<button id="yz4" style="display: none;cursor:pointer;" type="submit" onclick="Geng()" class="submit">
|
提交
|
</button>
|
<p class="signup-link">
|
在此处根据手机号更改登录密码!
|
</p>
|
</form>
|
</div>
|
</body>
|
<script src="HouTai/Js/jquery-3.5.1.js"></script>
|
<script src="/hxzkuwb/JS/layui.js"></script>
|
<script src="/hxzkuwb/JS/layer.js"></script>
|
<script src="/hxzkuwb/HouTai/Js/notify.js"></script>
|
<script src="/hxzkuwb/HouTai/Js/notify_stand.js"></script>
|
<script>
|
var pdyzm;
|
var sjh;
|
function HqYzm() {
|
var phone = $("#phone").val();
|
if (phone == "" || phone == null) {
|
layer.msg('请先输入手机号后在获取验证码')
|
} else {
|
var data = "phone=" + phone
|
$.get("/hxzkuwb/findPhoneUser", data, function (data) {
|
if (data == "" || data.length == 0) {
|
layer.msg('当前手机号不存在,请重新输入后在获取')
|
} else {
|
//发送验证码
|
var yzm = generateRandomCode();
|
var yzmpd = "";
|
pdyzm = yzm;
|
var data = "phone=" + phone + "&randomNumber=" + yzm;
|
$.ajax({
|
url: "/hxzkuwb/sms",
|
data: data,
|
async: false,
|
success: function (data) {
|
// 处理返回的数据
|
yzms = data;
|
|
}
|
});
|
startCountdown(60)
|
var notify=layui.notify;
|
notify.success('获取成功')
|
}
|
})
|
}
|
}
|
function Geng(){
|
var password = $("#pssword").val();
|
var phone = sjh;
|
var pattern = /^(?=.*[A-Za-z])(?=.*\d)[A-Za-z\d]{8,}$/;
|
if (!pattern.test(password)){
|
flag = false;
|
layer.msg("密码设置必须包含数字和字母并且不能小于8位")
|
}else{
|
var data = "phone="+phone+"&password="+password;
|
$.post("/hxzkuwb/upPassword",data,function (data){
|
if (data == 1){
|
var notify=layui.notify;
|
notify.success("提交成功!即将跳转到登录页面.....")
|
setTimeout(function (){
|
location.href="./index.jsp"
|
},2500)
|
}else{
|
alert("提交失败,请联系管理员!")
|
}
|
})
|
}
|
|
}
|
function Sub(){
|
var phone =$("#phone").val();
|
var yzm =$("#yzm").val();
|
var notify=layui.notify;
|
if (phone == "" || phone.length <11 && phone.length >12){
|
notify.warning("请输入完整的11位手机号");
|
return false;
|
}
|
if (yzm == ""){
|
notify.warning('请输入验证码')
|
return false;
|
}
|
if (yzm != pdyzm){
|
notify.warning('当前输入的验证码不正确,请重新获取')
|
return false;
|
}
|
sjh = phone
|
$("#yz4").fadeIn(1000);
|
$("#yz5").fadeIn(1000);
|
$("#yz1").hide();
|
$("#yz2").hide();
|
$("#yz3").hide();
|
|
}
|
|
function startCountdown(seconds) {
|
var btn = document.getElementById('yzm1');
|
btn.disabled = true;
|
var count = seconds;
|
btn.textContent = count + ' 秒后重新获取';
|
var timer = setInterval(function() {
|
count--;
|
if (count <= 0) {
|
clearInterval(timer);
|
btn.textContent = '获取验证码';
|
btn.disabled = false;
|
} else {
|
btn.textContent = count + ' 秒后重新获取';
|
}
|
}, 1000);
|
}
|
|
function generateRandomCode() {
|
var code = "";
|
var possible = "0123456789"; // 可选的字符集合
|
|
for (var i = 0; i < 4; i++) {
|
// 从字符集合中随机选择一个字符,并添加到验证码中
|
code += possible.charAt(Math.floor(Math.random() * possible.length));
|
}
|
|
return code;
|
}
|
</script>
|
</html>
|