加入验证码弹窗

This commit is contained in:
2025-11-18 10:22:02 +08:00
parent 0b2e07c52c
commit de32939f12

View File

@@ -760,6 +760,162 @@
.none {
display: none;
}
.input-group {
display: flex;
align-items: center;
padding: 0px 5px;
border: 1px solid #ccc;
border-radius: 8px;
margin-bottom: 10px;
}
.area-select {
width: 130px;
font-size: 14px;
color: #333;
cursor: pointer;
}
input {
/* flex: 1; */
border: none;
outline: none;
font-size: 14px;
}
/* 获取验证码按钮 */
.code-btn {
border: 1px solid #1890ff;
background: white;
padding: 5px 12px;
border-radius: 6px;
color: #1890ff;
cursor: pointer;
font-size: 14px;
width: 135px;
}
/* 登录按钮 */
.login-btn {
margin-top: 25px;
width: 100%;
background: #1890ff;
color: white;
padding: 12px 0;
border-radius: 10px;
border: none;
font-size: 17px;
cursor: pointer;
}
/* 协议 */
.agreement {
margin-top: 15px;
font-size: 12px;
color: #777;
display: flex;
align-items: center;
gap: 6px;
}
/* 微信登录 */
.wechat-login {
text-align: center;
font-size: 14px;
color: #555;
cursor: pointer;
}
.wechat-login>div {
display: flex;
justify-content: center;
align-items: center;
gap: 2px;
}
.wechat-login img {
width: 38px;
display: block;
margin: 0 auto 5px;
}
/* 区号选择框 */
.mask {
display: none;
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(0, 0, 0, 0.4);
}
.area-box {
background: #fff;
position: absolute;
bottom: 0;
width: 100%;
max-height: 300px;
overflow-y: auto;
border-radius: 10px 10px 0 0;
}
.area-item {
padding: 15px;
border-bottom: 1px solid #eee;
font-size: 16px;
cursor: pointer;
}
.area-item:hover {
background: #f5f5f5;
}
.toggle-eye {
position: absolute;
right: 10px;
top: 10px;
}
.link {
color: #1677ff;
cursor: pointer;
}
.wechat-login {
display: flex;
justify-content: space-between;
font-size: 12px;
color: #666;
margin-bottom: 10px;
}
.wechat-login span:nth-child(1) {
margin-right: 8px;
}
.popbox {
position: fixed;
top: 0px;
left: 0px;
width: 100%;
height: 100%;
display: flex;
justify-content: center;
align-items: center;
background-color: rgba(0, 0, 0, 0.4);
z-index: 999999;
}
#sms-form {
background-color: #fff;
border-radius: 8px;
padding: 10px;
}
</style>
<style>
body {
@@ -812,6 +968,10 @@
border: 1px solid #ccc;
}
input {
border: none;
}
.options {
display: flex;
flex-wrap: wrap;
@@ -1728,6 +1888,53 @@
renderMessages([chat[0].messages], true);
renderChatList('new');
}
function getSms() {
let remainSeconds = 60;
let countTimer = setInterval(() => {
if (remainSeconds > 0) {
remainSeconds--;
document.getElementById('send-code').textContent = `${remainSeconds}s`;
document.getElementById('send-code').disabled = true;
} else {
clearInterval(countTimer);
document.getElementById('send-code').textContent = "获取验证码";
document.getElementById('send-code').disabled = false;
}
}, 1000)
}
// showpop();
function showpop() {
let html = `<div class='popbox'>
<div class="form sms-form" id="sms-form">
<h2 style='margin:0px'>欢迎使用AI智能体</h2>
<p style='color:#666;margin:13px 0px;'>请先绑定手机号</p>
<div class="input-group">
<div class="area-select" onclick="showAreaSelect()">
<span id="areaText">中国大陆 +86</span>
</div>
<input id="sys-phone" type="text" placeholder="请输入手机号">
</div>
<!-- 验证码登录 -->
<div id="codeLogin" class="input-group">
<input id="code" type="text" placeholder="请输入验证码">
<button class="code-btn" id="send-code" onclick="getSms()">获取验证码</button>
</div>
<div class="form-group">
<button type="button" class="button button-primary" id="sms-button">
<!-- <i class="fas fa-user-plus mr-2"></i> -->
绑定
</button>
</div>
</div></div>`;
document.body.insertAdjacentHTML('beforeend', html);
}
function switchChat(id) {
activeChatId = id;