This commit is contained in:
2026-08-31 19:18:05 +08:00
parent 493287c99f
commit a9752b01a9
10 changed files with 167 additions and 27 deletions
+48 -2
View File
@@ -72,6 +72,10 @@
.bl-btn { border: 1px solid #ffd6d6; background: #fff; color: #e64340; border-radius: 4px; font-size: 12px; padding: 1px 8px; cursor: pointer; margin-left: 6px; }
.bl-btn:hover { background: #fff1f0; }
/* JD 查看按钮 */
.jd-btn { border: 1px solid #91d5ff; background: #fff; color: #1890ff; border-radius: 4px; font-size: 12px; padding: 1px 8px; cursor: pointer; }
.jd-btn:hover { background: #e6f7ff; }
/* 黑名单页 */
.bl-add { display: flex; gap: 10px; background: #fff; border-radius: 10px; padding: 16px 18px; box-shadow: 0 2px 8px rgba(0,0,0,.05); margin-bottom: 16px; }
.bl-add input { flex: 1; padding: 9px 12px; border: 1px solid #d9d9d9; border-radius: 6px; font-size: 14px; }
@@ -156,7 +160,7 @@
<table>
<thead><tr>
<th>时间</th><th>职位</th><th>公司</th><th>薪资</th><th>结果</th><th>AI评分</th><th>备注</th>
<th>时间</th><th>职位</th><th>公司</th><th>薪资</th><th>结果</th><th>AI评分</th><th>备注</th><th style="width:60px">JD</th>
</tr></thead>
<tbody id="tbody"></tbody>
</table>
@@ -371,9 +375,12 @@ async function load() {
const company = r.company || '';
const blBtn = (company && !blSet.has(company))
? '<button class="bl-btn" data-company="' + esc(company) + '">拉黑</button>' : '';
// JD 列:有 JD(库内字段或归档文件)才可点开查看全文,走 /api/jobs/{id}/jd 按需拉取
const jdBtn = r.has_jd
? '<button class="jd-btn" data-id="' + r.id + '">查看</button>' : '<span style="color:#ccc;">-</span>';
return '<tr><td>' + esc(r.applied_at) + '</td><td>' + esc(r.job_title) + '</td><td>' + esc(company) + blBtn +
'</td><td>' + esc(r.salary) + '</td><td>' + type + '</td><td>' + score +
'</td><td class="remark" title="' + esc(remark) + '">' + esc(remark) + '</td></tr>';
'</td><td class="remark" title="' + esc(remark) + '">' + esc(remark) + '</td><td>' + jdBtn + '</td></tr>';
}).join('');
document.getElementById('empty').classList.toggle('hidden', (d.items || []).length > 0);
@@ -499,6 +506,28 @@ async function testAiConfig() {
} catch (e) { alert('测试失败:' + (e.message || '')); }
}
/* ---------- 岗位 JD 查看(先取库内字段,为空由服务端读归档文件) ---------- */
async function showJd(appId) {
const body = document.getElementById('jdBody');
const tip = document.getElementById('jdTip');
document.getElementById('jdModal').classList.remove('hidden');
tip.textContent = '加载中…';
body.textContent = '';
try {
const d = await api('/api/jobs/' + appId + '/jd');
tip.textContent = '来源:' + (d.source === 'file' ? '归档文件' : '数据库字段') +
' · ' + (d.jd_text || '').length + ' 字';
body.textContent = d.jd_text || '';
} catch (e) {
tip.textContent = '加载失败';
body.textContent = e.message || '无 JD 数据';
}
}
function closeJd() {
document.getElementById('jdModal').classList.add('hidden');
}
/* ---------- 页面切换 ---------- */
function switchPage(page) {
document.querySelectorAll('aside .menu-item').forEach(el =>
@@ -588,6 +617,8 @@ document.getElementById('blTbody').addEventListener('click', e => {
if (btn) removeBlacklist(btn.dataset.id);
});
document.getElementById('tbody').addEventListener('click', e => {
const jdBtn = e.target.closest('.jd-btn');
if (jdBtn) { showJd(jdBtn.dataset.id); return; }
const btn = e.target.closest('.bl-btn');
if (btn && confirm('确认拉黑公司「' + btn.dataset.company + '」?拉黑后将不再投递该公司。')) {
addBlacklist(btn.dataset.company);
@@ -720,5 +751,20 @@ setInterval(() => {
</div>
</div>
</div>
<!-- 岗位 JD 查看弹窗 -->
<div id="jdModal" class="hidden" style="position:fixed;inset:0;background:rgba(0,0,0,0.45);z-index:2000;display:flex;align-items:center;justify-content:center;">
<div style="background:#fff;border-radius:8px;padding:24px;width:760px;max-width:95vw;max-height:85vh;display:flex;flex-direction:column;">
<h3 style="margin:0 0 8px;">岗位 JD 全文</h3>
<div id="jdTip" style="font-size:12px;color:#999;margin-bottom:10px;"></div>
<pre id="jdBody" style="flex:1;min-height:0;overflow:auto;white-space:pre-wrap;word-break:break-all;background:#fafafa;border:1px solid #f0f0f0;border-radius:6px;padding:14px;font-size:13px;line-height:1.7;"></pre>
<div style="margin-top:16px;text-align:right;">
<button id="jdClose" style="padding:6px 14px;border-radius:4px;border:1px solid #d9d9d9;background:#fff;cursor:pointer;">关闭</button>
</div>
</div>
</div>
<script>
document.getElementById('jdClose').onclick = closeJd;
document.getElementById('jdModal').addEventListener('click', e => { if (e.target.id === 'jdModal') closeJd(); });
</script>
</body>
</html>