帮我写一个html页面: 页面是左右布局,输入框按钮等靠右边; 页面需要自适应,能够适应pc页面手机页面; 标签名称为文件实验室/账号登录; 两个input框,一个显示输入接收验证码的邮箱在他的右边有一个按钮名称为获取验证码, 第二个input输入框显示输入验证码,他的下方是一个登录按钮; 然后使用ajax技术,将获取到的邮箱账号使用post发送到/admin/等待后端发送验证码,获取验证码的按钮点击后显示60秒后再试期间按钮不能触发; 用户填入验证码后使用post发送到/response/等待后端验证,后端验证通过后跳转到https://www.spacexs.cn,失败则要求重新输入; 字体使用楷体,页面语言是简体中文, 要求点击获取验证码后,按钮文本显示为60秒后再试期间禁用按钮 使用ajax发送请求
时间: 2023-12-06 14:39:56 浏览: 77
三个制作精美的PC端登录页面
5星 · 资源好评率100%
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>文件实验室/账号登录</title>
<style>
body {
font-family: "楷体", serif;
}
.container {
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
padding: 20px;
}
.input-container {
display: flex;
flex-direction: row;
align-items: center;
margin-right: 20px;
width: 50%;
}
input[type="email"],
input[type="text"] {
padding: 10px;
font-size: 16px;
border: none;
border-radius: 5px;
margin-right: 10px;
width: 100%;
}
#get-verification-code-btn,
#login-btn {
padding: 10px;
font-size: 16px;
background-color: #4CAF50;
color: white;
border: none;
border-radius: 5px;
cursor: pointer;
}
#get-verification-code-btn.disabled {
background-color: grey;
cursor: not-allowed;
}
</style>
</head>
<body>
<div class="container">
<h1>文件实验室/账号登录</h1>
<div class="input-container">
<input type="email" placeholder="输入接收验证码的邮箱">
<button id="get-verification-code-btn">获取验证码</button>
</div>
<div class="input-container">
<input type="text" placeholder="输入验证码">
<button id="login-btn">登录</button>
</div>
</div>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script>
var timer;
var countdown = 60;
function disableBtn() {
$('#get-verification-code-btn').addClass('disabled');
$('#get-verification-code-btn').prop('disabled', true);
timer = setInterval(function() {
countdown--;
$('#get-verification-code-btn').text(countdown + '秒后再试');
if (countdown == 0) {
clearInterval(timer);
enableBtn();
}
}, 1000);
}
function enableBtn() {
countdown = 60;
$('#get-verification-code-btn').removeClass('disabled');
$('#get-verification-code-btn').prop('disabled', false);
$('#get-verification-code-btn').text('获取验证码');
}
$(document).ready(function() {
$('#get-verification-code-btn').click(function() {
disableBtn();
var email = $('input[type="email"]').val();
$.ajax({
type: "POST",
url: "/admin/",
data: {email: email},
success: function(response) {
console.log(response);
// handle response
},
error: function(error) {
console.log(error);
}
});
});
$('#login-btn').click(function() {
var verificationCode = $('input[type="text"]').val();
$.ajax({
type: "POST",
url: "/response/",
data: {verificationCode: verificationCode},
success: function(response) {
console.log(response);
if (response == 'success') {
window.location.href = 'https://www.spacexs.cn';
} else {
alert('验证码错误,请重新输入');
}
},
error: function(error) {
console.log(error);
}
});
});
});
</script>
</body>
</html>
阅读全文