From 2faaa6f032ab3ed17ab544bb90e286c49b68748f Mon Sep 17 00:00:00 2001 From: mzl92 Date: Thu, 27 Aug 2026 15:51:44 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A7=BB=E9=99=A4=E6=9C=9F=E6=9C=9B=E5=9F=8E?= =?UTF-8?q?=E5=B8=82TOP8=E5=9B=BE=E8=A1=A8(=E6=97=A0=E5=AE=9E=E9=99=85?= =?UTF-8?q?=E4=BD=9C=E7=94=A8),=20=E5=85=B6=E4=BD=99=E4=B8=89=E5=9B=BE?= =?UTF-8?q?=E8=87=AA=E5=8A=A8=E9=87=8D=E6=8E=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/index.html | 12 +++--------- scripts/smoke.js | 2 +- server.js | 1 - 3 files changed, 4 insertions(+), 11 deletions(-) diff --git a/public/index.html b/public/index.html index 25716f4..07ae8cd 100644 --- a/public/index.html +++ b/public/index.html @@ -103,9 +103,8 @@ tr.today:hover td{background:#fde68a!important}

近30天趋势

评分级别分布

-

学历分布

-

期望城市 TOP8

-

筛选漏斗

+

学历分布

+

筛选漏斗

@@ -240,7 +239,7 @@ async function loadStats(){ const charts=[]; function mkChart(id){const c=echarts.init($(id));charts.push(c);return c} function renderCharts(s){ - if(typeof echarts==='undefined'){['chTrend','chLevel','chEdu','chCity','chFunnel'].forEach(id=>{$(id).innerHTML='
图表库未加载
'});return} + if(typeof echarts==='undefined'){['chTrend','chLevel','chEdu','chFunnel'].forEach(id=>{$(id).innerHTML='
图表库未加载
'});return} charts.splice(0).forEach(c=>c.dispose()); const axis='#6b7280',split='#e5e7eb'; mkChart('chTrend').setOption({ @@ -263,11 +262,6 @@ function renderCharts(s){ xAxis:{type:'category',data:s.byEducation.map(x=>x.k),axisLabel:{color:axis,interval:0},axisLine:{lineStyle:{color:split}}}, yAxis:{type:'value',axisLabel:{color:axis},splitLine:{lineStyle:{color:split}}}, series:[{type:'bar',barWidth:'55%',data:s.byEducation.map(x=>x.c),itemStyle:{color:'#2563eb',borderRadius:[4,4,0,0]}}]}); - mkChart('chCity').setOption({ - tooltip:{},grid:{left:70,right:30,top:20,bottom:30}, - xAxis:{type:'value',axisLabel:{color:axis},splitLine:{lineStyle:{color:split}}}, - yAxis:{type:'category',data:s.byCity.map(x=>x.k).reverse(),axisLabel:{color:axis}}, - series:[{type:'bar',barWidth:'55%',data:s.byCity.map(x=>x.c).reverse(),itemStyle:{color:'#0ea5e9',borderRadius:[0,4,4,0]}}]}); const lv=s.byLevel.reduce((m,x)=>(m[x.k]=x.c,m),{}); mkChart('chFunnel').setOption({ tooltip:{trigger:'item',formatter:'{b}: {c}'}, diff --git a/scripts/smoke.js b/scripts/smoke.js index 6b7771a..1b5b7e3 100644 --- a/scripts/smoke.js +++ b/scripts/smoke.js @@ -43,7 +43,7 @@ const sleep = (ms) => new Promise(r => setTimeout(r, ms)); ok('累计候选人为五位数(数据在库)', /\d{5,}/.test(statText)); ok('级别分布含推荐', statText.includes('推荐')); const canvasN = await p.evaluate(() => document.querySelectorAll('#main canvas').length); - ok(`图表已渲染(canvas=${canvasN},≥5)`, canvasN >= 5); + ok(`图表已渲染(canvas=${canvasN},≥4)`, canvasN >= 4); console.log('== 4. 候选人列表与筛选(滑动到第二屏) =='); await p.evaluate(() => setPane(1)); await sleep(500); diff --git a/server.js b/server.js index 0a1028a..4fc512f 100644 --- a/server.js +++ b/server.js @@ -154,7 +154,6 @@ app.get('/api/stats', requireAuth, (req, res) => { greetedTotal: rdb.prepare('SELECT COUNT(*) c FROM candidates WHERE greeted = 1').get().c, byLevel: rdb.prepare("SELECT COALESCE(score_level,'?') k, COUNT(*) c FROM candidates GROUP BY score_level").all(), byEducation: rdb.prepare("SELECT COALESCE(NULLIF(education,''),'未知') k, COUNT(*) c FROM candidates GROUP BY education ORDER BY c DESC LIMIT 8").all(), - byCity: rdb.prepare("SELECT expected_city k, COUNT(*) c FROM candidates WHERE expected_city != '' GROUP BY expected_city ORDER BY c DESC LIMIT 8").all(), byAccount: rdb.prepare("SELECT COALESCE(NULLIF(account,''),'未知') k, COUNT(*) c, SUM(greeted) g FROM candidates GROUP BY account ORDER BY c DESC").all(), last30: rdb.prepare(`SELECT substr(scraped_at,1,10) d, COUNT(*) c, SUM(CASE WHEN score_level='推荐' THEN 1 ELSE 0 END) rec,