// 宇森 · 世界内面板逻辑(图鉴 / 规则 / 论坛 / 公告) // 依赖 assets/game-api.js(提供 API) // ---------- 登录态守卫 ---------- // TEMP: 本地临时默认放行,跳过 Odoo 登录校验;打通后端后删除此分支并恢复下面逻辑 const TEMP_SKIP_AUTH = true; (async () => { if (TEMP_SKIP_AUTH) { const u = document.getElementById('userName'); if (u) u.textContent = '园丁'; return; } try { const me = await API.me(); if (!me.uid) { location.href = 'login.html?next=world.html'; return; } const u = document.getElementById('userName'); if (u) u.textContent = me.name || me.login; } catch (e) { location.href = 'login.html'; } })(); // ---------- 退出 ---------- const logoutBtn = document.getElementById('logoutBtn'); if (logoutBtn) logoutBtn.addEventListener('click', async () => { await API.logout(); location.href = 'index.html'; }); // ---------- 面板控制 ---------- const panel = document.getElementById('dataPanel'); const dpTitle = document.getElementById('dpTitle'); const dpBody = document.getElementById('dpBody'); const dpClose = document.getElementById('dpClose'); if (dpClose) dpClose.addEventListener('click', () => panel.classList.remove('open')); async function openPanel(kind) { if (!panel) return; panel.classList.add('open'); dpBody.innerHTML = '