feat(admin-web): 顶栏审核模式开关——状态徽标+确认弹窗+一键切换(提审前开启/过审后关闭)
This commit is contained in:
@@ -33,6 +33,9 @@
|
||||
.topbar .brand span { color: var(--brand); }
|
||||
.topbar .who { color: var(--muted); font-size: 13px; display: flex; align-items: center; gap: 14px; }
|
||||
.topbar .who a { color: var(--red); cursor: pointer; text-decoration: none; }
|
||||
.audit-badge { font-size: 12px; padding: 4px 10px; border-radius: 999px; cursor: pointer; user-select: none; border: 1px solid var(--line); }
|
||||
.audit-badge.on { background: var(--red-bg); color: var(--red); border-color: #f5c2c2; font-weight: 600; }
|
||||
.audit-badge.off { background: var(--green-bg); color: var(--green); border-color: #c8ecd5; }
|
||||
.container { max-width: 1100px; margin: 24px auto; padding: 0 24px; }
|
||||
|
||||
.stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 16px; margin-bottom: 22px; }
|
||||
@@ -107,6 +110,7 @@
|
||||
<div class="topbar">
|
||||
<div class="brand">拆约 · <span>后台管理</span></div>
|
||||
<div class="who">
|
||||
<span id="auditBadge" class="audit-badge" onclick="toggleAuditMode()" title="点击切换审核模式(提审前开启,过审后关闭)">审核模式:检测中…</span>
|
||||
<span id="whoami"></span>
|
||||
<a onclick="doLogout()">退出</a>
|
||||
</div>
|
||||
@@ -307,7 +311,34 @@ function enterMain(username, displayName) {
|
||||
document.getElementById('loginPage').classList.add('hidden');
|
||||
document.getElementById('mainPage').classList.remove('hidden');
|
||||
document.getElementById('whoami').textContent = displayName || username || 'admin';
|
||||
loadStats(); loadUsers(1);
|
||||
loadStats(); loadUsers(1); loadAuditMode();
|
||||
}
|
||||
let auditMode = false;
|
||||
async function loadAuditMode() {
|
||||
try {
|
||||
const r = await fetch(API + '/api/settings/audit-mode').then(x => x.json());
|
||||
auditMode = !!(r.success && r.data && r.data.auditMode);
|
||||
} catch (e) { auditMode = false; }
|
||||
renderAuditBadge();
|
||||
}
|
||||
function renderAuditBadge() {
|
||||
const el = document.getElementById('auditBadge');
|
||||
el.textContent = auditMode ? '审核模式:已开启' : '审核模式:已关闭';
|
||||
el.className = 'audit-badge ' + (auditMode ? 'on' : 'off');
|
||||
}
|
||||
async function toggleAuditMode() {
|
||||
const to = !auditMode;
|
||||
const tip = to
|
||||
? '开启后将隐藏小程序内「共拆搭子/会员搜索/AI共拆分析」等内容页,活动发布入口对非管理员关闭。\n确认开启审核模式?(提交微信审核前开启)'
|
||||
: '关闭后小程序恢复全部功能。\n确认关闭审核模式?(通过审核后关闭)';
|
||||
if (!confirm(tip)) return;
|
||||
try {
|
||||
const r = await api('/api/settings/audit-mode', { method: 'PUT', body: { auditMode: to } });
|
||||
if (!r.success) { showToast(r.message || '操作失败'); return; }
|
||||
auditMode = !!r.data.auditMode;
|
||||
renderAuditBadge();
|
||||
showToast(auditMode ? '审核模式已开启' : '审核模式已关闭');
|
||||
} catch (e) { showToast('网络错误'); }
|
||||
}
|
||||
async function loadStats() {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user