fix: 修复管理后台样式丢失 + CSP inline style 违规

- 评论管理页:创建 comments.css,controller 传递 ExtraCSS/ExtraJS,模板移除所有 inline style,JS 改用 CSS 类
- 修复 comments.js 加载顺序:通过 ExtraJS 在 common.js 之后加载,解决 api is not defined
- base.html:SVG inline style 移至 common.css
- dashboard/index.html:3 处 inline style 替换为 CSS 类
- audit/index.html:modal 移除冗余 style="display:none"
- fund_logs/logs:label inline style 移至 energy.css
- common.css 新增多个 CSS 规则
- energy.css 新增 .filter-bar label 规则
This commit is contained in:
2026-06-02 21:37:52 +08:00
parent 983f539268
commit 543325105c
11 changed files with 174 additions and 20 deletions

View File

@ -86,7 +86,7 @@
</div>
<!-- 拒绝理由弹窗 -->
<div class="modal-overlay" id="rejectModal" style="display:none;">
<div class="modal-overlay" id="rejectModal">
<div class="modal-box">
<h3>拒绝审核</h3>
<p>请填写拒绝理由:</p>

View File

@ -7,19 +7,19 @@
<div class="admin-toolbar">
<input type="text" id="commentSearch" class="admin-search-input" placeholder="搜索评论内容、作者或文章标题..." />
<button id="commentSearchBtn" class="btn btn-secondary">搜索</button>
<button id="commentClearBtn" class="btn btn-secondary" style="display:none">清除</button>
<button id="commentClearBtn" class="btn btn-secondary admin-hidden">清除</button>
</div>
<div class="admin-table-wrap" id="commentTableWrap">
<table class="admin-table">
<thead>
<tr>
<th style="width:60px">ID</th>
<th style="width:100px">作者</th>
<th class="th-id">ID</th>
<th class="th-author">作者</th>
<th>评论内容</th>
<th style="width:160px">所属文章</th>
<th style="width:140px">时间</th>
<th style="width:100px">操作</th>
<th class="th-post">所属文章</th>
<th class="th-time">时间</th>
<th class="th-actions">操作</th>
</tr>
</thead>
<tbody id="commentTableBody"></tbody>
@ -27,7 +27,6 @@
</div>
<div class="admin-pagination" id="commentPagination"></div>
<div class="admin-loading" id="commentLoading" style="display:none">加载中...</div>
<div class="admin-loading admin-hidden" id="commentLoading">加载中...</div>
{{template "admin/layout/footer.html" .}}
<script src="/admin/static/js/comments.js?v={{assetV "/admin/static/js/comments.js"}}" nonce="{{.CSPNonce}}"></script>

View File

@ -14,7 +14,7 @@
<div class="stat-info">
<div class="stat-label">帖子总数</div>
<div class="stat-value">{{.PostTotal}}</div>
<div class="stat-desc">已发布 {{.PostApproved}}<span class="stat-badge badge-warn" style="margin-left: 12px;">待审核 {{.PostPending}}</span></div>
<div class="stat-desc">已发布 {{.PostApproved}}<span class="stat-badge badge-warn">待审核 {{.PostPending}}</span></div>
</div>
</div>
<div class="stat-card">
@ -23,8 +23,8 @@
</div>
</div>
<div class="stats-grid" style="margin-top: 1rem;">
<div class="stat-card" style="grid-column: span 2;">
<div class="stats-grid mt-grid">
<div class="stat-card span-2">
<div class="stat-icon {{if .StoreDegraded}}stat-red{{else if eq .StoreType "redis"}}stat-green{{else}}stat-blue{{end}}">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><ellipse cx="12" cy="5" rx="9" ry="3"/><path d="M21 12c0 1.66-4 3-9 3s-9-1.34-9-3"/><path d="M3 5v14c0 1.66 4 3 9 3s9-1.34 9-3V5"/></svg>
</div>

View File

@ -5,7 +5,7 @@
</div>
<div class="filter-bar">
<label for="fund-log-type-filter" style="font-size:0.85rem;color:#4a5568;font-weight:500;">类型筛选:</label>
<label for="fund-log-type-filter">类型筛选:</label>
<select id="fund-log-type-filter">
<option value="">全部类型</option>
{{range $type, $name := .LogTypes}}<option value="{{$type}}">{{$name}}</option>{{end}}

View File

@ -5,7 +5,7 @@
</div>
<div class="filter-bar">
<label for="log-type-filter" style="font-size:0.85rem;color:#4a5568;font-weight:500;">类型筛选:</label>
<label for="log-type-filter">类型筛选:</label>
<select id="log-type-filter">
<option value="">全部类型</option>
{{range $type, $name := .LogTypes}}<option value="{{$type}}">{{$name}}</option>{{end}}

View File

@ -16,7 +16,7 @@
<a href="/admin" class="admin-logo">MetaLab <span>管理面板</span></a>
<div class="admin-header-right">
<span class="admin-user">{{.Username}}</span>
<a href="/" class="admin-back-btn"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" width="14" height="14" style="vertical-align:-2px;margin-right:3px;"><path d="m3 9 9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"/><polyline points="9 22 9 12 15 12 15 22"/></svg>返回前台</a>
<a href="/" class="admin-back-btn"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" width="14" height="14"><path d="m3 9 9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"/><polyline points="9 22 9 12 15 12 15 22"/></svg>返回前台</a>
</div>
</div>
</header>