Initial commit: 投注游戏平台初始化
This commit is contained in:
Executable
+80
@@ -0,0 +1,80 @@
|
||||
<?php use App\Core\I18n; I18n::init(); $t = function($k,$p=[]){return I18n::t($k,$p);}; ?>
|
||||
<!DOCTYPE html><html lang="<?=I18n::getLang()?>">
|
||||
<head><meta charset="UTF-8"><meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<title>PK10 - <?=$t('login_title')?></title>
|
||||
<link rel="stylesheet" href="/Static/css/app.css">
|
||||
<style>
|
||||
body{background:linear-gradient(135deg,#E8F4F8,#F0F0F0);min-height:100vh;display:flex;align-items:center;justify-content:center;padding:16px}
|
||||
.auth-card{background:#fff;border-radius:24px;padding:32px 24px;box-shadow:0 8px 32px rgba(0,0,0,.1);width:100%;max-width:400px}
|
||||
.auth-tabs{display:flex;background:#F5F5F5;border-radius:12px;padding:4px;margin-bottom:24px}
|
||||
.auth-tab{flex:1;padding:10px;text-align:center;border-radius:10px;font-size:14px;font-weight:600;color:var(--text3);cursor:pointer;transition:all .2s;border:none;background:none}
|
||||
.auth-tab.active{background:var(--primary);color:#fff;box-shadow:0 2px 8px rgba(30,144,255,.3)}
|
||||
.auth-input{width:100%;padding:14px 16px;background:#F8F9FA;border:1px solid var(--border);border-radius:12px;font-size:14px;color:var(--text);outline:none;transition:border .2s}
|
||||
.auth-input:focus{border-color:var(--primary);background:#fff;box-shadow:0 0 0 3px rgba(30,144,255,.1)}
|
||||
.auth-input::placeholder{color:#bbb}
|
||||
.auth-btn{width:100%;padding:14px;border:none;border-radius:12px;font-size:15px;font-weight:700;cursor:pointer;transition:all .2s}
|
||||
.auth-btn-login{background:linear-gradient(135deg,var(--primary),var(--primary-dark));color:#fff}
|
||||
.auth-btn-login:hover{transform:translateY(-1px);box-shadow:0 4px 16px rgba(30,144,255,.35)}
|
||||
.auth-btn-reg{background:linear-gradient(135deg,var(--success),#388E3C);color:#fff}
|
||||
.auth-btn-reg:hover{transform:translateY(-1px);box-shadow:0 4px 16px rgba(76,175,80,.35)}
|
||||
.lang-bar{display:flex;justify-content:center;gap:6px;margin-bottom:16px}
|
||||
.lang-btn{padding:4px 10px;border-radius:16px;font-size:11px;text-decoration:none;transition:all .2s}
|
||||
.lang-btn.active{background:var(--primary);color:#fff}
|
||||
.lang-btn:not(.active){background:#fff;color:var(--text3);border:1px solid var(--border)}
|
||||
.code-row{display:flex;gap:8px}
|
||||
.code-btn{padding:14px 16px;background:rgba(30,144,255,.1);color:var(--primary);border:none;border-radius:12px;font-size:13px;white-space:nowrap;cursor:pointer;font-weight:600}
|
||||
.remember-row{display:flex;align-items:center;gap:6px;font-size:13px;color:var(--text2)}
|
||||
#msg{margin-top:12px;text-align:center;font-size:13px}
|
||||
.msg-ok{color:var(--success)}.msg-err{color:var(--danger)}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div style="width:100%;max-width:400px">
|
||||
<div class="lang-bar">
|
||||
<?php foreach(I18n::LANGUAGES as $code=>$name): ?>
|
||||
<a href="?lang=<?=$code?>" class="lang-btn <?=I18n::getLang()===$code?'active':''?>"><?=$name?></a>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<div class="auth-card">
|
||||
<div style="text-align:center;margin-bottom:20px">
|
||||
<svg width="48" height="48" viewBox="0 0 24 24" fill="none" stroke="#1E90FF" stroke-width="2"><circle cx="7" cy="17" r="2"/><circle cx="17" cy="17" r="2"/><path d="M5 17H3v-4l2-5h9l4 5h3v4h-2"/><path d="M5 12h14"/></svg>
|
||||
<h1 style="font-size:22px;font-weight:800;color:#1E90FF;margin:4px 0">PK10</h1>
|
||||
<p style="font-size:12px;color:var(--text3)"><?=$t('app_name')?></p>
|
||||
</div>
|
||||
<div class="auth-tabs">
|
||||
<button onclick="showTab('login')" id="tabLogin" class="auth-tab active"><?=$t('login')?></button>
|
||||
<button onclick="showTab('register')" id="tabRegister" class="auth-tab"><?=$t('register')?></button>
|
||||
</div>
|
||||
<form id="loginForm" onsubmit="return doLogin(event)">
|
||||
<div class="space-y-4">
|
||||
<input type="text" id="loginUser" placeholder="<?=$t('username')?>" required class="auth-input">
|
||||
<input type="password" id="loginPass" placeholder="<?=$t('password')?>" required class="auth-input">
|
||||
<label class="remember-row"><input type="checkbox" id="loginRemember"> <?=$t('remember_me')?></label>
|
||||
<button type="submit" class="auth-btn auth-btn-login"><?=$t('login')?></button>
|
||||
</div>
|
||||
</form>
|
||||
<form id="registerForm" class="hidden" onsubmit="return doRegister(event)">
|
||||
<div class="space-y-4">
|
||||
<input type="text" id="regUser" placeholder="<?=$t('username')?>" required class="auth-input">
|
||||
<input type="email" id="regEmail" placeholder="<?=$t('email')?>" required class="auth-input">
|
||||
<div class="code-row">
|
||||
<input type="text" id="regCode" placeholder="<?=$t('verify_code')?>" required class="auth-input" style="flex:1">
|
||||
<button type="button" onclick="sendCode()" id="sendCodeBtn" class="code-btn"><?=$t('send_code')?></button>
|
||||
</div>
|
||||
<input type="password" id="regPass" placeholder="<?=$t('password')?>" required class="auth-input">
|
||||
<input type="password" id="regPass2" placeholder="<?=$t('confirm_password')?>" required class="auth-input">
|
||||
<input type="text" id="regInvite" placeholder="<?=$t('invite_code_optional')?>" class="auth-input">
|
||||
<button type="submit" class="auth-btn auth-btn-reg"><?=$t('register')?></button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div id="msg" class="hidden"></div>
|
||||
</div>
|
||||
<script>
|
||||
function showTab(t){document.getElementById('loginForm').classList.toggle('hidden',t!=='login');document.getElementById('registerForm').classList.toggle('hidden',t!=='register');document.getElementById('tabLogin').className='auth-tab '+(t==='login'?'active':'');document.getElementById('tabRegister').className='auth-tab '+(t==='register'?'active':'');}
|
||||
function showMsg(m,ok){const e=document.getElementById('msg');e.textContent=m;e.className='mt-2 text-center text-sm '+(ok?'msg-ok':'msg-err');}
|
||||
async function doLogin(e){e.preventDefault();const r=await fetch('/api/auth/login',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({username:document.getElementById('loginUser').value,password:document.getElementById('loginPass').value,remember:document.getElementById('loginRemember').checked})});const d=await r.json();if(d.success)window.location.href=d.redirect||'/';else showMsg(d.message,false);return false;}
|
||||
async function doRegister(e){e.preventDefault();const r=await fetch('/api/auth/register',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({username:document.getElementById('regUser').value,email:document.getElementById('regEmail').value,verify_code:document.getElementById('regCode').value,password:document.getElementById('regPass').value,confirm_password:document.getElementById('regPass2').value,invite_code:document.getElementById('regInvite').value})});const d=await r.json();showMsg(d.message,d.success);if(d.success)setTimeout(()=>showTab('login'),1500);return false;}
|
||||
let cdTimer=0;async function sendCode(){if(cdTimer>0)return;const email=document.getElementById('regEmail').value;if(!email){showMsg('Enter email',false);return;}const r=await fetch('/api/auth/send-code',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({email})});const d=await r.json();showMsg(d.message,d.success);if(d.success){cdTimer=60;const btn=document.getElementById('sendCodeBtn');const tick=setInterval(()=>{cdTimer--;btn.textContent=cdTimer+'s';if(cdTimer<=0){clearInterval(tick);btn.textContent='<?=$t('send_code')?>';cdTimer=0;}},1000);}}
|
||||
</script>
|
||||
</body></html>
|
||||
Reference in New Issue
Block a user