2026-03-10 12:42:57 +08:00
|
|
|
|
<!DOCTYPE html>
|
|
|
|
|
|
<html lang="zh-CN">
|
|
|
|
|
|
<head>
|
|
|
|
|
|
<meta charset="UTF-8">
|
|
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
|
|
|
|
<title>Persona Studio · 光湖人格体协助开发体验</title>
|
|
|
|
|
|
<link rel="stylesheet" href="style.css">
|
|
|
|
|
|
</head>
|
|
|
|
|
|
<body>
|
|
|
|
|
|
<div class="container login-container">
|
|
|
|
|
|
<div class="logo-area">
|
|
|
|
|
|
<h1>🌊 Persona Studio</h1>
|
|
|
|
|
|
<p class="subtitle">光湖人格体协助开发体验</p>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<div class="login-box">
|
|
|
|
|
|
<h2>请输入你的开发编号</h2>
|
2026-03-10 19:02:52 +08:00
|
|
|
|
<p class="hint">编号由冰朔主控分配,格式:EXP-000 ~ EXP-011</p>
|
2026-03-10 12:42:57 +08:00
|
|
|
|
|
|
|
|
|
|
<form id="loginForm" onsubmit="return handleLogin(event)">
|
|
|
|
|
|
<input
|
|
|
|
|
|
type="text"
|
|
|
|
|
|
id="devIdInput"
|
|
|
|
|
|
placeholder="EXP-XXX"
|
|
|
|
|
|
pattern="^EXP-\d{3,}$"
|
|
|
|
|
|
required
|
|
|
|
|
|
autocomplete="off"
|
|
|
|
|
|
/>
|
|
|
|
|
|
<button type="submit" id="loginBtn">进入对话</button>
|
|
|
|
|
|
</form>
|
|
|
|
|
|
|
2026-03-10 15:18:47 +08:00
|
|
|
|
<div class="guest-divider">
|
|
|
|
|
|
<span>或</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
2026-03-10 19:02:52 +08:00
|
|
|
|
<button id="guestBtn" class="btn-guest" onclick="handleGuestLogin()" disabled>🌊 访客体验模式(暂未开放)</button>
|
|
|
|
|
|
<p class="guest-hint">访客模式暂不可用,正式编号用户可正常登录</p>
|
2026-03-10 15:18:47 +08:00
|
|
|
|
|
2026-03-10 12:42:57 +08:00
|
|
|
|
<div id="errorMsg" class="error-msg" style="display:none;"></div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<footer class="login-footer">
|
|
|
|
|
|
<p>HoloLake Era · AGE OS · 人格体协助体验平台</p>
|
|
|
|
|
|
</footer>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
|
const DEV_ID_RE = /^EXP-\d{3,}$/;
|
|
|
|
|
|
const API_BASE = getApiBase();
|
|
|
|
|
|
|
|
|
|
|
|
function getApiBase() {
|
|
|
|
|
|
if (location.hostname === 'localhost' || location.hostname === '127.0.0.1') {
|
|
|
|
|
|
return 'http://localhost:3002';
|
|
|
|
|
|
}
|
2026-03-10 15:50:53 +08:00
|
|
|
|
return 'https://guanghulab.com';
|
2026-03-10 12:42:57 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
async function handleLogin(e) {
|
|
|
|
|
|
e.preventDefault();
|
|
|
|
|
|
const devId = document.getElementById('devIdInput').value.trim().toUpperCase();
|
|
|
|
|
|
const errorEl = document.getElementById('errorMsg');
|
|
|
|
|
|
const btn = document.getElementById('loginBtn');
|
|
|
|
|
|
|
|
|
|
|
|
errorEl.style.display = 'none';
|
|
|
|
|
|
|
|
|
|
|
|
if (!DEV_ID_RE.test(devId)) {
|
|
|
|
|
|
errorEl.textContent = '编号格式不正确,请输入 EXP-XXX 格式';
|
|
|
|
|
|
errorEl.style.display = 'block';
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
btn.disabled = true;
|
|
|
|
|
|
btn.textContent = '验证中…';
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
2026-03-10 13:15:56 +08:00
|
|
|
|
const res = await fetch(API_BASE + '/api/ps/auth/login', {
|
2026-03-10 12:42:57 +08:00
|
|
|
|
method: 'POST',
|
|
|
|
|
|
headers: { 'Content-Type': 'application/json' },
|
|
|
|
|
|
body: JSON.stringify({ dev_id: devId })
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
const data = await res.json();
|
|
|
|
|
|
|
|
|
|
|
|
if (!res.ok || data.error) {
|
|
|
|
|
|
errorEl.textContent = data.message || '登录失败,请检查编号';
|
|
|
|
|
|
errorEl.style.display = 'block';
|
|
|
|
|
|
btn.disabled = false;
|
|
|
|
|
|
btn.textContent = '进入对话';
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
sessionStorage.setItem('dev_id', devId);
|
|
|
|
|
|
sessionStorage.setItem('session_token', data.token || '');
|
|
|
|
|
|
window.location.href = 'chat.html';
|
|
|
|
|
|
} catch (err) {
|
|
|
|
|
|
errorEl.textContent = '服务暂时不可用,请稍后再试';
|
|
|
|
|
|
errorEl.style.display = 'block';
|
|
|
|
|
|
btn.disabled = false;
|
|
|
|
|
|
btn.textContent = '进入对话';
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
2026-03-10 15:18:47 +08:00
|
|
|
|
|
|
|
|
|
|
async function handleGuestLogin() {
|
|
|
|
|
|
const errorEl = document.getElementById('errorMsg');
|
|
|
|
|
|
const btn = document.getElementById('guestBtn');
|
|
|
|
|
|
errorEl.style.display = 'none';
|
|
|
|
|
|
btn.disabled = true;
|
|
|
|
|
|
btn.textContent = '进入中…';
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
const res = await fetch(API_BASE + '/api/ps/auth/login', {
|
|
|
|
|
|
method: 'POST',
|
|
|
|
|
|
headers: { 'Content-Type': 'application/json' },
|
|
|
|
|
|
body: JSON.stringify({ dev_id: 'GUEST' })
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
const data = await res.json();
|
|
|
|
|
|
|
|
|
|
|
|
if (!res.ok || data.error) {
|
|
|
|
|
|
errorEl.textContent = data.message || '访客体验暂不可用';
|
|
|
|
|
|
errorEl.style.display = 'block';
|
|
|
|
|
|
btn.disabled = false;
|
|
|
|
|
|
btn.textContent = '🌊 访客体验模式';
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
sessionStorage.setItem('dev_id', 'GUEST');
|
|
|
|
|
|
sessionStorage.setItem('session_token', data.token || '');
|
|
|
|
|
|
window.location.href = 'chat.html';
|
|
|
|
|
|
} catch (err) {
|
|
|
|
|
|
errorEl.textContent = '服务暂时不可用,请稍后再试';
|
|
|
|
|
|
errorEl.style.display = 'block';
|
|
|
|
|
|
btn.disabled = false;
|
|
|
|
|
|
btn.textContent = '🌊 访客体验模式';
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2026-03-10 12:42:57 +08:00
|
|
|
|
</script>
|
|
|
|
|
|
</body>
|
|
|
|
|
|
</html>
|