新增筛选规则页: Hermes整理的机器人规则总览(rules.md), 顶栏入口所有登录用户可见, marked渲染

This commit is contained in:
mzl92
2026-08-27 16:40:29 +08:00
parent ce6e0f8de1
commit 896795462a
5 changed files with 208 additions and 0 deletions
+36
View File
@@ -88,12 +88,29 @@ tr.today:hover td{background:#fde68a!important}
#userModal.hidden{display:none}
#accessModal{position:fixed;inset:0;background:rgba(0,0,0,.4);z-index:8;display:flex;align-items:center;justify-content:center}
#accessModal.hidden{display:none}
#rulesModal{position:fixed;inset:0;background:rgba(0,0,0,.4);z-index:8;display:flex;align-items:center;justify-content:center}
#rulesModal.hidden{display:none}
.mdview{font-size:14px;line-height:1.7;color:#374151}
.mdview h1{font-size:20px;margin:4px 0 12px;color:var(--txt)}
.mdview h2{font-size:16px;margin:22px 0 8px;padding:6px 10px;background:#eff6ff;border-left:4px solid var(--pri);border-radius:4px}
.mdview h3{font-size:14px;margin:14px 0 6px}
.mdview p{margin:6px 0}
.mdview table{width:100%;border-collapse:collapse;font-size:13px;margin:8px 0}
.mdview th,.mdview td{border:1px solid var(--line);padding:6px 10px;text-align:left;white-space:normal}
.mdview th{background:#f9fafb}
.mdview pre{background:#f9fafb;border:1px solid var(--line);border-radius:8px;padding:12px;font-size:12.5px;overflow:auto;margin:8px 0}
.mdview code{background:#f1f5f9;padding:1px 5px;border-radius:4px;font-size:12.5px}
.mdview pre code{background:none;padding:0}
.mdview blockquote{border-left:4px solid #cbd5e1;background:#f8fafc;margin:8px 0;padding:8px 12px;color:var(--sub)}
.mdview hr{border:none;border-top:1px solid var(--line);margin:16px 0}
.mdview li{margin:3px 0}
</style>
</head>
<body>
<div class="topbar">
<b>📋 招聘数据后台</b><span id="whoami" style="color:#94a3b8;font-size:12px"></span>
<span class="sp"></span>
<button id="rulesBtn" class="hidden" onclick="openRulesModal()">筛选规则</button>
<button id="userMgrBtn" class="hidden" onclick="openUserModal()">账号管理</button>
<button id="accessLogBtn" class="hidden" onclick="openAccessModal()">访问记录</button>
<button id="logoutBtn" class="hidden" onclick="logout()">退出登录</button>
@@ -194,11 +211,20 @@ tr.today:hover td{background:#fde68a!important}
<tbody id="alogBody"></tbody></table>
</div>
</div>
<div id="rulesModal" onclick="if(event.target===this)this.classList.add('hidden')" class="hidden">
<div class="panel" style="width:900px;max-width:94vw;max-height:88vh;overflow:auto">
<h3>筛选规则与流程总览
<button class="btn sub small" style="float:right" onclick="document.getElementById('rulesModal').classList.add('hidden')">关闭</button>
</h3>
<div class="mdview" id="rulesBody">加载中...</div>
</div>
</div>
</div>
<div id="detailModal" onclick="if(event.target===this)this.classList.add('hidden')" class="hidden">
<div class="panel detail" style="width:820px;max-width:94vw;max-height:88vh;overflow:auto" id="detailBody"></div>
</div>
<script src="echarts.min.js"></script>
<script src="marked.min.js"></script>
<script>
let me=null,pageCur=1,pageTotal=1;
const $=id=>document.getElementById(id);
@@ -246,6 +272,7 @@ async function logout(){await api('/api/logout',{method:'POST'});location.reload
async function enter(m){
me=m;$('loginBox').classList.add('hidden');$('main').classList.remove('hidden');$('logoutBtn').classList.remove('hidden');
$('whoami').textContent=`${m.username} · ${m.role==='super'?'超管':'HR'}`;
$('rulesBtn').classList.remove('hidden');
if(m.role==='super'){$('userMgrBtn').classList.remove('hidden');$('accessLogBtn').classList.remove('hidden')}
loadStats().catch(e=>dataErr(e));loadList(1).catch(e=>dataErr(e));
}
@@ -381,6 +408,15 @@ async function addUser(){
try{await api('/api/users',{method:'POST',body:JSON.stringify({username:$('nu_user').value,password:$('nu_pass').value})});toast('已创建');$('nu_user').value=$('nu_pass').value='';loadUsers()}
catch(e){toast(e.message)}
}
async function openRulesModal(){
$('rulesModal').classList.remove('hidden');
if($('rulesBody').dataset.loaded)return;
try{
const md=await (await fetch('/api/rules')).text();
$('rulesBody').innerHTML=(typeof marked!=='undefined')?marked.parse(md):'<pre>'+esc(md)+'</pre>';
$('rulesBody').dataset.loaded='1';
}catch(e){$('rulesBody').textContent='加载失败: '+e.message}
}
async function openAccessModal(){
$('accessModal').classList.remove('hidden');
loadAccessLog().catch(()=>toast('访问记录加载失败'));