diff --git a/backend/routes/install.js b/backend/routes/install.js
index 8841d86..107dc1c 100644
--- a/backend/routes/install.js
+++ b/backend/routes/install.js
@@ -73,6 +73,8 @@ router.post('/complete', async (req, res) => {
for (const [k, v, l] of [
['site_name', site_name || 'MC举报系统', '站点名称'],
['site_url', site_url || 'http://localhost:3100', '站点地址'],
+ ['copyright', '© 2024 MC举报系统', '页尾版权'],
+ ['icp', '', 'ICP备案号'],
]) {
await conn.query("INSERT INTO settings(k, v, label) VALUES (?,?,?) ON DUPLICATE KEY UPDATE v=VALUES(v)", [k, v, l]);
}
diff --git a/public/css/style.css b/public/css/style.css
index e9d78da..f3f5329 100644
--- a/public/css/style.css
+++ b/public/css/style.css
@@ -157,3 +157,12 @@ tbody tr:hover{background:var(--g50)}
.detail-grid{grid-template-columns:1fr}
.grid-2,.grid-3{grid-template-columns:1fr}
}
+#top-bar{background:var(--g900);color:white;position:sticky;top:0;z-index:200}
+.top-bar-inner{max-width:1200px;margin:0 auto;display:flex;align-items:center;justify-content:space-between;padding:0 20px;height:48px}
+.top-logo{color:white;text-decoration:none;font-size:16px;font-weight:700;display:flex;align-items:center;gap:8px}
+.top-logo i{font-size:20px;color:var(--p)}
+#top-auth{display:flex;gap:8px}
+#page-footer{background:var(--g900);color:var(--g400);padding:16px 20px;font-size:13px;text-align:center}
+.footer-inner{max-width:1200px;margin:0 auto;display:flex;justify-content:center;gap:24px;flex-wrap:wrap}
+#app{min-height:calc(100vh - 48px);display:flex;flex-direction:column}
+#public-page,#main-layout{flex:1}
diff --git a/public/index.html b/public/index.html
index 602923a..0bda9a2 100644
--- a/public/index.html
+++ b/public/index.html
@@ -8,6 +8,16 @@
+
+
+
+
diff --git a/public/js/app.js b/public/js/app.js
index e6d695d..21711c4 100644
--- a/public/js/app.js
+++ b/public/js/app.js
@@ -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 = `
${s.icp.value}`;
+ } 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();
diff --git a/public/js/pages/settings-page.js b/public/js/pages/settings-page.js
index 8f1f55e..80c70d7 100644
--- a/public/js/pages/settings-page.js
+++ b/public/js/pages/settings-page.js
@@ -12,6 +12,8 @@ const SettingsPage = {
@@ -35,6 +37,8 @@ const SettingsPage = {
await API.put('/settings/settings', {
site_name: {value: document.getElementById('s-name').value, label:'站点名称'},
site_url: {value: document.getElementById('s-url').value, label:'站点地址'},
+ copyright: {value: document.getElementById('s-copyright').value, label:'页尾版权'},
+ icp: {value: document.getElementById('s-icp').value, label:'ICP备案号'},
});
alert('已保存');
} catch (ex) { alert(ex.message); }