Files
for-test/prototype/index.html
T
nancy 22ce81387e feat: 商户端登录/注册模块 - HTML原型+前端+后端
基于飞书 PRD《【登陆/注册】》实现:
- prototype/: 可交互 HTML 原型(内置 Mock,含三语切换)
- frontend/: 正式前端(原生 HTML/CSS/JS,调用后端 API)
- backend/: Node.js 零依赖后端(验证码冷却/静默注册/IP冻结)
- design/: 飞书白板设计图导出
2026-10-17 23:22:10 +08:00

463 lines
24 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>广汇通 GPX - 商户登录/注册(可交互原型)</title>
<style>
:root {
--primary: #2f54eb;
--text: #333;
--text-light: #999;
--line: #d9d9d9;
--btn-disabled: #c4c6cc;
--danger: #f5222d;
--wechat: #07c160;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
background: #fff; color: var(--text); min-height: 100vh;
display: flex; flex-direction: column;
}
/* ===== 顶部语言切换 ===== */
.topbar { display: flex; justify-content: flex-end; padding: 20px 32px 0; }
.lang-switcher { position: relative; cursor: pointer; user-select: none; }
.lang-current { display: flex; align-items: center; gap: 6px; font-size: 14px; color: #666; }
.lang-current .flag { font-size: 16px; }
.lang-current .arrow { font-size: 10px; color: #999; transition: transform .2s; }
.lang-switcher.open .arrow { transform: rotate(180deg); }
.lang-menu {
display: none; position: absolute; right: 0; top: 28px; z-index: 100;
background: #fff; border: 1px solid #e8e8e8; border-radius: 8px;
box-shadow: 0 4px 16px rgba(0,0,0,.1); padding: 4px; min-width: 150px;
}
.lang-switcher.open .lang-menu { display: block; }
.lang-item { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 6px; font-size: 13px; }
.lang-item:hover { background: #f5f6fa; }
.lang-item.active { color: var(--primary); font-weight: 500; }
/* ===== 主体布局 ===== */
.main { flex: 1; display: flex; justify-content: center; align-items: center; padding: 12px 32px 24px; }
.login-panel { display: flex; align-items: stretch; gap: 48px; width: 760px; max-width: 100%; }
/* 左侧扫码区 */
.qr-area { flex: 1; display: flex; flex-direction: column; justify-content: center; align-items: center; position: relative; }
.qr-area::after { content: ""; position: absolute; right: -24px; top: 12%; bottom: 12%; width: 1px; background: #e8e8e8; }
.qr-logo { width: 170px; height: 170px; opacity: .92; }
.qr-tip { margin-top: 28px; font-size: 15px; color: #555; }
.qr-tip .wx { color: var(--wechat); font-weight: 600; }
.qr-badge {
position: absolute; top: 0; left: 0; width: 100%; height: 100%;
background: rgba(255,255,255,.96); display: none;
flex-direction: column; justify-content: center; align-items: center; gap: 12px;
border-radius: 12px; text-align: center; padding: 20px;
}
.qr-area.show-tip .qr-badge { display: flex; }
.qr-badge .phone-ico { font-size: 40px; }
.qr-badge p { font-size: 13px; color: #666; line-height: 1.8; }
/* 右侧表单区 */
.form-area { flex: 1.2; display: flex; flex-direction: column; justify-content: center; }
.tabs { display: flex; gap: 48px; border-bottom: 1px solid #eee; }
.tab {
padding: 10px 2px 12px; font-size: 17px; color: #666; cursor: pointer;
border-bottom: 3px solid transparent; margin-bottom: -1px; transition: all .2s;
}
.tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.view { display: none; }
.view.active { display: block; animation: fadeIn .25s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px);} to { opacity: 1; transform: none;} }
.field { display: flex; align-items: center; border-bottom: 1px solid var(--line); padding: 14px 2px; margin-top: 18px; transition: border-color .2s; }
.field:focus-within { border-bottom-color: var(--primary); }
.field .prefix { display: flex; align-items: center; gap: 4px; padding-right: 12px; border-right: 1px solid #e5e5e5; margin-right: 12px; cursor: pointer; font-size: 15px; }
.field input { flex: 1; border: none; outline: none; font-size: 15px; background: transparent; color: var(--text); }
.field input::placeholder { color: #bbb; }
.field .suffix-btn { border: none; background: none; color: var(--primary); font-size: 14px; cursor: pointer; white-space: nowrap; }
.field .suffix-btn:disabled { color: #bbb; cursor: not-allowed; }
.btn-login {
width: 100%; margin-top: 32px; padding: 13px 0; border: none; border-radius: 6px;
background: var(--btn-disabled); color: #fff; font-size: 16px; cursor: not-allowed; transition: all .25s;
}
.btn-login.ready { background: var(--primary); cursor: pointer; }
.btn-login.ready:hover { background: #1d39c4; }
.row-links { display: flex; justify-content: flex-end; margin-top: 20px; }
.link-btn { border: none; background: none; color: var(--primary); font-size: 14px; cursor: pointer; padding: 0; }
.center-links { text-align: center; margin-top: 26px; }
/* 协议 */
.agreement { display: flex; align-items: flex-start; gap: 8px; margin-top: 26px; font-size: 12.5px; color: #666; line-height: 1.7; }
.agreement input[type=checkbox] { width: 15px; height: 15px; margin-top: 2px; cursor: pointer; accent-color: var(--primary); flex-shrink: 0; }
.agreement a { color: var(--primary); text-decoration: none; }
.agreement.shake { animation: shake .4s; }
@keyframes shake { 0%,100%{transform:translateX(0)} 25%{transform:translateX(-5px)} 75%{transform:translateX(5px)} }
/* 错误提示行 */
.form-error { color: var(--danger); font-size: 12.5px; margin-top: 12px; min-height: 18px; }
/* 页脚 */
.footer { text-align: center; padding: 14px 20px 18px; font-size: 12px; color: #bbb; line-height: 1.9; }
.footer a { color: #bbb; text-decoration: none; }
.footer a:hover { color: var(--primary); }
/* 全局 Toast */
#toast {
position: fixed; top: 18%; left: 50%; transform: translateX(-50%) translateY(-8px);
background: rgba(0,0,0,.78); color: #fff; font-size: 14px;
padding: 11px 22px; border-radius: 8px; opacity: 0; pointer-events: none;
transition: all .25s; z-index: 999; max-width: 80vw; text-align: center;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
/* 登录成功遮罩 */
#successMask {
display: none; position: fixed; inset: 0; background: rgba(255,255,255,.97); z-index: 500;
flex-direction: column; justify-content: center; align-items: center; gap: 16px;
}
#successMask.show { display: flex; }
#successMask .ok-ico { width: 72px; height: 72px; border-radius: 50%; background: var(--wechat); color: #fff; font-size: 40px; display: flex; align-items: center; justify-content: center; }
#successMask h2 { font-size: 22px; }
#successMask p { color: #888; font-size: 14px; }
@media (max-width: 720px) {
.login-panel { flex-direction: column; gap: 24px; }
.qr-area::after { display: none; }
.qr-logo { width: 120px; height: 120px; }
}
</style>
</head>
<body>
<!-- 顶部语言切换 -->
<div class="topbar">
<div class="lang-switcher" id="langSwitcher">
<div class="lang-current">
<span class="flag" id="langFlag">🇨🇳</span>
<span id="langName">中文(简体)</span>
<span class="arrow">▼</span>
</div>
<div class="lang-menu" id="langMenu"></div>
</div>
</div>
<!-- 主体 -->
<div class="main">
<div class="login-panel">
<!-- 左侧:微信扫码登录(MVP 预留) -->
<div class="qr-area" id="qrArea">
<svg class="qr-logo" viewBox="0 0 100 100" fill="#b9bcC2" xmlns="http://www.w3.org/2000/svg">
<path d="M8 8h32v32H8zm8 8v16h16V16z"/>
<rect x="60" y="8" width="32" height="32" fill="none" stroke="#b9bcc2" stroke-width="8"/>
<rect x="8" y="60" width="32" height="32" fill="none" stroke="#b9bcc2" stroke-width="8"/>
<path d="M60 60h32v32H60zm8 8v16h16V68z"/>
<rect x="44" y="12" width="8" height="26"/>
<rect x="12" y="44" width="26" height="8"/>
<rect x="46" y="46" width="8" height="8"/>
<rect x="62" y="44" width="26" height="4"/>
</svg>
<div class="qr-tip"><span data-i18n="qrOpen">打开</span> <span class="wx">💬微信</span> <span data-i18n="qrScan">扫码登录</span></div>
<div class="qr-badge">
<div class="phone-ico">📱</div>
<p><b data-i18n="wxTitle">微信扫码登录</b><br><span data-i18n="wxReserved">MVP 首期暂不支持,敬请期待</span></p>
</div>
</div>
<!-- 右侧:表单 -->
<div class="form-area">
<div class="tabs">
<div class="tab active" data-view="phone" data-i18n="tabPhone">手机号</div>
<div class="tab" data-view="email" data-i18n="tabEmail">邮箱</div>
<div class="tab" data-view="account" data-i18n="tabAccount" id="tabAccount" style="display:none">账号密码</div>
</div>
<!-- 手机号验证码登录 -->
<div class="view active" id="view-phone">
<div class="field">
<span class="prefix" id="phoneCodeBtn">+86 <small>▲</small></span>
<input type="tel" id="phoneInput" data-i18n-ph="phPhone" placeholder="请输入手机号" maxlength="11">
</div>
<div class="field">
<input type="text" id="phoneCodeInput" data-i18n-ph="phCode" placeholder="输入验证码" maxlength="6">
<button class="suffix-btn" id="phoneSendBtn" data-i18n="getCode">获取验证码</button>
</div>
<div class="form-error" id="phoneError"></div>
<button class="btn-login" id="phoneLoginBtn" data-i18n="login">登录</button>
<div class="center-links">
<button class="link-btn" data-goto="account" data-i18n="toAccount">账号密码登录</button>
</div>
</div>
<!-- 邮箱验证码登录 -->
<div class="view" id="view-email">
<div class="field">
<input type="email" id="emailInput" data-i18n-ph="phEmail" placeholder="邮箱">
</div>
<div class="field">
<input type="text" id="emailCodeInput" data-i18n-ph="phCode" placeholder="输入验证码" maxlength="6">
<button class="suffix-btn" id="emailSendBtn" data-i18n="getCode">获取验证码</button>
</div>
<div class="form-error" id="emailError"></div>
<button class="btn-login" id="emailLoginBtn" data-i18n="login">登录</button>
<div class="center-links">
<button class="link-btn" data-goto="account" data-i18n="toAccount">账号密码登录</button>
</div>
</div>
<!-- 账号密码登录 -->
<div class="view" id="view-account">
<div class="field">
<input type="text" id="accInput" data-i18n-ph="phAccount" placeholder="请输入账号" autocomplete="username">
</div>
<div class="field">
<input type="password" id="pwdInput" data-i18n-ph="phPwd" placeholder="输入密码" autocomplete="current-password">
</div>
<div class="row-links"><button class="link-btn" id="forgotBtn" data-i18n="forgotPwd">忘记密码</button></div>
<div class="form-error" id="accError"></div>
<button class="btn-login" id="accLoginBtn" data-i18n="login">登录</button>
<div class="center-links">
<button class="link-btn" data-goto="phone" data-i18n="toVerify">验证码登录</button>
</div>
</div>
<!-- 协议勾选 -->
<label class="agreement" id="agreementBox">
<input type="checkbox" id="agreeCheck">
<span>
<span data-i18n="agreeLine1">未注册手机号、邮箱验证后自动登录</span><br>
<span data-i18n="agreeLine2a">注册即代表我已阅读并同意</span>
<a href="javascript:void(0)" data-i18n="agreeTos">《服务条款》</a>
<a href="javascript:void(0)" data-i18n="agreePrivacy">《隐私政策》</a>
<span data-i18n="agreeAnd">和</span>
<a href="javascript:void(0)" data-i18n="agreePay">《支付服务协议》</a>
</span>
</label>
</div>
</div>
</div>
<!-- 页脚备案 -->
<div class="footer">
<div>© 2026 <a href="javascript:void(0)">www.gx.gxgcloud.cn</a> <span data-i18n="rights">All Rights Reserved.</span></div>
<div>
<a href="https://beian.miit.gov.cn/" target="_blank">粤ICP备15026742号-4</a> &nbsp;
<a href="https://beian.mps.gov.cn/" target="_blank">粤公网安备 44011302000032号</a>
</div>
<div style="font-size:10.5px;color:#d5d5d5">GRG (HK) CO., LIMITED 牌情参考香港海关 LICENSE FOR OFFSHORE MONEY SERVICE (Section 10, Cap.415)</div>
</div>
<div id="toast"></div>
<!-- 登录成功 -->
<div id="successMask">
<div class="ok-ico">✓</div>
<h2 data-i18n="loginOk">登录成功</h2>
<p id="successDetail"></p>
</div>
<script>
/* ================= 多语言 ================= */
const I18N = {
'zh-CN': {
name: '中文(简体)', flag: '🇨🇳',
tabPhone: '手机号', tabEmail: '邮箱', tabAccount: '账号密码',
phPhone: '请输入手机号', phEmail: '邮箱', phCode: '输入验证码',
phAccount: '请输入账号', phPwd: '输入密码',
getCode: '获取验证码', resend: '{s}s后重发', login: '登录',
toAccount: '账号密码登录', toVerify: '验证码登录', forgotPwd: '忘记密码',
qrOpen: '打开', qrScan: '扫码登录',
agreeLine1: '未注册手机号、邮箱验证后自动登录',
agreeLine2a: '注册即代表我已阅读并同意', agreeTos: '《服务条款》', agreePrivacy: '《隐私政策》', agreeAnd: '和', agreePay: '《支付服务协议》',
rights: 'All Rights Reserved.',
toastAgree: '请先勾选同意《服务条款》《隐私政策》和《支付服务协议》',
toastCodeSent: '验证码已发送,有效期 10 分钟(原型模拟码:{code})',
toastCodeErr: '验证码错误或已过期,请重新获取',
toastSilentReg: '新用户已静默注册并自动登录',
toastLoginOk: '欢迎回来!',
toastAccErr: '无效登录信息,请核对登录信息',
toastFrozen: '该 IP 登录错误次数过多,登录权限已暂停,请联系客服',
toastForgot: '重置密码邮件已发送至您的邮箱,请注意查收',
toastWx: '微信扫码登录 MVP 首期暂不支持,敬请期待',
loginOk: '登录成功', demoUser: '演示账号', newReg: '(新注册用户)',
phoneErr: '请输入正确的手机号', emailErr: '请输入正确的邮箱地址',
wxTitle: '微信扫码登录', wxReserved: 'MVP 首期暂不支持,敬请期待'
},
'zh-TW': {
name: '中文(繁體)', flag: '🇭🇰',
tabPhone: '手機號', tabEmail: '郵箱', tabAccount: '賬號密碼',
phPhone: '請輸入手機號', phEmail: '郵箱', phCode: '輸入驗證碼',
phAccount: '請輸入賬號', phPwd: '輸入密碼',
getCode: '獲取驗證碼', resend: '{s}s後重發', login: '登錄',
toAccount: '賬號密碼登錄', toVerify: '驗證碼登錄', forgotPwd: '忘記密碼',
qrOpen: '打開', qrScan: '掃碼登錄',
agreeLine1: '未註冊手機號、郵箱驗證後自動登錄',
agreeLine2a: '註冊即代表我已閱讀並同意', agreeTos: '《服務條款》', agreePrivacy: '《隱私政策》', agreeAnd: '和', agreePay: '《支付服務協議》',
rights: 'All Rights Reserved.',
toastAgree: '請先勾選同意《服務條款》《隱私政策》和《支付服務協議》',
toastCodeSent: '驗證碼已發送,有效期 10 分鐘(原型模擬碼:{code})',
toastCodeErr: '驗證碼錯誤或已過期,請重新獲取',
toastSilentReg: '新用戶已靜默註冊並自動登錄',
toastLoginOk: '歡迎回來!',
toastAccErr: '無效登錄信息,請核對登錄信息',
toastFrozen: '該 IP 登錄錯誤次數過多,登錄權限已暫停,請聯繫客服',
toastForgot: '重置密碼郵件已發送至您的郵箱,請注意查收',
toastWx: '微信掃碼登錄 MVP 首期暫不支持,敬請期待',
loginOk: '登錄成功', demoUser: '演示賬號', newReg: '(新註冊用戶)',
phoneErr: '請輸入正確的手機號', emailErr: '請輸入正確的郵箱地址',
wxTitle: '微信掃碼登錄', wxReserved: 'MVP 首期暫不支持,敬請期待'
},
'en': {
name: 'English', flag: '🇺🇸',
tabPhone: 'Phone', tabEmail: 'Email', tabAccount: 'Account',
phPhone: 'Enter phone number', phEmail: 'Email', phCode: 'Enter code',
phAccount: 'Enter account', phPwd: 'Enter password',
getCode: 'Get code', resend: 'Resend in {s}s', login: 'Log In',
toAccount: 'Login with account', toVerify: 'Login with code', forgotPwd: 'Forgot password',
qrOpen: 'Open', qrScan: 'WeChat scan to log in',
agreeLine1: 'Unregistered phone/email will auto-register after verification',
agreeLine2a: 'By registering, I have read and agree to', agreeTos: 'Terms of Service', agreePrivacy: 'Privacy Policy', agreeAnd: 'and', agreePay: 'Payment Service Agreement',
rights: 'All Rights Reserved.',
toastAgree: 'Please agree to the Terms, Privacy Policy and Payment Agreement first',
toastCodeSent: 'Code sent, valid for 10 minutes (demo code: {code})',
toastCodeErr: 'Invalid or expired code, please request a new one',
toastSilentReg: 'New account registered & logged in automatically',
toastLoginOk: 'Welcome back!',
toastAccErr: 'Invalid login credentials, please check and retry',
toastFrozen: 'Too many failed attempts from this IP. Login suspended, please contact support',
toastForgot: 'Password reset email has been sent to your mailbox',
toastWx: 'WeChat scan login is not available in MVP, stay tuned',
loginOk: 'Login Successful', demoUser: 'Demo account', newReg: ' (newly registered)',
phoneErr: 'Please enter a valid phone number', emailErr: 'Please enter a valid email address',
wxTitle: 'WeChat Scan Login', wxReserved: 'Not available in MVP, stay tuned'
}
};
let lang = 'zh-CN';
const t = (k) => I18N[lang][k] || k;
function applyLang() {
const L = I18N[lang];
document.getElementById('langFlag').textContent = L.flag;
document.getElementById('langName').textContent = L.name;
document.querySelectorAll('[data-i18n]').forEach(el => el.textContent = t(el.dataset.i18n));
document.querySelectorAll('[data-i18n-ph]').forEach(el => el.placeholder = t(el.dataset.i18nPh));
renderLangMenu();
}
function renderLangMenu() {
const menu = document.getElementById('langMenu');
menu.innerHTML = '';
Object.entries(I18N).forEach(([code, L]) => {
const div = document.createElement('div');
div.className = 'lang-item' + (code === lang ? ' active' : '');
div.innerHTML = `<span>${L.flag}</span><span>${L.name}</span>`;
div.onclick = (e) => { e.stopPropagation(); lang = code; applyLang(); toggleLang(false); };
menu.appendChild(div);
});
}
function toggleLang(force) {
const sw = document.getElementById('langSwitcher');
sw.classList.toggle('open', force !== undefined ? force : !sw.classList.contains('open'));
}
document.getElementById('langSwitcher').addEventListener('click', () => toggleLang());
document.addEventListener('click', (e) => { if (!e.target.closest('#langSwitcher')) toggleLang(false); });
/* ================= Toast ================= */
let toastTimer;
function toast(msg, ms = 2600) {
const el = document.getElementById('toast');
el.textContent = msg; el.classList.add('show');
clearTimeout(toastTimer);
toastTimer = setTimeout(() => el.classList.remove('show'), ms);
}
/* ================= 视图切换 ================= */
const qrArea = document.getElementById('qrArea');
document.querySelectorAll('.tab, [data-goto]').forEach(el => {
el.addEventListener('click', () => switchView(el.dataset.view || el.dataset.goto));
});
function switchView(name) {
document.querySelectorAll('.tab').forEach(x => x.classList.toggle('active', x.dataset.view === name));
document.querySelectorAll('.view').forEach(x => x.classList.toggle('active', x.id === 'view-' + name));
qrArea.style.display = name === 'account' ? 'none' : 'flex'; // 账号密码视图无左侧扫码区
clearErrors();
}
function clearErrors() {
document.querySelectorAll('.form-error').forEach(e => e.textContent = '');
}
/* ================= 通用工具 ================= */
const agreeCheck = document.getElementById('agreeCheck');
function requireAgree(boxId) {
if (agreeCheck.checked) return true;
toast(t('toastAgree'));
const box = document.getElementById(boxId);
box.classList.remove('shake'); void box.offsetWidth; box.classList.add('shake');
return false;
}
function fakeCode() { return String(Math.floor(100000 + Math.random() * 900000)); }
function bindSendBtn(btnId, inputId, errId, getTarget, validate) {
const btn = document.getElementById(btnId);
let timer = null, saved = null;
btn.addEventListener('click', () => {
if (btn.disabled) return;
if (!validate(getTarget())) { document.getElementById(errId).textContent = t(btnId.startsWith('phone') ? 'phoneErr' : 'emailErr'); return; }
if (!requireAgree('agreementBox')) return;
saved = { code: fakeCode(), exp: Date.now() + 10 * 60 * 1000 }; // 10 分钟有效
// 新验证码发出后旧验证码立即失效(模拟:直接覆盖 saved)
toast(t('toastCodeSent').replace('{code}', saved.code), 4200);
let s = 60; btn.disabled = true;
const tick = () => { btn.textContent = t('resend').replace('{s}', s); if (--s > 0) timer = setTimeout(tick, 1000); else { btn.disabled = false; btn.textContent = t('getCode'); } };
tick();
});
return () => saved; // 供登录时读取
}
const getPhoneSaved = bindSendBtn('phoneSendBtn', 'phoneInput', 'phoneError', () => phoneInput.value, v => /^1\d{10}$|^\d{8,11}$/.test(v));
const getEmailSaved = bindSendBtn('emailSendBtn', 'emailInput', 'emailError', () => emailInput.value, v => /^[^@\s]+@[^@\s]+\.[^@\s]+$/.test(v));
function loginOk(user, isNew) {
document.getElementById('successDetail').textContent = t('demoUser') + ': ' + user + (isNew ? t('newReg') : '');
document.getElementById('successMask').classList.add('show');
}
/* ================= 手机号验证码登录 ================= */
phoneLoginBtn.addEventListener('click', () => {
const saved = getPhoneSaved();
if (!/^1\d{10}$|^\d{8,11}$/.test(phoneInput.value)) { phoneError.textContent = t('phoneErr'); return; }
if (!saved || Date.now() > saved.exp || phoneCodeInput.value !== saved.code) { phoneError.textContent = ''; toast(t('toastCodeErr')); return; }
// 验证码正确 → 判断是否已注册(原型:以 138 开头视为已注册)
const isNew = !/^138/.test(phoneInput.value);
loginOk('+86 ' + phoneInput.value, isNew);
toast(isNew ? t('toastSilentReg') : t('toastLoginOk'));
});
/* ================= 邮箱验证码登录 ================= */
emailLoginBtn.addEventListener('click', () => {
const saved = getEmailSaved();
if (!/^[^@\s]+@[^@\s]+\.[^@\s]+$/.test(emailInput.value)) { emailError.textContent = t('emailErr'); return; }
if (!saved || Date.now() > saved.exp || emailCodeInput.value !== saved.code) { toast(t('toastCodeErr')); return; }
const isNew = !emailInput.value.startsWith('demo@');
loginOk(emailInput.value, isNew);
toast(isNew ? t('toastSilentReg') : t('toastLoginOk'));
});
/* ================= 账号密码登录(含 IP 冻结模拟) ================= */
let failCount = 0; const FREEZE_AFTER = 5;
accLoginBtn.addEventListener('click', () => {
if (failCount >= FREEZE_AFTER) { accError.textContent = t('toastFrozen'); return; }
// 演示账号:demo001 / Gpx@2026
if (accInput.value === 'demo001' && pwdInput.value === 'Gpx@2026') { failCount = 0; loginOk('demo001', false); accError.textContent = ''; }
else { failCount++; accError.textContent = failCount >= FREEZE_AFTER ? t('toastFrozen') : t('toastAccErr') + (failCount >= 3 ? `(${failCount}/${FREEZE_AFTER})` : ''); }
});
/* ================= 忘记密码 / 微信扫码 ================= */
forgotBtn.addEventListener('click', () => toast(t('toastForgot')));
qrArea.addEventListener('click', () => { qrArea.classList.add('show-tip'); setTimeout(() => qrArea.classList.remove('show-tip'), 2200); toast(t('toastWx')); });
/* 初始化 */
applyLang();
</script>
</body>
</html>