feat: top bar, footer, login/register buttons, ICP/copyright settings
This commit is contained in:
@@ -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}
|
||||
|
||||
@@ -8,6 +8,16 @@
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="top-bar">
|
||||
<div class="top-bar-inner">
|
||||
<a href="#/home" class="top-logo"><i class="fas fa-shield-halved"></i><span>MC举报系统</span></a>
|
||||
<div id="top-auth">
|
||||
<a href="#/login" class="btn btn-o btn-sm"><i class="fas fa-sign-in-alt"></i> 登录</a>
|
||||
<a href="#/register" class="btn btn-p btn-sm"><i class="fas fa-user-plus"></i> 注册</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="app">
|
||||
<div id="public-page" class="page hidden"></div>
|
||||
<div id="main-layout" class="hidden">
|
||||
@@ -27,6 +37,13 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<footer id="page-footer">
|
||||
<div class="footer-inner">
|
||||
<span id="footer-copyright">© 2024 MC举报系统</span>
|
||||
<span id="footer-icp"></span>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
<div id="modal-overlay" class="hidden">
|
||||
<div class="modal-box">
|
||||
<div class="modal-h"><h3 id="modal-title"></h3><button onclick="App.closeModal()">×</button></div>
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -12,6 +12,8 @@ const SettingsPage = {
|
||||
<form id="site-form">
|
||||
<div class="grid-2"><div class="form-group"><label>站点名称</label><input id="s-name" value="${U.esc(settings.site_name?.value||'')}"></div>
|
||||
<div class="form-group"><label>站点地址</label><input id="s-url" value="${U.esc(settings.site_url?.value||'')}"></div></div>
|
||||
<div class="grid-2"><div class="form-group"><label>页尾版权</label><input id="s-copyright" value="${U.esc(settings.copyright?.value||'')}" placeholder="© 2024 MC举报系统"></div>
|
||||
<div class="form-group"><label>ICP备案号</label><input id="s-icp" value="${U.esc(settings.icp?.value||'')}" placeholder="沪ICP备XXXXXXXX号"></div></div>
|
||||
<button type="submit" class="btn btn-p btn-sm"><i class="fas fa-save"></i> 保存站点设置</button>
|
||||
</form>
|
||||
</div></div>
|
||||
@@ -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); }
|
||||
|
||||
Reference in New Issue
Block a user