官网首页:去掉 YUSEN 小标、右上角登录/注册、进入游戏走登录闸、补 favicon;补充 game_base 菜单图标与 yt_world 沙盘记忆模块
This commit is contained in:
+40
-20
@@ -7,6 +7,9 @@
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
||||
<link href="https://fonts.googleapis.com/css2?family=Press+Start+2P&family=ZCOOL+QingKe+HuangYou&family=Noto+Sans+SC:wght@300;400;500;700&display=swap" rel="stylesheet" />
|
||||
<link rel="icon" type="image/png" sizes="48x48" href="assets/ui/logo_planet_48.png?v=20260723">
|
||||
<link rel="icon" type="image/png" sizes="256x256" href="assets/ui/logo_planet_256.png?v=20260723">
|
||||
<link rel="apple-touch-icon" href="assets/ui/logo_planet_256.png?v=20260723">
|
||||
<style>
|
||||
:root{
|
||||
--bg-0:#080c1a; --bg-1:#0e1730; --bg-2:#15213f;
|
||||
@@ -45,6 +48,10 @@
|
||||
.user-box .ub-name{color:#fff;font-weight:500;}
|
||||
.user-box .ub-logout{font-family:inherit;font-size:12px;color:var(--text-dim);background:rgba(255,255,255,.06);border:1px solid var(--card-bd);padding:5px 12px;border-radius:8px;cursor:pointer;transition:.2s;}
|
||||
.user-box .ub-logout:hover{color:#fff;background:rgba(139,92,246,.18);}
|
||||
.user-box .auth-link{color:var(--text-dim);text-decoration:none;font-size:14px;transition:.2s;padding:5px 8px;}
|
||||
.user-box .auth-link:hover{color:#fff;}
|
||||
.user-box .auth-btn{font-family:inherit;font-size:13px;color:#0b1020;background:linear-gradient(120deg,var(--gold),#f0d49a);border:none;padding:6px 16px;border-radius:20px;cursor:pointer;font-weight:600;transition:.2s;}
|
||||
.user-box .auth-btn:hover{filter:brightness(1.1);box-shadow:0 0 16px rgba(231,184,92,.4);}
|
||||
.cta:hover{filter:brightness(1.08);}
|
||||
|
||||
.content{flex:1;position:relative;overflow:hidden;}
|
||||
@@ -178,7 +185,7 @@
|
||||
<body>
|
||||
<div class="app">
|
||||
<header class="topbar">
|
||||
<div class="logo"><span class="cn">宇森</span><span class="en">YUSEN</span></div>
|
||||
<div class="logo"><span class="cn">宇森</span></div>
|
||||
<nav class="nav">
|
||||
<button data-tab="intro" class="active">介绍</button>
|
||||
<button data-tab="codex">图鉴</button>
|
||||
@@ -540,31 +547,44 @@
|
||||
// ============ 登录态 / 右上角个人信息(从 Odoo 取) ============
|
||||
(function(){
|
||||
const userBox = document.getElementById('userBox');
|
||||
async function refreshUserBox(){
|
||||
let cachedMe = null;
|
||||
|
||||
function renderLoggedOut(){
|
||||
if(!userBox) return;
|
||||
userBox.innerHTML = '<a href="login.html?next=world.html" class="auth-link">登录</a><a href="login.html?next=world.html" class="auth-btn">注册</a>';
|
||||
}
|
||||
|
||||
function renderLoggedIn(me){
|
||||
if(!userBox) return;
|
||||
userBox.innerHTML = '<span class="ub-name"></span><button class="ub-logout" id="ubLogout">退出</button>';
|
||||
const nm = userBox.querySelector('.ub-name');
|
||||
if(nm) nm.textContent = me.name || me.login;
|
||||
const lb = document.getElementById('ubLogout');
|
||||
if(lb) lb.addEventListener('click', async ()=>{
|
||||
try { await API.logout(); } catch(e){}
|
||||
location.href = 'index.html';
|
||||
});
|
||||
}
|
||||
|
||||
async function refreshUserBox(){
|
||||
try{
|
||||
const me = await API.me();
|
||||
if(me && me.uid){
|
||||
userBox.innerHTML = '<span class="ub-name"></span><button class="ub-logout" id="ubLogout">退出</button>';
|
||||
const nm = userBox.querySelector('.ub-name');
|
||||
if(nm) nm.textContent = me.name || me.login;
|
||||
const lb = document.getElementById('ubLogout');
|
||||
if(lb) lb.addEventListener('click', async ()=>{
|
||||
await API.logout();
|
||||
location.href = 'index.html';
|
||||
});
|
||||
} else {
|
||||
userBox.innerHTML = ''; // 未登录:右上角不显示登录入口,登录经“进入游戏”引导
|
||||
}
|
||||
}catch(e){ userBox.innerHTML = ''; }
|
||||
cachedMe = await API.me();
|
||||
if(cachedMe && cachedMe.uid) renderLoggedIn(cachedMe);
|
||||
else renderLoggedOut();
|
||||
}catch(e){ renderLoggedOut(); }
|
||||
}
|
||||
refreshUserBox();
|
||||
|
||||
// ============ 进入游戏:已登录→世界页;未登录→提示登录 ============
|
||||
// TEMP: 本地临时默认直接进入游戏,跳过 Odoo 登录校验;打通后端后改回 API.me() 判断
|
||||
// ============ 进入游戏:已登录→世界页;未登录→登录页 ============
|
||||
const enterBtn = document.getElementById('enterGame');
|
||||
if(enterBtn) enterBtn.addEventListener('click', ()=>{
|
||||
location.href = 'world.html';
|
||||
if(enterBtn) enterBtn.addEventListener('click', async ()=>{
|
||||
try {
|
||||
const me = cachedMe || await API.me();
|
||||
if (me && me.uid) location.href = 'world.html';
|
||||
else location.href = 'login.html?next=world.html';
|
||||
} catch(e) {
|
||||
location.href = 'login.html?next=world.html';
|
||||
}
|
||||
});
|
||||
})();
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user