feat: top bar, footer, login/register buttons, ICP/copyright settings

This commit is contained in:
2026-07-12 01:32:18 +08:00
parent e44ee885ca
commit a6058bf207
5 changed files with 45 additions and 0 deletions

View File

@@ -12,10 +12,21 @@ const App = {
],
init() {
this.loadFooter();
window.addEventListener('hashchange', () => this.route());
this.route();
},
async loadFooter() {
try {
const s = await API.get('/settings/settings');
const cr = document.getElementById('footer-copyright');
const icp = document.getElementById('footer-icp');
if (cr && s.copyright) cr.innerHTML = s.copyright.value;
if (icp && s.icp && s.icp.value) icp.innerHTML = `<a href="https://beian.miit.gov.cn" target="_blank">${s.icp.value}</a>`;
} catch {}
},
afterLogin() { location.hash = '#/dashboard'; },
logout() { Auth.logout(); },
closeModal() { document.getElementById('modal-overlay').classList.add('hidden'); },
@@ -73,6 +84,7 @@ const App = {
},
showPublic(page) {
document.getElementById('top-auth').classList.remove('hidden');
document.getElementById('main-layout').classList.add('hidden');
const pub = document.getElementById('public-page');
pub.classList.remove('hidden');
@@ -81,6 +93,7 @@ const App = {
},
showLayout() {
document.getElementById('top-auth').classList.add('hidden');
document.getElementById('public-page').classList.add('hidden');
document.getElementById('main-layout').classList.remove('hidden');
const u = Auth.user();