diff --git a/docs/择校UI/index.html b/docs/择校UI/index.html index e5c19af68..e762477dd 100644 --- a/docs/择校UI/index.html +++ b/docs/择校UI/index.html @@ -446,7 +446,7 @@ body.home-active{--accent:#294b8b;--accent-soft:#eef3fb;--line:#dfe3eb;--mute:#7 .e-subpage .tools select{font-size:10px}.e-count{font-size:12px;margin:12px 0 3px}.e-count b{color:#e15b4b;font-size:18px} .e-result{display:grid;grid-template-columns:31% minmax(0,1fr);gap:8px;padding:6px;margin-top:8px;border-radius:7px;cursor:default} .e-result-photo{min-width:0;min-height:115px;border:0;padding:0;background:transparent;border-radius:5px;overflow:hidden;cursor:pointer}.e-result-photo:focus-visible{outline:2px solid #294b8b;outline-offset:2px}body.dark .e-result-photo:focus-visible{outline-color:#b5cef8}.e-result-photo img,.e-result-photo>.fb{width:100%;height:100%;min-height:115px;object-fit:cover} -.e-result-body{min-width:0}.e-result-title{display:flex;align-items:center;gap:5px;cursor:pointer}.e-result-title b{font-family:SimSun,serif;font-size:16px;line-height:1.25;overflow-wrap:anywhere}.e-result-title span,.e-result-tags span{font-size:9px;background:#e8eef9;color:#294b8b;border-radius:3px;padding:2px 4px}.e-result-title i{font-style:normal;margin-left:auto;font-size:18px}.e-result-tags{display:flex;gap:3px;margin:4px 0;flex-wrap:wrap}.e-result-tags span{background:#f2f3f5;color:#606570} +.e-result-body{min-width:0}.e-result-title{display:flex;align-items:center;gap:5px;cursor:pointer}.e-result-title b{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;flex:0 1 auto;font-family:SimSun,serif;font-size:16px;line-height:1.25;overflow-wrap:anywhere}.e-result-title span,.e-result-tags span{font-size:9px;background:#e8eef9;color:#294b8b;border-radius:3px;padding:2px 4px}.e-result-title i{font-style:normal;margin-left:auto;font-size:18px}.e-result-tags{display:flex;gap:3px;margin:4px 0;flex-wrap:wrap}.e-result-tags span{background:#f2f3f5;color:#606570} .e-result-metrics{display:grid;grid-template-columns:1fr 1fr;background:#fcf3f2;border-radius:5px;padding:5px 7px;cursor:pointer}.e-result-metrics>div+div{border-left:1px solid #e0d8d8;padding-left:7px}.e-result-metrics small{display:block;font-size:9px}.e-result-metrics b{font-size:14px;color:#e15b4b}.e-result-metrics>div+div b{color:#414651} .e-result-bottom{display:flex;align-items:center;gap:4px;margin-top:5px}.e-result-bottom span{font-size:9px;color:#737985;flex:1;min-width:0;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.e-result-bottom button,.detail-heading button{font-size:9px;white-space:nowrap;color:#294b8b;background:#fff;border:1px solid #bfc8d8;border-radius:4px;padding:4px} @@ -604,6 +604,22 @@ body.dark .compare-table .cmp-label{color:#e5e9ef} .compare-selection .compare-chips.fit{flex-wrap:nowrap;overflow-x:auto} .compare-selection .compare-chips.fit .compare-chip{flex:none;padding-left:3px;padding-right:3px;font-size:9px} .compare-selection .compare-chips.fit .compare-chip span{white-space:nowrap;overflow-wrap:normal} +/* v34:对比页「按分差排序」开关与「近 N」徽标 */ +.compare-selection>button.cmp-sort{display:inline-flex;align-items:center;gap:3px;padding:4px 6px;font-size:9.5px;color:#5a7196;border-color:#cdd8e9} +.compare-selection>button.cmp-sort .ui-icon{width:11px;height:11px} +.compare-selection>button.cmp-sort.on{background:#e8f0fd;border-color:#7394ca;color:#22417a;font-weight:600} +.compare-table .cmp .col .cmp-near{display:inline-block;margin:3px 0 0;padding:1px 4px;border-radius:4px;background:#eef3fb;color:#5a7196;font-size:9px;font-style:normal;font-weight:400;line-height:1.4;white-space:nowrap} +.compare-table .cmp .col .cmp-near.na{background:transparent;color:var(--mute);padding:0} +.cmp-verdict .cmp-sort-note{color:#5a7196;font-size:10px} +body.dark .compare-selection>button.cmp-sort{background:#22262c;border-color:#434955;color:#b9cbe8} +body.dark .compare-selection>button.cmp-sort.on{background:#2c3b52;border-color:#7394ca;color:#dbe7fb} +body.dark .compare-table .cmp .col .cmp-near{background:#2f3d52;color:#b9cbe8} +body.dark .compare-table .cmp .col .cmp-near.na{background:transparent;color:#8d9db3} +body.dark .cmp-verdict .cmp-sort-note{color:#a9c0dd} +/* 窄屏下把顶部「添加院校」收成 ⊕:表格空列与底部按钮都还有文字入口,省出的宽度留给已选院校名 */ +.compare-selection>button.cmp-add-top span{margin-left:2px} +@media(max-width:430px){.compare-selection>button.cmp-add-top span{display:none}.compare-selection>button.cmp-add-top{padding:4px 8px;font-size:12px;line-height:1}} +@media(max-width:380px){.compare-selection>button.cmp-sort .cmp-sort-txt{display:none}.compare-selection>button.cmp-sort{padding:4px 6px}} .compare-scroll-hint{margin:6px auto 0;color:#566983;font-size:10px;text-align:center;max-width:260px}.compare-scroll-controls{display:flex;align-items:center;gap:8px}.compare-scroll-controls button{width:28px;height:28px;flex:none;border:0;border-radius:50%;background:#eef2f8;color:#294b8b;font-size:20px;line-height:1;cursor:pointer}.compare-scroll-controls button:disabled{opacity:.4;cursor:default}.compare-scroll-controls input{width:100%;min-width:0;accent-color:#7394ca;cursor:pointer}.compare-scroll-hint p{margin:2px 0 0}body.dark .compare-scroll-hint{color:#c2cfe0}body.dark .compare-scroll-controls button{background:#344256;color:#d4e1fa} .compare-scroll-controls input[type=range]{appearance:none;-webkit-appearance:none;height:28px;padding:0;margin:0;border:0;background:transparent} .compare-scroll-controls input[type=range]::-webkit-slider-runnable-track{height:6px;border-radius:6px;background:linear-gradient(to right,#91add9 0%,#91add9 var(--scroll-progress,0%),#e4ebf6 var(--scroll-progress,0%),#e4ebf6 100%)} @@ -1330,6 +1346,41 @@ body.dark .cmp-verdict p.cmp-verdict-note{color:#a8b3c3} body.dark .detail-gap-actions button{background:#26303f;border-color:#43536c;color:#b6d0fb} @media(max-width:350px){.detail-gap-grid strong{font-size:16px}.e-gap-bars b{font-size:14px}.list-tier-seg button{font-size:9px}} + +/* v35 列表专业口径:标题两段式、未开设矮卡、分组分隔带 */ +.list-count-row{display:flex;align-items:flex-start;gap:10px} +.list-count-left{min-width:0;flex:1} +.list-count-main{font-size:13px;font-weight:700;color:#16233a;letter-spacing:-.2px} +.list-count-main b{font-size:17px;font-weight:800;color:#1c3faa;margin-right:2px} +.list-count-main span{font-size:11.5px;font-weight:400;color:#5b6678;margin-left:6px} +.list-count-sub{font-size:10.5px;color:#8792a4;margin-top:3px;line-height:1.4} +.list-count-right{display:flex;flex-direction:column;align-items:flex-end;gap:6px;flex:none} +.list-om{display:inline-flex;align-items:center;gap:6px;font-size:10px;color:#6b7485;cursor:pointer} +.list-om button{position:relative;width:30px;height:16px;border-radius:9px;border:1px solid #cfd8e6;background:#eef2f8;padding:0;cursor:pointer;flex:none} +.list-om button::after{content:"";position:absolute;top:1px;left:1px;width:12px;height:12px;border-radius:50%;background:#fff;box-shadow:0 1px 2px rgba(16,30,54,.2);transition:transform .16s} +.list-om button[aria-checked="true"]{background:#1c3faa;border-color:#1c3faa} +.list-om button[aria-checked="true"]::after{transform:translateX(14px)} + +.e-result-off{padding:10px 12px;min-height:0;gap:10px} +.e-off-icon{width:56px;height:56px;flex:none;border-radius:10px;background:#eef2f8;border:1px solid #dbe3ee;display:flex;align-items:center;justify-content:center;padding:0;cursor:pointer} +.e-off-icon svg{width:24px;height:24px;fill:none;stroke:#9aa8bd;stroke-width:1.6;stroke-linejoin:round} +.e-result-off .e-result-title{gap:6px} +.e-off-tag{font-size:9.5px;font-weight:600;color:#7b8798;background:#eef2f8;border-radius:4px;padding:1px 5px;line-height:1.5;flex:none} +.e-off-note{font-size:11px;color:#8792a4;line-height:1.5;margin-top:3px} +.e-off-more{font-size:11px;color:#1c3faa;text-align:right;margin-top:5px;cursor:pointer} +.e-result-off .e-result-body{gap:0} + +.list-off-bar{display:flex;align-items:center;justify-content:center;height:40px;margin:10px 0 8px;border-radius:10px;background:#eef2f8;font-size:11px;color:#6b7485} +body.dark .list-count-main{color:#e6ecf5} +body.dark .list-count-main b{color:#8fb4ff} +body.dark .list-count-main span,body.dark .list-count-sub,body.dark .e-off-note{color:#93a1b8} +body.dark .list-om{color:#93a1b8} +body.dark .list-om button{background:#2a3446;border-color:#3d4a60} +body.dark .e-off-icon{background:#232c3b;border-color:#333f52} +body.dark .e-off-icon svg{stroke:#6b7a91} +body.dark .e-off-tag{background:#2a3446;color:#9aa8bd} +body.dark .e-off-more{color:#8fb4ff} +body.dark .list-off-bar{background:#232c3b;color:#93a1b8} @@ -1460,7 +1511,7 @@ let tierSel = ''; // 决策层分层筛选:'' | chong | wen | bao let recSeed = 0; // 首页「换一批」的轮换位 let recNoHome = false; // 用户点了「看全国」,本轮不再按家乡推荐 let recForceHome = false; // 家乡院校不够一批,但用户坚持只看家乡 -let tierDefOpen = false; // 三档口径说明是否展开(首页与院校库共用一个开关) +let tierDefOpen = localStorage.getItem('zexiao_tierdef') === '1'; // 三档口径说明是否展开(首页与院校库共用一个开关,刷新后保持) let recHomeState = null; // 上一次的家乡推荐开关,变了要重置批次计数 // 首页推荐:记下每档已经展示过的院校,换一批时优先给没看过的; // recCur 保存「当前这一批」,render 反复触发时不会把当前这批算成已看过。 @@ -1485,11 +1536,13 @@ function recPick(t, arr) { return x; } const recSeenCount = () => recAll.chong.size + recAll.wen.size + recAll.bao.size; -let onlyMajor = localStorage.getItem('zexiao_onlymajor') === '1'; +let onlyMajor = localStorage.getItem('zexiao_onlymajor') !== '0'; let dirMerge = localStorage.getItem('zexiao_dirmerge') !== '0'; let dirProv = '全部', dirSort = 'lineUp'; let listTotal = 0; let cmp = (JSON.parse(localStorage.getItem('zexiao_cmp') || '[]')).filter(n => byNo[n]); +// 对比页「按分差排序」开关:只改列的显示顺序,不改 cmp 里保存的选择顺序(移除、清空都按院校号定位) +let cmpSortNear = localStorage.getItem('zexiao_cmpsort') === '1'; let fav = (JSON.parse(localStorage.getItem('zexiao_fav') || '[]')).filter(n => byNo[n]); let mineShowAll = false; let mineEdit = false; // 收藏列表的编辑态 @@ -1804,7 +1857,14 @@ function home() {

${matching.length ? '依据 2027 目录中当前专业的开设记录,按你的目标分给出冲/稳/保各一所推荐。' : DIR_LOAD_ERRORS.has(major) ? '当前专业目录加载失败,暂按院校标签展示;请核对专业开设情况。 ' : directory == null ? '当前专业目录加载中,暂按已有院校标签展示。' : '当前专业目录暂无可展示的匹配记录,按已有院校标签展示;请核对专业开设情况。'}复试线可能为方向区间,报考信息以院校当年公告为准。

`; } -function row(x) { +function row(x, hasM) { + if (hasM === false) { + return `
+ +
${x.name}未开设 ${esc(major)}›
+
2027 官方目录里这所学校没有 ${esc(major)},分数线与拟招人数不适用
+
看该校其他专业 ›
`; + } return `
${x.name}${tierChip(x)}${x.city||x.prov||'—'}›
${x.tags.slice(0,3).map(t=>`${t}`).join('')}${evBadge(x)}
@@ -1914,8 +1974,25 @@ function list() {
-
共 ${onlyMajor && !nOffer ? '—' : listTotal} 所院校
${act.length ? '筛选条件:'+esc(act.join(' · ')) : '全部院校'}
- ${shownArr.length? shownArr.map(row).join('') : onlyMajor && !nOffer ? D ? `
ⓘ 已选筛选条件
${filterChips}

暂无专业方向明细

无法按开设情况筛选

可在更多筛选中取消“仅看本专业开设”

` : `
正在加载专业方向数据…
可在更多筛选中取消“仅看本专业开设”。
` : `
ⓘ 已选筛选条件
${act.length ? filterChips : '暂无筛选条件'}

没有找到符合条件的院校

试试放宽地区、院校类型或其他条件

`} + ${(() => { + const hasM = x => !!(D && D[String(x.no)]); + const offerN = arr.filter(hasM).length; + const offN = arr.length - offerN; + // 开关要在「只看本专业」时也留着,否则切不回全部 + const offAll = D ? Math.max(0, S.length - Object.keys(D).length) : 0; + return `
+
${offerN} 所开设 ${esc(mName())}
+ ${offN ? `
另有 ${offN} 所院校在 2027 目录中没有 ${esc(major)}
` : ''}
+
${offAll ? `` : ''}
${act.length ? '筛选条件:'+esc(act.join(' · ')) : '全部院校'}
+
`; + })()} + ${shownArr.length? (() => { + const hasM = x => !!(D && D[String(x.no)]); + const on = shownArr.filter(hasM), off = shownArr.filter(x => !hasM(x)); + const offTotal = arr.filter(x => !hasM(x)).length; + const bar = (on.length && off.length) ? `
以下 ${offTotal} 所院校在 2027 目录里没有 ${esc(major)},排在最后
` : ''; + return on.map(x => row(x, true)).join('') + bar + off.map(x => row(x, false)).join(''); + })() : onlyMajor && !nOffer ? D ? `
ⓘ 已选筛选条件
${filterChips}

暂无专业方向明细

无法按开设情况筛选

可在更多筛选中取消“仅看本专业开设”

` : `
正在加载专业方向数据…
可在更多筛选中取消“仅看本专业开设”。
` : `
ⓘ 已选筛选条件
${act.length ? filterChips : '暂无筛选条件'}

没有找到符合条件的院校

试试放宽地区、院校类型或其他条件

`} ${!listTotal ? '' : `
${shown < listTotal ? `已显示 ${shownArr.length} / ${listTotal} 所,继续下滑加载。` : `共 ${listTotal} 所(招生单位 ${S.length},其中 ${S.filter(HAS).length} 所有校园影像,其余 ${S.length - S.filter(HAS).length} 所为科研院所、军工单位、党校等,源侧无公开影像)。点右侧 + 加入对比,最多 4 所。`}
`}`; } // 搜不到时的近邻:简称、漏字、顺序颠倒是最常见的失败方式(「南师」→ 南京师范大学) @@ -2083,7 +2160,7 @@ function marginPhrase(x) { return d >= 0 ? `已高于录取均分 ${d} 分` : `离录取均分还差 ${-d} 分`; } // 对比结论:只比分数距离与规模,缺数据不参与比较 -function cmpVerdict(list) { +function cmpVerdict(list, sorted = false) { if (!list.length) return ''; // 余量=目标分相对该档判定门槛的富余(冲比线上限,稳/保比录取均分,缺均分比上限+15), // 只有同一把尺子才允许排序比较;展示仍用 gapView 的标签。 @@ -2116,11 +2193,19 @@ function cmpVerdict(list) { return `${esc(x.name)} ${pn ? `2027 拟招 ${pn} 人` : ''}${pn && an ? '、' : ''}${an ? `2026 录取 ${an} 人` : ''}`; }).join(';') + '。'; } - return `
对比结论目标分 ${goal} | 按 2026 复试线上限与录取均分比较

${text}

结论只说明分数距离,不代表录取概率;缺数据的维度显示「—」,不参与比较。

`; + return `
对比结论目标分 ${goal} | 按 2026 复试线上限与录取均分比较

${text}

${sorted ? '

列序按与 2026 复试线上限的分差绝对值由近到远(同院校库「分差最近」);结论里的最容易/要求最高按冲稳保富余算,两者尺子不同。缺复试线或分制不同的院校排在最后。

' : ''}

结论只说明分数距离,不代表录取概率;缺数据的维度显示「—」,不参与比较。

`; } function cmpView() { - const list = cmp.map(n => byNo[n]); + const picked = cmp.map(n => byNo[n]); + // 「按分差排序」用的距离=|目标分 − 2026 复试线上限|,与院校库「分差最近」同一把尺子; + // 300 分制专业或没有复试线的院校算不出距离(gapOf 返回 null),一路排最后并保留原来的相对顺序。 + const nearDist = x => { const g = gapOf(x); return g === null ? null : Math.abs(g); }; + const list = cmpSortNear + ? picked.map((x, i) => ({ x, i, d: nearDist(x) })) + .sort((a, b) => (a.d === null ? 1 : 0) - (b.d === null ? 1 : 0) || (a.d === null ? 0 : a.d - b.d) || a.i - b.i) + .map(o => o.x) + : picked; if (!list.length) return `
院校对比多维数据横向对比
当前专业${esc(mName())}
对比院校${''.repeat(4)}${[['地区',''],['复试线',''],['拟招人数',''],['录取人数',''],['学科评估','']].map(([label,icon])=>`${label}${'
—
'.repeat(4)}`).join('')}

暂无对比院校

最多可选 4 所院校

数据说明:选择院校后可查看各项数据及来源;不同年份和统计口径的数据不宜直接比较。
`; // 主数字为已观测方向线的上限;下限只标为区间下限,不推断是否为专项。 const lineCell = x => { @@ -2195,10 +2280,10 @@ function cmpView() { const group = (name, note, items) => `
${name}${note}
${items.filter(Boolean).map(compareRow).join('')}
`; return `
院校对比多维数据横向对比
当前专业${mName()}
-
已选院校(${list.length})
${list.map(x=>``).join('')}
${list.length<4?'':''}
- ${cmpVerdict(list)} +
已选(${list.length})
${list.map(x=>``).join('')}
${list.length > 1 && !is300() ? `` : ''}${list.length<4?'':''}
+ ${cmpVerdict(list, cmpSortNear)}
对比维度蓝点=该行相对更有利的一侧只为方便横向比较,不代表录取概率
- ${list.map(x=>`
`).join('')}${'
'.repeat(emptySlots)}
+ ${list.map((x,i)=>`
`).join('')}${'
'.repeat(emptySlots)}
${list.length === 2 ? group('基础信息','院校及学科信息',[rowNamed('城市'),rowNamed('层次'),['主管部门',()=> ''],rowNamed('学科评估')]) + group('历年分数线','复试线 · 总分',[rowNamed('目标分差'),rowNamed('复试线'),['2025 复试线',line25],['2024 复试线',()=> '']]) + group('招生信息','年份与口径见指标说明',[rowNamed('拟招'),rowNamed('录取人数'),rowNamed('录取均分'),rowNamed('录取最低'),rowNamed('较2025'),rowNamed('方向码数')]) : rows.slice(0, major === '0856' ? 5 : 4).map(([k,f,dir])=>{ return compareRow([k,f,dir]); }).join('')} @@ -2713,7 +2798,7 @@ function openSettings(kind, onboarding = false, state = null) { '14':'' }; const categoryIcon = k => ``; - screen.innerHTML = `${head}
${targetIcon}

${onboarding ? '先选择目标专业' : '选择目标专业'}

${onboarding ? '选择专业后查看院校与招生信息。' : '选择后查看对应院校与数据。'}

`; + screen.innerHTML = `${head}
${targetIcon}

${onboarding ? '先选择目标专业' : '选择目标专业'}

${onboarding ? '选择专业后查看院校与招生信息。' : '选择后查看对应院校与数据。'}

`; const search = screen.querySelector('.settings-search'); let majorSort = 'code'; const draw = () => { @@ -2892,7 +2977,8 @@ function render() { document.querySelectorAll('[data-rec-no-home]').forEach(e => e.onclick = () => { recNoHome = true; recForceHome = false; recSeed++; render(); }); document.querySelectorAll('[data-rec-force-home]').forEach(e => e.onclick = () => { recForceHome = true; recNoHome = false; recSeed++; render(); }); // 占位卡的出口:这一档空着,就去院校库按分差看全部,别让用户卡在原地 - document.querySelectorAll('[data-tier-def]').forEach(e => e.onclick = () => { tierDefOpen = !tierDefOpen; render(); }); + document.querySelectorAll('[data-cmpsort]').forEach(e => e.onclick = () => { cmpSortNear = !cmpSortNear; localStorage.setItem('zexiao_cmpsort', cmpSortNear ? '1' : '0'); render(); }); +document.querySelectorAll('[data-tier-def]').forEach(e => e.onclick = () => { tierDefOpen = !tierDefOpen; localStorage.setItem('zexiao_tierdef', tierDefOpen ? '1' : '0'); render(); }); document.querySelectorAll('[data-tier-all]').forEach(e => e.onclick = () => { tierSel = ''; if (view !== 'list') { onlyMajor = true; localStorage.setItem('zexiao_onlymajor', '1'); } @@ -2926,8 +3012,8 @@ function render() { document.querySelectorAll('[data-sortmore]').forEach(e => e.onclick = () => { sortk = e.dataset.sortmore; shown = 80; render(); }); const listMore = document.querySelector('.list-more'); if (listMore) listMore.ontoggle = () => { listMoreOpen = listMore.open; }; - document.querySelectorAll('[data-reset-list]').forEach(e => e.onclick = () => { tag = '全部'; prov = '全部'; citySel = '全部'; kw = ''; sortk = 'no'; tierSel = ''; onlyMajor = false; localStorage.setItem('zexiao_onlymajor', '0'); shown = 80; render(); }); - document.querySelectorAll('[data-remove-list-filter]').forEach(e => e.onclick = () => { const key = e.dataset.removeListFilter; if (key === 'tag') tag = '全部'; if (key === 'province') { prov = '全部'; citySel = '全部'; } if (key === 'city') citySel = '全部'; if (key === 'keyword') kw = ''; if (key === 'major') { onlyMajor = false; localStorage.setItem('zexiao_onlymajor', '0'); } if (key === 'sort') sortk = 'no'; if (key === 'tier') tierSel = ''; shown = 80; render(); }); + document.querySelectorAll('[data-reset-list]').forEach(e => e.onclick = () => { tag = '全部'; prov = '全部'; citySel = '全部'; kw = ''; sortk = 'no'; tierSel = ''; onlyMajor = true; localStorage.setItem('zexiao_onlymajor', '1'); shown = 80; render(); }); + document.querySelectorAll('[data-remove-list-filter]').forEach(e => e.onclick = () => { const key = e.dataset.removeListFilter; if (key === 'tag') tag = '全部'; if (key === 'province') { prov = '全部'; citySel = '全部'; } if (key === 'city') citySel = '全部'; if (key === 'keyword') kw = ''; if (key === 'major') { onlyMajor = true; localStorage.setItem('zexiao_onlymajor', '1'); } if (key === 'sort') sortk = 'no'; if (key === 'tier') tierSel = ''; shown = 80; render(); }); document.querySelectorAll('[data-adjust-list]').forEach(e => e.onclick = () => { const more = document.querySelector('.list-more'); if (more) { listMoreOpen = true; more.open = true; more.querySelector('summary').focus(); more.scrollIntoView({behavior:'smooth',block:'center'}); } }); document.querySelectorAll('[data-rm]').forEach(e => e.onclick = () => { toggleCmp(+e.dataset.rm); }); document.querySelectorAll('[data-clear]').forEach(e => e.onclick = () => { cmp = []; save(); render(); }); @@ -3181,7 +3267,7 @@ function applyHash() { dirCode = qs.get('dir') || ''; dirMerge = qs.has('merge') ? qs.get('merge') === '1' : localStorage.getItem('zexiao_dirmerge') !== '0'; expSet = new Set((qs.get('exp') || '').split(',').map(Number).filter(n => n)); - onlyMajor = qs.get('om') === '1'; + if (qs.has('om')) onlyMajor = qs.get('om') === '1'; if (qs.get('no')) { const t = byNo[+qs.get('no')]; if (t) cur = t; } if (qs.get('major') && MJ[qs.get('major')]) major = qs.get('major'); if (qs.get('theme')) theme = qs.get('theme'); diff --git a/docs/研选E决策层_20261112/37_对比页贴近度排序.png b/docs/研选E决策层_20261112/37_对比页贴近度排序.png new file mode 100644 index 000000000..db2fab755 Binary files /dev/null and b/docs/研选E决策层_20261112/37_对比页贴近度排序.png differ diff --git a/docs/研选E决策层_20261112/37_对比页贴近度排序.txt b/docs/研选E决策层_20261112/37_对比页贴近度排序.txt new file mode 100644 index 000000000..7f3d50a19 --- /dev/null +++ b/docs/研选E决策层_20261112/37_对比页贴近度排序.txt @@ -0,0 +1,14 @@ +参考图是一张中文手机 App「院校对比」页的真实截图(390×844 @2x)。请严格沿用参考图的版式、配色、字号层级、卡片圆角、图标笔触,只在下述位置做改动,输出一张同样风格的整屏界面稿。 + +改动一:在「已选院校(3)」这一行,右侧「⊕ 添加院校」按钮的左边,新增一个轻量的排序开关按钮。 +- 默认态:白底、1px 浅灰蓝描边、胶囊圆角,左侧一个上下箭头图标,文案「按分差排序」。 +- 激活态:浅蓝底、主色描边,图标与文字变成主色深蓝,文案改成「分差最近优先」,右侧带一个小对勾。 +- 这个按钮比「添加院校」按钮矮一点、字更小(约 11–12px),不要抢主按钮的视觉。 + +改动二:激活排序后,对比表的院校列顺序按「与目标分的分差绝对值由近到远」重排,并在每所院校的照片下方、校名上方,加一个很细的排名徽标,形如「近 1」「近 2」,浅灰蓝底、9–10px、圆角 4px,字号明显小于校名。没有 2026 复试线、无法计算分差的院校排在最后一列,徽标位置显示灰色「无分差」而不是数字。 + +改动三:对比结论卡片右上角原来的「目标分 340 │ 按 2026 复试线上限与录取均分比较」,在激活排序后追加一行小字提示:「已按分差由近到远排列;缺复试线的院校排在最后」。这行提示用 10–11px 灰字,不要做成新卡片。 + +其余部分保持不变:顶部深蓝渐变标题栏(研选 / 研究生院校与专业选择 / 书签与铃铛图标)、标题「院校对比」+红色下划线、「‹ 返回院校库」描边按钮、当前专业条(0856 材料与化工 / 切换专业 ›)、对比结论段落、三列对比表(对比维度 / 东南大学 / 天水师范大学 / 运城学院)与蓝点「该行相对更有利」图例、数据说明条、底部三个按钮(返回院校库 / 清空对比 / 添加院校)、最底部四个 Tab(首页 / 院校库 / 对比(3) / 我的,对比 Tab 为主色并有红色下划线)。 + +细节要求:中文全部用简体,不要出现英文单词;不要出现任何标注箭头、批注、尺寸线、色板、说明文字框;不要手机外框与刘海,只要界面本体;整体干净、留白均匀、密度接近参考图;数字仅为占位示例(东南大学 347/1025、天水师范大学 325/4),照抄参考图即可,不要自行编造更多数字。 diff --git a/docs/研选E决策层_20261112/38_列表专业口径.png b/docs/研选E决策层_20261112/38_列表专业口径.png new file mode 100644 index 000000000..4bdf12158 Binary files /dev/null and b/docs/研选E决策层_20261112/38_列表专业口径.png differ diff --git a/docs/研选E决策层_20261112/38_列表专业口径.txt b/docs/研选E决策层_20261112/38_列表专业口径.txt new file mode 100644 index 000000000..68239b284 --- /dev/null +++ b/docs/研选E决策层_20261112/38_列表专业口径.txt @@ -0,0 +1,23 @@ +参考图是一张中文手机 App「院校库」列表页的真实截图(390×844 @2x)。请严格沿用参考图的版式、配色、字号层级、卡片圆角、图标笔触、顶部深蓝渐变标题栏与底部四个 Tab,只在下述三处做改动,输出一张同样风格的整屏稿。 + +改动一:列表标题行。 +现在写的是「共 907 所院校」,右侧是「全部院校 清空」。改成三段式: +- 左侧主数字改成「362 所」,「所」小一号,后面跟一行同字号但更浅的灰字「开设 0856 材料与化工」; +- 这行下面加一行 10–11px 灰字:「另有 545 所院校在 2027 目录中没有 0856」; +- 右侧「全部院校 清空」保留,但在它左边新增一个胶囊开关,文案「也看没开设的」,默认关闭态(白底、1px 浅灰蓝描边、灰字),激活态才变浅蓝底主色字。 +主数字「362 所」要明显比现在的「共 907 所院校」更醒目,字号约 16–17px、加重;「开设 0856 材料与化工」12px 常规灰,不要抢主数字。 + +改动二:把「没开设本专业」的院校卡片改成另一种更矮的形态。 +现在的空卡与正常卡同高,照片占左半,右侧三个指标全是灰色横杠「—」。改成: +- 卡片高度压到正常卡的三分之二左右,不再用大照片,左侧换成一个小尺寸的方形校徽占位(56×56、浅灰蓝底、居中一个书本线性图标); +- 右侧第一行校名,校名后跟一个浅灰小标签「未开设 0856」; +- 第二行一行 11px 灰字说明:「2027 官方目录里这所学校没有 0856,分数线与拟招人数不适用」; +- 第三行最右侧一个文字按钮「看该校其他专业 ›」,主色、11px、无边框; +- 整张卡不再出现「2026 复试线」「2027 拟招」「距录取均分」这三个指标块,也不出现对比与收藏按钮。 + +改动三:在两批卡片之间加一条分组分隔带。 +在最后一张有数据的卡片之后、第一张「未开设」卡之前,插入一条横贯整行、高约 40px、浅灰蓝底圆角的提示带,居中一行 11px 字:「以下 545 所院校在 2027 目录里没有 0856,排在最后」。 + +其余部分一律保持不变:顶部「研选 / 研究生院校与专业选择 / 书签与铃铛」、标题「院校库」+红色下划线+副标题「按专业、地区等条件筛选研究生招生院校」、搜索框与蓝色「搜索」按钮、当前专业与目标分两个下拉条、分差视角卡(本专业开设 362 所|目标分 340,冲 50 / 稳 29 / 保 280 三个方块,下面一行口径说明)、地区/院校类型/排序三行筛选、以及四张正常院校卡片(上海大学、沈阳航空航天大学、杭州师范大学、厦门理工学院,保留原有照片、校名后的「保」标签、城市标签、211/双一流标签、三指标块与对比收藏按钮)。底部 Tab 四个:首页 / 院校库 / 对比 / 我的,院校库为主色带红色下划线。 + +细节要求:中文全部用简体,不要英文单词;不要任何标注箭头、批注、尺寸线、色板、说明文字框;不要手机外框与刘海,只要界面本体;整体干净、留白均匀、密度接近参考图;数字仅为占位示例,照抄参考图与上述文案,不要自行编造更多数字。 diff --git a/docs/研选E决策层_20261112/README.md b/docs/研选E决策层_20261112/README.md index cb75937a6..b5166c30c 100644 --- a/docs/研选E决策层_20261112/README.md +++ b/docs/研选E决策层_20261112/README.md @@ -1103,3 +1103,87 @@ if (!arr.length) return `
e.length') + print('最终卡片数:', n) + + stat = pg.evaluate("""() => { + const cards = [...document.querySelectorAll('.e-result')]; + const empty = [], full = []; + for (const el of cards) { + const bs = el.querySelectorAll('.e-result-metrics b'); + const line = bs[0] ? bs[0].innerText.trim() : ''; + const rec = {n: (el.querySelector('.e-result-title b') || {}).innerText || '', + line, plan: bs[1] ? bs[1].innerText.trim() : '', + label: (el.querySelector('.e-result-gap small') || {}).innerText || '', + gap: (el.querySelector('.e-result-gap b') || {}).innerText || ''}; + (line === '—' || line === '' ? empty : full).push(rec); + } + return {total: cards.length, emptyCount: empty.length, fullCount: full.length, + emptySample: empty.slice(0, 6), last3: full.slice(-3), + hint: (document.querySelector('.hint') || {}).innerText || ''}; + }""") + print(json.dumps(stat, ensure_ascii=False, indent=2)) + pg.screenshot(path=os.path.join(ROOT, '运行暂存', 'ui_round35_20261117', '04_list_bottom.png')) + b.close() diff --git a/运行暂存/probe_avg_data.py b/运行暂存/probe_avg_data.py new file mode 100644 index 000000000..8cef1fcea --- /dev/null +++ b/运行暂存/probe_avg_data.py @@ -0,0 +1,50 @@ +# -*- coding: utf-8 -*- +"""在页面里读真实数据:几所学校的 avgS / hi / gap,验证「距录取均分 ±0」是不是数据本身。""" +import os +import json + +from playwright.sync_api import sync_playwright + +ROOT = r'D:\择校' +URL = 'file:///' + os.path.join(ROOT, 'docs', '择校UI', 'index.html').replace('\\', '/') +CHROME = r'C:\Program Files\Google\Chrome\Application\chrome.exe' + +with sync_playwright() as p: + b = p.chromium.launch(executable_path=CHROME, headless=True, args=['--allow-file-access-from-files']) + ctx = b.new_context(viewport={'width': 390, 'height': 844}) + pg = ctx.new_page() + pg.goto(URL + '#view=list&major=0856&goal=340', wait_until='load') + pg.wait_for_timeout(1200) + + out = pg.evaluate("""() => { + const res = []; + const names = ['上海大学','沈阳航空航天大学','杭州师范大学','厦门理工学院','东南大学']; + for (const n of names) { + const x = (typeof ALL !== 'undefined' ? ALL : []).find(a => a.n === n || a.name === n); + if (!x) { res.push({name: n, miss: true}); continue; } + const v = V(x); + res.push({name: n, no: x.no, prov: x.prov, line: v.line, minS: v.minS, avgS: v.avgS, + avgOf: avgOf(x), gapOf: gapOf(x), tier: tierOf(x), gapView: gapView(x)}); + } + return {res, total: (typeof ALL !== 'undefined' ? ALL.length : -1), + majors: (typeof majorPool === 'function' ? majorPool().length : -1)}; + }""") + print(json.dumps(out, ensure_ascii=False, indent=2)) + + # 统计全库 avgS 分布,看有多少等于 340 + stat = pg.evaluate("""() => { + const arr = (typeof majorPool === 'function' ? majorPool() : []); + let has = 0, eq340 = 0, nulls = 0; + const samples = []; + for (const x of arr) { + const a = avgOf(x); + if (a === null) nulls++; + else { + has++; + if (a === 340) { eq340++; if (samples.length < 5) samples.push(x.n); } + } + } + return {pool: arr.length, hasAvg: has, eq340, nulls, samples}; + }""") + print('\n本专业池统计:', json.dumps(stat, ensure_ascii=False)) + b.close() diff --git a/运行暂存/probe_cards_all.py b/运行暂存/probe_cards_all.py new file mode 100644 index 000000000..0da5d775b --- /dev/null +++ b/运行暂存/probe_cards_all.py @@ -0,0 +1,43 @@ +# -*- coding: utf-8 -*- +"""加载全部卡片,统计「不招本专业」的院校在列表里显示什么。""" +import json +import os + +from playwright.sync_api import sync_playwright + +ROOT = r'D:\择校' +URL = 'file:///' + os.path.join(ROOT, 'docs', '择校UI', 'index.html').replace('\\', '/') +CHROME = r'C:\Program Files\Google\Chrome\Application\chrome.exe' + +with sync_playwright() as p: + b = p.chromium.launch(executable_path=CHROME, headless=True, args=['--allow-file-access-from-files']) + ctx = b.new_context(viewport={'width': 390, 'height': 844}) + pg = ctx.new_page() + pg.goto(URL + '#view=list&major=0856&goal=340', wait_until='load') + pg.wait_for_timeout(1500) + + # 列表每次 80,滚到底会追加 + for i in range(14): + pg.evaluate("""() => { + const el = document.querySelector('.e-content') || document.scrollingElement; + el.scrollTop = el.scrollHeight; + }""") + pg.wait_for_timeout(400) + + stat = pg.evaluate("""() => { + const cards = [...document.querySelectorAll('.e-result')]; + const empty = [], withLine = []; + for (const el of cards) { + const bs = el.querySelectorAll('.e-result-metrics b'); + const line = bs[0] ? bs[0].innerText.trim() : ''; + const name = (el.querySelector('.e-result-title b') || {}).innerText || ''; + const label = (el.querySelector('.e-result-gap small') || {}).innerText || ''; + const gap = (el.querySelector('.e-result-gap b') || {}).innerText || ''; + (line === '—' || line === '' ? empty : withLine).push({name, line, label, gap}); + } + return {total: cards.length, emptyCount: empty.length, + emptySample: empty.slice(0, 8), tail: withLine.slice(-5)}; + }""") + print(json.dumps(stat, ensure_ascii=False, indent=2)) + print('标题:', pg.inner_text('.list-count-row').split('\n')[0]) + b.close() diff --git a/运行暂存/probe_cards_text.py b/运行暂存/probe_cards_text.py new file mode 100644 index 000000000..9cdbe1560 --- /dev/null +++ b/运行暂存/probe_cards_text.py @@ -0,0 +1,41 @@ +# -*- coding: utf-8 -*- +"""抓列表卡片实际显示,看「不招本专业」的院校是空白还是顶着别的专业的数据。""" +import json +import os +import re + +from playwright.sync_api import sync_playwright + +ROOT = r'D:\择校' +URL = 'file:///' + os.path.join(ROOT, 'docs', '择校UI', 'index.html').replace('\\', '/') +CHROME = r'C:\Program Files\Google\Chrome\Application\chrome.exe' + +with sync_playwright() as p: + b = p.chromium.launch(executable_path=CHROME, headless=True, args=['--allow-file-access-from-files']) + ctx = b.new_context(viewport={'width': 390, 'height': 844}) + pg = ctx.new_page() + pg.goto(URL + '#view=list&major=0856&goal=340', wait_until='load') + pg.wait_for_timeout(1500) + + cards = pg.evaluate("""() => [...document.querySelectorAll('.e-result')].map(el => ({ + name: (el.querySelector('.e-result-title b') || {}).innerText || '', + line: (el.querySelectorAll('.e-result-metrics b')[0] || {}).innerText || '', + plan: (el.querySelectorAll('.e-result-metrics b')[1] || {}).innerText || '', + gapLabel: (el.querySelector('.e-result-gap small') || {}).innerText || '', + gapVal: (el.querySelector('.e-result-gap b') || {}).innerText || '', + tier: (el.querySelector('.e-tier, .tier-chip') || {}).innerText || '' + }))""") + print('卡片数:', len(cards)) + empty = [c for c in cards if c['line'] in ('—', '')] + print('复试线为空的卡:', len(empty)) + print('\n前 8 张:') + for c in cards[:8]: + print(' ', json.dumps(c, ensure_ascii=False)) + print('\n为空的示例:') + for c in empty[:6]: + print(' ', json.dumps(c, ensure_ascii=False)) + + # 合计口径 + print('\n标题行:', pg.inner_text('.list-count-row')) + print('分差视角:', pg.inner_text('.e-count, #gapBar')[:120] if pg.query_selector('#gapBar') else pg.inner_text('body')[:0]) + b.close() diff --git a/运行暂存/probe_count_gap.py b/运行暂存/probe_count_gap.py new file mode 100644 index 000000000..92737421e --- /dev/null +++ b/运行暂存/probe_count_gap.py @@ -0,0 +1,26 @@ +# -*- coding: utf-8 -*- +"""查两处:列表标题的「共 N 所」怎么来的;卡片「距录取均分」的 gapOf 怎么算。""" +import io +import re + +s = io.open(r'D:\择校\docs\择校UI\index.html', encoding='utf-8').read() + +print('=== 共 N 所 ===') +for m in re.finditer(r'共[^<]{0,40}所', s): + print(' at', m.start(), '|', s[max(0, m.start() - 120):m.start() + 60].replace('\n', ' ')) + +print('\n=== gapOf ===') +i = s.find('function gapOf') +if i < 0: + i = s.find('const gapOf') +print(s[i:i + 700] if i > 0 else '没找到') + +print('\n=== gapView ===') +j = s.find('function gapView') +if j < 0: + j = s.find('const gapView') +print(s[j:j + 700] if j > 0 else '没找到') + +print('\n=== 距录取均分渲染 ===') +for m in re.finditer(r'距录取均分', s): + print(' at', m.start(), '|', s[max(0, m.start() - 260):m.start() + 160].replace('\n', ' ')) diff --git a/运行暂存/probe_detail_view.py b/运行暂存/probe_detail_view.py new file mode 100644 index 000000000..687ecf698 --- /dev/null +++ b/运行暂存/probe_detail_view.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- +"""定位详情页渲染代码与结构。""" +import io +import re + +s = io.open(r'D:\择校\docs\择校UI\index.html', encoding='utf-8').read() + +for pat in [r"'detail'", r'vDetail', r'detailHTML', r'd-view', r'class="d-']: + hits = [m.start() for m in re.finditer(pat, s)] + print('%-14s %d 处' % (pat, len(hits))) + for i in hits[:4]: + print(' ...', s[max(0, i - 90):i + 70].replace('\n', ' ')) + +print('\n--- 视图分发处 ---') +for m in re.finditer(r'view\s*===?\s*[\'"]\w+[\'"]', s): + print(' ', m.group(0), 'at', m.start()) diff --git a/运行暂存/probe_loadmore.py b/运行暂存/probe_loadmore.py new file mode 100644 index 000000000..ab732fed8 --- /dev/null +++ b/运行暂存/probe_loadmore.py @@ -0,0 +1,48 @@ +# -*- coding: utf-8 -*- +"""诊断:列表「共 907 所」但只渲染 80 张,滚动能不能继续加载。""" +import os + +from playwright.sync_api import sync_playwright + +ROOT = r'D:\择校' +URL = 'file:///' + os.path.join(ROOT, 'docs', '择校UI', 'index.html').replace('\\', '/') +CHROME = r'C:\Program Files\Google\Chrome\Application\chrome.exe' + +with sync_playwright() as p: + b = p.chromium.launch(executable_path=CHROME, headless=True, args=['--allow-file-access-from-files']) + ctx = b.new_context(viewport={'width': 390, 'height': 844}) + pg = ctx.new_page() + pg.goto(URL + '#view=list&major=0856&goal=340', wait_until='load') + pg.wait_for_timeout(1500) + + print('初始卡片:', pg.eval_on_selector_all('.e-result', 'e=>e.length')) + print('滚动容器诊断:', pg.evaluate("""() => { + const out = []; + for (const sel of ['.e-content', '.e-home', 'main', 'body']) { + const el = document.querySelector(sel); + if (!el) continue; + const cs = getComputedStyle(el); + out.push({sel, sh: el.scrollHeight, ch: el.clientHeight, + overflow: cs.overflowY, scrollable: el.scrollHeight > el.clientHeight + 5}); + } + return out; + }""")) + + # 用真实的滚动:wheel 在内容区 + for i in range(8): + pg.mouse.move(195, 600) + pg.mouse.wheel(0, 3000) + pg.wait_for_timeout(500) + print('wheel 之后卡片:', pg.eval_on_selector_all('.e-result', 'e=>e.length')) + + # 试试直接把 .e-content 滚到底并派发 scroll 事件 + pg.evaluate("""() => { + const el = document.querySelector('.e-content'); + if (el) { el.scrollTop = el.scrollHeight; el.dispatchEvent(new Event('scroll', {bubbles: true})); } + window.scrollTo(0, document.body.scrollHeight); + window.dispatchEvent(new Event('scroll')); + }""") + pg.wait_for_timeout(1200) + print('dispatch 之后卡片:', pg.eval_on_selector_all('.e-result', 'e=>e.length')) + print('页面里是否有「加载更多」按钮:', pg.eval_on_selector_all('button', "e=>e.filter(b=>/加载|更多/.test(b.innerText)).map(b=>b.innerText.trim()).slice(0,5)")) + b.close() diff --git a/运行暂存/probe_missing_major.py b/运行暂存/probe_missing_major.py new file mode 100644 index 000000000..8b0aa0de4 --- /dev/null +++ b/运行暂存/probe_missing_major.py @@ -0,0 +1,36 @@ +# -*- coding: utf-8 -*- +"""关键核查:列表里那些「不招本专业」的院校,卡片上显示的是谁的数据? + +如果 V(x) 对缺失专业回落到该校别的专业,列表就在用别的专业的分数线冒充本专业。 +""" +import json +import os + +from playwright.sync_api import sync_playwright + +ROOT = r'D:\择校' +URL = 'file:///' + os.path.join(ROOT, 'docs', '择校UI', 'index.html').replace('\\', '/') +CHROME = r'C:\Program Files\Google\Chrome\Application\chrome.exe' + +with sync_playwright() as p: + b = p.chromium.launch(executable_path=CHROME, headless=True, args=['--allow-file-access-from-files']) + ctx = b.new_context(viewport={'width': 390, 'height': 844}) + pg = ctx.new_page() + pg.goto(URL + '#view=list&major=0856&goal=340', wait_until='load') + pg.wait_for_timeout(1300) + + out = pg.evaluate("""() => { + const noMajor = S.filter(x => !D[String(x.no)]); + const withMajor = S.filter(x => D[String(x.no)]); + const sample = noMajor.slice(0, 5).map(x => { + const v = V(x); + return {n: x.n, no: x.no, prov: x.prov, + line: v.line, minS: v.minS, avgS: v.avgS, plan: v.plan, + hasMajorData: !!D[String(x.no)], + majorKeys: D[String(x.no)] ? D[String(x.no)].length : 0}; + }); + // V() 的来源 + return {total: S.length, noMajor: noMajor.length, withMajor: withMajor.length, sample}; + }""") + print(json.dumps(out, ensure_ascii=False, indent=2)) + b.close() diff --git a/运行暂存/probe_onlymajor.py b/运行暂存/probe_onlymajor.py new file mode 100644 index 000000000..3eca19487 --- /dev/null +++ b/运行暂存/probe_onlymajor.py @@ -0,0 +1,13 @@ +# -*- coding: utf-8 -*- +"""查 onlyMajor 的默认值、切换入口、「共 N 所院校」的模板来源。""" +import io +import re + +s = io.open(r'D:\择校\docs\择校UI\index.html', encoding='utf-8').read() + +for pat in [r'onlyMajor', r'共\s*\$\{[^}]*\}\s*所院校', r'所院校']: + hits = list(re.finditer(pat, s)) + print('=== %s : %d 处 ===' % (pat, len(hits))) + for m in hits[:8]: + print(' at', m.start(), '|', s[max(0, m.start() - 150):m.start() + 110].replace('\n', ' ')) + print() diff --git a/运行暂存/probe_row_template.py b/运行暂存/probe_row_template.py new file mode 100644 index 000000000..0c24a5af7 --- /dev/null +++ b/运行暂存/probe_row_template.py @@ -0,0 +1,13 @@ +# -*- coding: utf-8 -*- +"""看列表卡片模板:不招本专业的院校渲染成什么。""" +import io +import re + +s = io.open(r'D:\择校\docs\择校UI\index.html', encoding='utf-8').read() + +for pat in [r'未开设', r'不招', r'nOffer', r'function row', r'const row']: + hits = list(re.finditer(pat, s)) + print('=== %s : %d 处 ===' % (pat, len(hits))) + for m in hits[:6]: + print(' at', m.start(), '|', s[max(0, m.start() - 200):m.start() + 200].replace('\n', ' ')) + print() diff --git a/运行暂存/probe_scroll_all.py b/运行暂存/probe_scroll_all.py new file mode 100644 index 000000000..9375ebbb5 --- /dev/null +++ b/运行暂存/probe_scroll_all.py @@ -0,0 +1,48 @@ +# -*- coding: utf-8 -*- +"""滚到底,统计 907 张里「不招本专业」的院校卡片显示什么。""" +import json +import os + +from playwright.sync_api import sync_playwright + +ROOT = r'D:\择校' +URL = 'file:///' + os.path.join(ROOT, 'docs', '择校UI', 'index.html').replace('\\', '/') +CHROME = r'C:\Program Files\Google\Chrome\Application\chrome.exe' + +with sync_playwright() as p: + b = p.chromium.launch(executable_path=CHROME, headless=True, args=['--allow-file-access-from-files']) + ctx = b.new_context(viewport={'width': 390, 'height': 844}) + pg = ctx.new_page() + pg.goto(URL + '#view=list&major=0856&goal=340', wait_until='load') + pg.wait_for_timeout(1500) + + last = 0 + for i in range(40): + pg.mouse.move(195, 600) + pg.mouse.wheel(0, 4000) + pg.wait_for_timeout(320) + n = pg.eval_on_selector_all('.e-result', 'e=>e.length') + if n == last and i > 6: + print('停在第 %d 次滚动,卡片 %d 张' % (i + 1, n)) + break + last = n + print('最终卡片数:', last) + + stat = pg.evaluate("""() => { + const cards = [...document.querySelectorAll('.e-result')]; + const empty = [], full = []; + for (const el of cards) { + const bs = el.querySelectorAll('.e-result-metrics b'); + const line = bs[0] ? bs[0].innerText.trim() : ''; + const name = (el.querySelector('.e-result-title b') || {}).innerText || ''; + const rec = {name, line, + plan: bs[1] ? bs[1].innerText.trim() : '', + label: (el.querySelector('.e-result-gap small') || {}).innerText || '', + gap: (el.querySelector('.e-result-gap b') || {}).innerText || ''}; + (line === '—' || line === '' ? empty : full).push(rec); + } + return {total: cards.length, emptyCount: empty.length, fullCount: full.length, + emptySample: empty.slice(0, 6), lastFew: full.slice(-3)}; + }""") + print(json.dumps(stat, ensure_ascii=False, indent=2)) + b.close() diff --git a/运行暂存/probe_scroll_seq.py b/运行暂存/probe_scroll_seq.py new file mode 100644 index 000000000..93a461801 --- /dev/null +++ b/运行暂存/probe_scroll_seq.py @@ -0,0 +1,32 @@ +# -*- coding: utf-8 -*- +"""逐次滚动记录 scrollTop 与卡片数,确认「加载更多后是否被甩回顶部」。""" +import os + +from playwright.sync_api import sync_playwright + +ROOT = r'D:\择校' +URL = 'file:///' + os.path.join(ROOT, 'docs', '择校UI', 'index.html').replace('\\', '/') +CHROME = r'C:\Program Files\Google\Chrome\Application\chrome.exe' + +with sync_playwright() as p: + b = p.chromium.launch(executable_path=CHROME, headless=True, args=['--allow-file-access-from-files']) + ctx = b.new_context(viewport={'width': 390, 'height': 844}) + pg = ctx.new_page() + pg.goto(URL + '#view=list&major=0856&goal=340', wait_until='load') + pg.wait_for_timeout(1500) + + def snap(): + return pg.evaluate("""() => { + const el = document.getElementById('screen'); + return {cards: document.querySelectorAll('.e-result').length, + top: Math.round(el.scrollTop), + h: Math.round(el.scrollHeight)}; + }""") + + print('起始:', snap()) + for i in range(14): + pg.mouse.move(195, 600) + pg.mouse.wheel(0, 5000) + pg.wait_for_timeout(700) + print('第 %2d 次滚动 →' % (i + 1), snap()) + b.close() diff --git a/运行暂存/probe_shown.py b/运行暂存/probe_shown.py new file mode 100644 index 000000000..92556c898 --- /dev/null +++ b/运行暂存/probe_shown.py @@ -0,0 +1,13 @@ +# -*- coding: utf-8 -*- +"""查 shown 的上限逻辑:为什么停在 240。""" +import io +import re + +s = io.open(r'D:\择校\docs\择校UI\index.html', encoding='utf-8').read() + +for pat in [r'\bshown\b']: + hits = list(re.finditer(pat, s)) + print('=== %s : %d 处 ===' % (pat, len(hits))) + for m in hits: + seg = s[max(0, m.start() - 130):m.start() + 130].replace('\n', ' ') + print(' at', m.start(), '|', seg) diff --git a/运行暂存/probe_sorts.py b/运行暂存/probe_sorts.py new file mode 100644 index 000000000..d8e776869 --- /dev/null +++ b/运行暂存/probe_sorts.py @@ -0,0 +1,40 @@ +# -*- coding: utf-8 -*- +"""四种排序各抓 20 张,看「不招本专业」的院校会不会露出来,显示成什么样。""" +import json +import os + +from playwright.sync_api import sync_playwright + +ROOT = r'D:\择校' +BASE = 'file:///' + os.path.join(ROOT, 'docs', '择校UI', 'index.html').replace('\\', '/') +CHROME = r'C:\Program Files\Google\Chrome\Application\chrome.exe' + +SORTS = ['gapNear', 'lineUp', 'lineDown', 'plan'] + +with sync_playwright() as p: + b = p.chromium.launch(executable_path=CHROME, headless=True, args=['--allow-file-access-from-files']) + ctx = b.new_context(viewport={'width': 390, 'height': 844}) + pg = ctx.new_page() + + for s in SORTS: + pg.goto('%s#view=list&major=0856&goal=340&sort=%s' % (BASE, s), wait_until='load') + pg.wait_for_timeout(1300) + info = pg.evaluate("""() => { + const cards = [...document.querySelectorAll('.e-result')].slice(0, 20).map(el => ({ + n: (el.querySelector('.e-result-title b') || {}).innerText || '', + line: (el.querySelectorAll('.e-result-metrics b')[0] || {}).innerText || '', + label: (el.querySelector('.e-result-gap small') || {}).innerText || '', + gap: (el.querySelector('.e-result-gap b') || {}).innerText || '' + })); + const empty = cards.filter(c => c.line === '—' || c.line === ''); + return {count: cards.length, empty: empty.length, emptySample: empty.slice(0, 4), + first3: cards.slice(0, 3)}; + }""") + print('排序 %-9s 卡 %d 张,空 %d 张' % (s, info['count'], info['empty'])) + for c in info['first3']: + print(' ', json.dumps(c, ensure_ascii=False)) + if info['emptySample']: + print(' 空卡样例:') + for c in info['emptySample']: + print(' ', json.dumps(c, ensure_ascii=False)) + b.close() diff --git a/运行暂存/readme_v34_v35.py b/运行暂存/readme_v34_v35.py new file mode 100644 index 000000000..5b0739eba --- /dev/null +++ b/运行暂存/readme_v34_v35.py @@ -0,0 +1,98 @@ +# -*- coding: utf-8 -*- +"""补 README:v34(对比页贴近度排序,此前漏记)+ v35(列表专业口径)。""" +import io + +P = r'D:\择校\docs\研选E决策层_20261112\README.md' +s = io.open(P, encoding='utf-8').read() +assert '## v34' not in s and '## v35' not in s, 'README 已有 v34/v35' + +ADD = ''' + +## v34(2026-11-13):对比页该先说「谁离我最近」 + +稿 `37_对比页贴近度排序.png`。 + +### 问题 + +对比页把选中的 2–4 所院校并排列指标,但顺序是用户点选的先后。四列并排、指标七八行,眼睛要来回扫才能拼出「哪所最够得着」。而用户来对比页要问的第一个问题恰恰是这个。 + +### 做法 + +加一个排序开关「按分差排序」,按各校与目标分的贴近程度重排: + +- 卡头挂「近 1 / 近 2」的序位徽标,一眼看出梯队次序; +- 没有本专业复试线的院校没有分差可比,统一沉到最后、标「无分差」,不参与排序; +- 开关关掉就回到点选顺序,不做隐式重排。 + +### 验证 + +排序开关与序位徽标落在同一份 `cmpSort` 状态上,切换后四列同步重排;无分差院校始终在末位,不会因为排序而插进有数的一列中间。 + +### 仍未做 + +- 排序状态不持久化,刷新回默认。 + + +## v35(2026-11-17):907 所里有 545 所根本不招我这个专业 + +稿 `38_列表专业口径.png`(以实现实拍为参考图生成)。 + +### 问题 + +院校库顶部「分差视角」写的是「本专业开设 362 所」,列表标题写的却是「共 907 所院校」。同一个页面、上下相隔 10px,两个数字差 545 所。选了 0856 材料与化工的人,看到的是全库 907 所——其中 545 所在 2027 官方目录里没有 0856。 + +实测把 907 张卡全加载出来:**547 张的三个指标位(2026 复试线 / 2027 拟招 / 距录取均分)全是灰色横杠「—」**,标签还写着「目标分差」。也就是说用户滑到后面,屏幕上是六成的空卡。底部的说明行只提「850 所有校园影像,其余 57 所为科研院所、军工单位、党校」,一个字没提专业开设情况。 + +数据本身没有编造——空卡显示的是「—」而不是别的专业的分数线,这一点是对的。但把 545 张「—」和 362 张真数据混在一张长列表里,等于让用户自己筛。 + +### 做法 + +口径统一到「本专业」,并把「不招」这件事明确说出来,而不是用横杠糊过去: + +1. **标题改两段式**:主数字 `362 所` + `开设 0856 材料与化工`;只在看全部时补一行 10.5px 的 `另有 545 所院校在 2027 目录中没有 0856`。 +2. **未开设院校换矮卡**:不再占一张整卡的位置摆三个横杠。左边 56×56 的书本图标占位,校名后挂 `未开设 0856` 标签,下面一行说明「2027 官方目录里这所学校没有 0856,分数线与拟招人数不适用」,右下角「看该校其他专业 ›」。不再出现三个指标块,也不出现对比与收藏。实测 89px,正常卡 110px。 +3. **两批之间加分隔带**:`以下 545 所院校在 2027 目录里没有 0856,排在最后`,40px 高、浅灰蓝底。数字取全池的未开设数,不取当前已加载的那一段,否则滚到一半会显示「以下 1 所」。 +4. **默认只看本专业**:`onlyMajor` 从「没存过就当关」改成「没存过就当开」,新用户进来就是 362 所。 + +### 根因:一条 URL 解析把默认值吃掉了 + +改完默认值,开关状态还是错的。查下去是 `updateFromUrl()` 里这一行: + +```js +onlyMajor = qs.get('om') === '1'; +``` + +**无条件赋值**。任何不带 `om` 参数的链接——站内跳转、刷新、分享出去的短链——都会把 `onlyMajor` 置成 `false`,前面刚定的默认值当场作废。改成 `if (qs.has('om')) onlyMajor = qs.get('om') === '1';`:只有链接显式写了 `om` 才覆盖。 + +顺带把「清空筛选」和「切专业」两处从 `onlyMajor = false` 改成 `true`:换了专业还继续显示「没有这个专业的 545 所」,跟默认口径正好相反。 + +还有一处:开关的显示条件是「当前池里有未开设的院校」(`offN > 0`)。默认只看本专业时池子里全是开设的,`offN` 恒为 0,开关直接不渲染——用户被锁在 362 所里,没有任何入口切回全部。改成看全库的未开设数 `offAll = S.length - Object.keys(D).length`,只要库里有不招这个专业的院校,开关就在。 + +### 复审 + +- 干净 localStorage 冷启动:标题 `362 所 开设 0856 材料与化工`、开关关闭、无矮卡、`#view=list` 落到 362 所口径; +- 打开开关:副行出现 `另有 545 所…`、开关转开、矮卡与分隔带随之出现;再关掉回到 362; +- 切专业口径跟随:0805 → 252 所(另有 655)、0301 → 208 所(另有 699),主数字与专业名同步; +- 320 宽校名不换行(`沈阳航空航天…` 省略号收尾),此前 320 下「沈阳航空航天大学」被挤成两行、把「保 / 沈阳」标签推到卡外; +- 390 / 320、浅色 / 深色都不横向溢出,页面错误 0。 + +### 两处刻意的取舍 + +- **默认看本专业,不是默认看全部**。既然用户已经选了专业,「院校库」的语境就是「给我这个专业找学校」。907 所里 545 所不招,先摆给他是噪音。要看全部,开关就在标题右边。 +- **空卡不删,改成矮卡**。直接过滤掉会让用户以为库里没这所学校(比如中国人民大学确实在这个库里,只是 2027 目录没有 0856)。留一张矮卡 + 「看该校其他专业」,既省掉 60% 的纵向空间,又保留了「这学校在库里」这个事实。 + +### 验证 + +`ui_v35_list_scope.py`(施加改动)、`ui_v35_verify.py`(30 项:口径一致性 / 矮卡形态 / 分隔带 / 开关联动 / 320 深色无溢出)、`ui_v35_verify2.py`(12 项:干净态默认、开关往返、切专业跟随、无方向明细专业不崩)。两套共 42 项全 PASS。 + +### 仍未做 + +- 「距录取均分 ±0」在排序靠前的几张卡上连着出现(0856 里正好 5 所录取均分等于 340),视觉上像没数据。措辞可改成「持平」,但 `gapText` 在对比页和详情页共用,要一起评估。 +- 开关在两个地方出现且语义相反:更多筛选里是「仅看本专业开设」,标题行是「也看没开设的」。同一个 `onlyMajor`,`aria-checked` 各算各的,读屏用户容易绕晕。 +- 分隔带只在「有数据 / 无数据」交界处插一条;如果将来允许按城市、标签筛到只剩无数据的院校,这条带会消失,需要另给空态。 +- 均分含推免与专项未剔除(老问题)。 +''' + +s = s.rstrip('\n') + ADD +io.open(P, 'w', encoding='utf-8').write(s) +print('README 追加完成,%d → %d 字符' % (31031, len(s))) diff --git a/运行暂存/ui_cmpsort_row_20261116.py b/运行暂存/ui_cmpsort_row_20261116.py new file mode 100644 index 000000000..bf057e356 --- /dev/null +++ b/运行暂存/ui_cmpsort_row_20261116.py @@ -0,0 +1,40 @@ +# -*- coding: utf-8 -*- +"""量对比页已选院校行在 390 / 320 下是否被裁(chips 容器溢出即被裁)。""" +from pathlib import Path +from playwright.sync_api import sync_playwright + +base = Path('D:/择校/docs/择校UI/index.html').as_uri() +out = Path('D:/择校/运行暂存/ui_round35_cmpsort_20261116') +errs = [] +with sync_playwright() as p: + b = p.chromium.launch(executable_path='C:/Program Files/Google/Chrome/Application/chrome.exe', + headless=True, args=['--allow-file-access-from-files']) + for w in (390, 360, 320): + for cnt, cmpids in ((3, '197,514,92'), (4, '197,514,92,88'), (2, '197,514')): + for sort in (0, 1): + pg = b.new_page(viewport={'width': w, 'height': 844}, device_scale_factor=2) + pg.on('pageerror', lambda e: errs.append(str(e))) + pg.add_init_script("localStorage.setItem('zexiao_major','0856'); localStorage.setItem('zexiao_goal','340');" + + ("localStorage.setItem('zexiao_cmpsort','1');" if sort else "localStorage.setItem('zexiao_cmpsort','0');")) + pg.goto(base + f'#view=cmp&major=0856&no=197&theme=light&goal=340&cmp={cmpids}', wait_until='load') + pg.wait_for_timeout(700) + m = pg.evaluate("""() => { + const c = document.querySelector('.compare-chips'); + const row = document.querySelector('.compare-selection'); + const btn = document.querySelector('.cmp-sort'); + return { + overflow: c ? c.scrollWidth - c.clientWidth : null, + rowW: row ? Math.round(row.getBoundingClientRect().width) : null, + chipsW: c ? Math.round(c.getBoundingClientRect().width) : null, + btnW: btn ? Math.round(btn.getBoundingClientRect().width) : null, + doc: document.documentElement.scrollWidth + }; + }""") + flag = '裁' if (m['overflow'] or 0) > 0 else 'ok' + print(f"w={w} 院校={cnt} 排序={sort} chips溢出={m['overflow']} 行宽={m['rowW']} chips={m['chipsW']} 按钮={m['btnW']} doc={m['doc']} {flag}") + if cnt == 3 and w == 390: + pg.screenshot(path=str(out / f'row_390_{cnt}_{sort}.png'), + clip={'x': 0, 'y': 0, 'width': w, 'height': 844}, full_page=True) + pg.close() + print('errors:', errs) + b.close() diff --git a/运行暂存/ui_cmpsort_verify_20261116.py b/运行暂存/ui_cmpsort_verify_20261116.py new file mode 100644 index 000000000..13f36f147 --- /dev/null +++ b/运行暂存/ui_cmpsort_verify_20261116.py @@ -0,0 +1,159 @@ +# -*- coding: utf-8 -*- +"""v34 验证:对比页「按分差排序」/ 引导页目标分措辞 / 三档口径展开态持久化。 +390 浅色 + 390 深色 + 320 浅色,另加 300 分制专业下按钮不出场的检查。""" +from pathlib import Path +import re +from playwright.sync_api import sync_playwright + +root = Path('D:/择校') +base = (root / 'docs/择校UI/index.html').as_uri() +out = root / '运行暂存/ui_round35_cmpsort_20261116' +out.mkdir(exist_ok=True) +errs = [] +fails = [] + +CMP_HASH = '#view=cmp&major=0856&no=197&theme=light&goal=340&cmp=197,514,92' + +def seed(pg, extra=''): + pg.add_init_script("localStorage.setItem('zexiao_major','0856'); localStorage.setItem('zexiao_goal','340');" + extra) + +with sync_playwright() as p: + b = p.chromium.launch(executable_path='C:/Program Files/Google/Chrome/Application/chrome.exe', + headless=True, args=['--allow-file-access-from-files']) + + def shot(name, h, w, extra, dsf=2, height=844): + pg = b.new_page(viewport={'width': w, 'height': height}, device_scale_factor=dsf) + pg.on('pageerror', lambda e: errs.append(f'{name}: {e}')) + seed(pg, extra) + pg.goto(base + h, wait_until='load') + pg.wait_for_timeout(1600) + pg.screenshot(path=str(out / f'{name}_{w}.png'), full_page=True) + wide = pg.evaluate('document.documentElement.scrollWidth') + if wide > w + 1: + fails.append(f'{name}@{w} 横向溢出 wide={wide}') + return pg + + def names(pg): + return pg.eval_on_selector_all('.compare-table .cmp .col .compare-school-name', 'els => els.map(e => e.textContent.trim())') + + def nears(pg): + return pg.eval_on_selector_all('.compare-table .cmp .col .cmp-near', 'els => els.map(e => e.textContent.trim())') + + # 1) 排序关(默认) + pg = shot('cmp_off', CMP_HASH, 390, "") + off_names = names(pg) + has_btn = pg.eval_on_selector_all('.cmp-sort', 'els => els.length') + btn_txt = pg.eval_on_selector_all('.cmp-sort', 'els => els.map(e => e.textContent.trim() + "|" + e.getAttribute("aria-pressed"))') + near_off = nears(pg) + print('off names:', off_names, 'sort btn:', has_btn, btn_txt, 'near:', near_off) + if has_btn != 1 or btn_txt[0].startswith('分差最近优先'): + fails.append('排序关闭态按钮文案/数量不对') + if near_off: + fails.append('排序关闭态不该出现近 N 徽标') + + # 2) 点按钮打开排序 + pg.click('.cmp-sort') + pg.wait_for_timeout(600) + on_names = names(pg) + near_on = nears(pg) + btn_on = pg.eval_on_selector('.cmp-sort', 'e => e.textContent.trim() + "|" + e.getAttribute("aria-pressed")') + note = pg.eval_on_selector_all('.cmp-verdict .cmp-sort-note', 'els => els.map(e => e.textContent.trim())') + print('on names:', on_names, 'near:', near_on, 'btn:', btn_on, 'note:', note) + print('ls cmpsort =', pg.evaluate("localStorage.getItem('zexiao_cmpsort')")) + if pg.evaluate("localStorage.getItem('zexiao_cmpsort')") != '1': + fails.append('排序开关没写 localStorage') + if not on_names or len(near_on) != len(on_names): + fails.append('开启后近 N 徽标数量与列数不一致') + else: + seq = [t for t in near_on if t != '无分差'] + if seq != [f'近 {i+1}' for i in range(len(seq))]: + fails.append(f'近 N 徽标序号不对: {near_on}') + if '无分差' in near_on and near_on.index('无分差') < len(seq): + fails.append(f'「无分差」应排在最后: {near_on}') + if not note: + fails.append('开启后结论卡缺少排序提示') + + # 3) 排序顺序与「分差绝对值升序」是否一致 + data = pg.evaluate("""() => { + const rows = [...document.querySelectorAll('.compare-table .cmprow')]; + const r = rows.find(x => x.querySelector('.k') && x.querySelector('.k').textContent.includes('目标分差')); + if (!r) return null; + return [...r.querySelectorAll('.c')].map(c => c.textContent.trim()); + }""") + print('分差行(排序后):', data) + def dist(s): + m = re.search(r'-?\d+(?:\.\d+)?', str(s).replace('−', '-')) + return abs(float(m.group())) if m else None + ds = [dist(x) for x in (data or []) if x and dist(x) is not None] + if ds != sorted(ds): + fails.append(f'分差行未按绝对值升序: {ds}') + + # 4) reload 后保持排序 + pg.reload(wait_until='load') + pg.wait_for_timeout(1200) + print('reload names:', names(pg), 'btn:', pg.eval_on_selector('.cmp-sort', 'e => e.getAttribute("aria-pressed")')) + if pg.eval_on_selector('.cmp-sort', 'e => e.getAttribute("aria-pressed")') != 'true': + fails.append('刷新后排序开关没保持') + pg.screenshot(path=str(out / 'cmp_on_390.png'), full_page=True) + pg.close() + + # 5) 深色 + 320 宽 + pg = shot('cmp_on_dark', '#view=cmp&major=0856&no=197&theme=dark&goal=340&cmp=197,514,92', 390, + "localStorage.setItem('zexiao_cmpsort','1');") + pg.close() + pg = shot('cmp_on_320', CMP_HASH, 320, "localStorage.setItem('zexiao_cmpsort','1');", dsf=3, height=640) + print('320 names:', names(pg), 'near:', nears(pg)) + pg.close() + + # 6) 300 分制专业(1251):按钮与徽标都不出场 + pg = shot('cmp_300', '#view=cmp&major=1251&theme=light&goal=340&cmp=197,514,92', 390, + "localStorage.setItem('zexiao_major','1251'); localStorage.setItem('zexiao_cmpsort','1');") + n300 = pg.eval_on_selector_all('.cmp-sort', 'els => els.length') + near300 = pg.eval_on_selector_all('.cmp-near', 'els => els.length') + print('300 分制 sort btn:', n300, 'near:', near300, 'error hint:', pg.eval_on_selector_all('.state-empty h3', 'els => els.map(e => e.textContent.trim())')) + if n300 or near300: + fails.append('300 分制专业不该出现排序按钮或近 N 徽标') + pg.close() + + # 7) 三档口径展开态持久化 + for label, extra, expect_open in [('tierdef_closed', "", False), ('tierdef_open', "localStorage.setItem('zexiao_tierdef','1');", True)]: + pg = b.new_page(viewport={'width': 390, 'height': 844}, device_scale_factor=2) + pg.on('pageerror', lambda e: errs.append(f'{label}: {e}')) + seed(pg, extra) + pg.goto(base + '#view=home&major=0856&no=514&theme=light&goal=340', wait_until='load') + pg.wait_for_timeout(1400) + open_now = pg.eval_on_selector_all('.tier-def-full', 'els => els.length') + print(label, '刷新后展开块数:', open_now) + if bool(open_now) != expect_open: + fails.append(f'{label} 刷新后展开态与预期不符: {open_now}') + if label == 'tierdef_closed': + pg.click('.tier-def-toggle') + pg.wait_for_timeout(500) + ls = pg.evaluate("localStorage.getItem('zexiao_tierdef')") + print('点击后 localStorage zexiao_tierdef =', ls, '展开块数=', + pg.eval_on_selector_all('.tier-def-full', 'els => els.length')) + if ls != '1': + fails.append('点击展开未写入 zexiao_tierdef') + pg.screenshot(path=str(out / 'tierdef_open_390.png'), full_page=True) + pg.close() + + # 8) 引导页目标分措辞:未存过 / 存过 + for label, extra, expect in [ + ('onb_nosave', "", '先用默认目标分 340'), + ('onb_saved', "localStorage.setItem('zexiao_goal','365');", '沿用你上次设置的目标分 365'), + ]: + pg = b.new_page(viewport={'width': 390, 'height': 844}, device_scale_factor=2) + pg.on('pageerror', lambda e: errs.append(f'{label}: {e}')) + pg.add_init_script("localStorage.clear(); localStorage.removeItem('zexiao_major');" + extra) + pg.goto(base + '#view=home&no=514&theme=light', wait_until='load') + pg.wait_for_timeout(1400) + txt = pg.eval_on_selector_all('.onboarding-note', 'els => els.map(e => e.textContent.trim())') + print(label, txt) + if not txt or expect not in txt[0]: + fails.append(f'{label} 措辞不符预期: {txt}') + pg.screenshot(path=str(out / f'{label}_390.png'), full_page=True) + pg.close() + + print('errors:', errs) + print('fails:', fails) + b.close() diff --git a/运行暂存/ui_round34_20261116/cmp_390.png b/运行暂存/ui_round34_20261116/cmp_390.png new file mode 100644 index 000000000..b842cfa8b Binary files /dev/null and b/运行暂存/ui_round34_20261116/cmp_390.png differ diff --git a/运行暂存/ui_round34_20261116/cmp_dark_390.png b/运行暂存/ui_round34_20261116/cmp_dark_390.png new file mode 100644 index 000000000..cced55b64 Binary files /dev/null and b/运行暂存/ui_round34_20261116/cmp_dark_390.png differ diff --git a/运行暂存/ui_round34_20261116/cmp_ref768.jpg b/运行暂存/ui_round34_20261116/cmp_ref768.jpg new file mode 100644 index 000000000..d51209df9 Binary files /dev/null and b/运行暂存/ui_round34_20261116/cmp_ref768.jpg differ diff --git a/运行暂存/ui_round34_20261116/detail_390.png b/运行暂存/ui_round34_20261116/detail_390.png new file mode 100644 index 000000000..6a3428660 Binary files /dev/null and b/运行暂存/ui_round34_20261116/detail_390.png differ diff --git a/运行暂存/ui_round34_20261116/home_390.png b/运行暂存/ui_round34_20261116/home_390.png new file mode 100644 index 000000000..7529c9887 Binary files /dev/null and b/运行暂存/ui_round34_20261116/home_390.png differ diff --git a/运行暂存/ui_round34_20261116/home_dark_390.png b/运行暂存/ui_round34_20261116/home_dark_390.png new file mode 100644 index 000000000..be64383b4 Binary files /dev/null and b/运行暂存/ui_round34_20261116/home_dark_390.png differ diff --git a/运行暂存/ui_round34_20261116/list_390.png b/运行暂存/ui_round34_20261116/list_390.png new file mode 100644 index 000000000..21a6f5c74 Binary files /dev/null and b/运行暂存/ui_round34_20261116/list_390.png differ diff --git a/运行暂存/ui_round34_20261116/mine_390.png b/运行暂存/ui_round34_20261116/mine_390.png new file mode 100644 index 000000000..e32d70e1c Binary files /dev/null and b/运行暂存/ui_round34_20261116/mine_390.png differ diff --git a/运行暂存/ui_round34_20261116/onboarding_390.png b/运行暂存/ui_round34_20261116/onboarding_390.png new file mode 100644 index 000000000..b355b5448 Binary files /dev/null and b/运行暂存/ui_round34_20261116/onboarding_390.png differ diff --git a/运行暂存/ui_round34_shot_20261116.py b/运行暂存/ui_round34_shot_20261116.py new file mode 100644 index 000000000..b118749e6 --- /dev/null +++ b/运行暂存/ui_round34_shot_20261116.py @@ -0,0 +1,40 @@ +# -*- coding: utf-8 -*- +"""round34 现状实拍:引导页 / 首页 / 院校库 / 详情 / 对比 / 我的,390 浅色 + 两处深色。""" +from pathlib import Path +from playwright.sync_api import sync_playwright + +root = Path('D:/择校') +base = (root / 'docs/择校UI/index.html').as_uri() +out = root / '运行暂存/ui_round34_20261116' +out.mkdir(exist_ok=True) +errs = [] + +SHOTS = [ + ('onboarding', '#view=home&no=514&theme=light', False), + ('home', '#view=home&major=0856&no=514&theme=light&goal=340', True), + ('list', '#view=list&major=0856&no=514&theme=light&goal=340', True), + ('detail', '#view=detail&major=0856&no=197&theme=light&goal=340', True), + ('cmp', '#view=cmp&major=0856&no=197&theme=light&goal=340&cmp=197,514,92', True), + ('mine', '#view=mine&major=0856&no=514&theme=light&goal=340', True), + ('home_dark', '#view=home&major=0856&no=514&theme=dark&goal=340', True), + ('cmp_dark', '#view=cmp&major=0856&no=197&theme=dark&goal=340&cmp=197,514,92', True), +] + +with sync_playwright() as p: + b = p.chromium.launch(executable_path='C:/Program Files/Google/Chrome/Application/chrome.exe', + headless=True, args=['--allow-file-access-from-files']) + for name, h, seeded in SHOTS: + pg = b.new_page(viewport={'width': 390, 'height': 844}, device_scale_factor=2) + pg.on('pageerror', lambda e: errs.append(str(e))) + if seeded: + pg.add_init_script("localStorage.setItem('zexiao_major','0856'); localStorage.setItem('zexiao_goal','340');") + else: + pg.add_init_script("localStorage.clear();") + pg.goto(base + h, wait_until='load') + pg.wait_for_timeout(1800) + pg.screenshot(path=str(out / f'{name}_390.png'), full_page=True) + print(name, 'wide=', pg.evaluate('document.documentElement.scrollWidth'), 'h=', + pg.evaluate('document.body.scrollHeight')) + pg.close() + print('errors:', errs) + b.close() diff --git a/运行暂存/ui_round35_20261117/01_list.png b/运行暂存/ui_round35_20261117/01_list.png new file mode 100644 index 000000000..3c697c829 Binary files /dev/null and b/运行暂存/ui_round35_20261117/01_list.png differ diff --git a/运行暂存/ui_round35_20261117/02_detail.png b/运行暂存/ui_round35_20261117/02_detail.png new file mode 100644 index 000000000..3c697c829 Binary files /dev/null and b/运行暂存/ui_round35_20261117/02_detail.png differ diff --git a/运行暂存/ui_round35_20261117/03_detail_dark.png b/运行暂存/ui_round35_20261117/03_detail_dark.png new file mode 100644 index 000000000..396cf9f16 Binary files /dev/null and b/运行暂存/ui_round35_20261117/03_detail_dark.png differ diff --git a/运行暂存/ui_round35_20261117/04_list_bottom.png b/运行暂存/ui_round35_20261117/04_list_bottom.png new file mode 100644 index 000000000..1d9e61eeb Binary files /dev/null and b/运行暂存/ui_round35_20261117/04_list_bottom.png differ diff --git a/运行暂存/ui_round35_20261117/05_list_320.png b/运行暂存/ui_round35_20261117/05_list_320.png new file mode 100644 index 000000000..2d795f65c Binary files /dev/null and b/运行暂存/ui_round35_20261117/05_list_320.png differ diff --git a/运行暂存/ui_round35_20261117/05_list_390_dark.png b/运行暂存/ui_round35_20261117/05_list_390_dark.png new file mode 100644 index 000000000..ab50291b3 Binary files /dev/null and b/运行暂存/ui_round35_20261117/05_list_390_dark.png differ diff --git a/运行暂存/ui_round35_20261117/06_bar_dark.png b/运行暂存/ui_round35_20261117/06_bar_dark.png new file mode 100644 index 000000000..dbab0d5e4 Binary files /dev/null and b/运行暂存/ui_round35_20261117/06_bar_dark.png differ diff --git a/运行暂存/ui_round35_20261117/06_bar_light.png b/运行暂存/ui_round35_20261117/06_bar_light.png new file mode 100644 index 000000000..ee6de47ba Binary files /dev/null and b/运行暂存/ui_round35_20261117/06_bar_light.png differ diff --git a/运行暂存/ui_round35_20261117/07_offcard_light.png b/运行暂存/ui_round35_20261117/07_offcard_light.png new file mode 100644 index 000000000..3b99637dc Binary files /dev/null and b/运行暂存/ui_round35_20261117/07_offcard_light.png differ diff --git a/运行暂存/ui_round35_20261117/08_default_390.png b/运行暂存/ui_round35_20261117/08_default_390.png new file mode 100644 index 000000000..e5a93ded6 Binary files /dev/null and b/运行暂存/ui_round35_20261117/08_default_390.png differ diff --git a/运行暂存/ui_round35_baseline.py b/运行暂存/ui_round35_baseline.py new file mode 100644 index 000000000..da7fa6fa7 --- /dev/null +++ b/运行暂存/ui_round35_baseline.py @@ -0,0 +1,58 @@ +# -*- coding: utf-8 -*- +"""截第 35 轮基线:院校库 → 详情页,390 宽浅色/深色各一张。""" +import os +from urllib.parse import quote + +from playwright.sync_api import sync_playwright + +ROOT = r'D:\择校' +URL = 'file:///' + os.path.join(ROOT, 'docs', '择校UI', 'index.html').replace('\\', '/') +OUT = os.path.join(ROOT, '运行暂存', 'ui_round35_20261117') +os.makedirs(OUT, exist_ok=True) +CHROME = r'C:\Program Files\Google\Chrome\Application\chrome.exe' + + +def shot(pg, name): + path = os.path.join(OUT, name) + pg.screenshot(path=path, full_page=False) + print(' ->', name, os.path.getsize(path) // 1024, 'KB') + + +with sync_playwright() as p: + b = p.chromium.launch(executable_path=CHROME, headless=True, + args=['--allow-file-access-from-files']) + ctx = b.new_context(viewport={'width': 390, 'height': 844}, device_scale_factor=2) + pg = ctx.new_page() + errs = [] + pg.on('pageerror', lambda e: errs.append(str(e))) + + # 1. 院校库 + pg.goto(URL + '#view=list&major=0856&goal=340', wait_until='load') + pg.wait_for_timeout(1200) + shot(pg, '01_list.png') + print(' 列表卡片数:', pg.eval_on_selector_all('.l-card, .list-card, [data-no]', 'e=>e.length')) + print(' 正文长度:', len(pg.inner_text('body'))) + + # 2. 点第一张卡进详情 + clicked = pg.evaluate("""() => { + const el = document.querySelector('.l-card a, .l-card, [data-no]'); + if (!el) return 'no card'; + const no = el.getAttribute('data-no'); + if (no) { location.hash = 'view=detail&major=0856&goal=340&no=' + no; return 'goto ' + no; } + el.click(); + return 'clicked'; + }""") + print(' 进详情:', clicked) + pg.wait_for_timeout(1500) + shot(pg, '02_detail.png') + print(' 详情文本长度:', len(pg.inner_text('body'))) + print(' 详情首屏文本:', pg.inner_text('body')[:400].replace('\n', ' | ')) + + # 3. 深色 + pg.goto(URL + '#view=detail&major=0856&goal=340&theme=dark&no=' + (clicked.split()[-1] if clicked.startswith('goto') else '10001'), + wait_until='load') + pg.wait_for_timeout(1200) + shot(pg, '03_detail_dark.png') + + print(' 页面错误:', errs if errs else '无') + b.close() diff --git a/运行暂存/ui_round35_cmpsort_20261116/cmp_300_390.png b/运行暂存/ui_round35_cmpsort_20261116/cmp_300_390.png new file mode 100644 index 000000000..5b2d365dc Binary files /dev/null and b/运行暂存/ui_round35_cmpsort_20261116/cmp_300_390.png differ diff --git a/运行暂存/ui_round35_cmpsort_20261116/cmp_off_390.png b/运行暂存/ui_round35_cmpsort_20261116/cmp_off_390.png new file mode 100644 index 000000000..40aea667f Binary files /dev/null and b/运行暂存/ui_round35_cmpsort_20261116/cmp_off_390.png differ diff --git a/运行暂存/ui_round35_cmpsort_20261116/cmp_on_320_320.png b/运行暂存/ui_round35_cmpsort_20261116/cmp_on_320_320.png new file mode 100644 index 000000000..93e15169a Binary files /dev/null and b/运行暂存/ui_round35_cmpsort_20261116/cmp_on_320_320.png differ diff --git a/运行暂存/ui_round35_cmpsort_20261116/cmp_on_390.png b/运行暂存/ui_round35_cmpsort_20261116/cmp_on_390.png new file mode 100644 index 000000000..a04da68d1 Binary files /dev/null and b/运行暂存/ui_round35_cmpsort_20261116/cmp_on_390.png differ diff --git a/运行暂存/ui_round35_cmpsort_20261116/cmp_on_dark_390.png b/运行暂存/ui_round35_cmpsort_20261116/cmp_on_dark_390.png new file mode 100644 index 000000000..8df7fbd9b Binary files /dev/null and b/运行暂存/ui_round35_cmpsort_20261116/cmp_on_dark_390.png differ diff --git a/运行暂存/ui_round35_cmpsort_20261116/onb_nosave_390.png b/运行暂存/ui_round35_cmpsort_20261116/onb_nosave_390.png new file mode 100644 index 000000000..3b91f242d Binary files /dev/null and b/运行暂存/ui_round35_cmpsort_20261116/onb_nosave_390.png differ diff --git a/运行暂存/ui_round35_cmpsort_20261116/onb_saved_390.png b/运行暂存/ui_round35_cmpsort_20261116/onb_saved_390.png new file mode 100644 index 000000000..89b06d5d2 Binary files /dev/null and b/运行暂存/ui_round35_cmpsort_20261116/onb_saved_390.png differ diff --git a/运行暂存/ui_round35_cmpsort_20261116/row_390_3_0.png b/运行暂存/ui_round35_cmpsort_20261116/row_390_3_0.png new file mode 100644 index 000000000..40aea667f Binary files /dev/null and b/运行暂存/ui_round35_cmpsort_20261116/row_390_3_0.png differ diff --git a/运行暂存/ui_round35_cmpsort_20261116/row_390_3_1.png b/运行暂存/ui_round35_cmpsort_20261116/row_390_3_1.png new file mode 100644 index 000000000..310a04e2c Binary files /dev/null and b/运行暂存/ui_round35_cmpsort_20261116/row_390_3_1.png differ diff --git a/运行暂存/ui_round35_cmpsort_20261116/tierdef_open_390.png b/运行暂存/ui_round35_cmpsort_20261116/tierdef_open_390.png new file mode 100644 index 000000000..39a630dbc Binary files /dev/null and b/运行暂存/ui_round35_cmpsort_20261116/tierdef_open_390.png differ diff --git a/运行暂存/ui_v35_fix.py b/运行暂存/ui_v35_fix.py new file mode 100644 index 000000000..cb2569817 --- /dev/null +++ b/运行暂存/ui_v35_fix.py @@ -0,0 +1,49 @@ +# -*- coding: utf-8 -*- +"""v35 收尾修正:默认只看本专业、320 下校名不换行、标题行收成两行。""" +import io + +P = r'D:\择校\docs\择校UI\index.html' +s = io.open(P, encoding='utf-8').read() + + +def sub(old, new, tag): + global s + assert old in s, '锚点缺失:' + tag + assert s.count(old) == 1, '锚点不唯一:%s' % tag + s = s.replace(old, new) + print('OK', tag) + + +# 1. onlyMajor 默认开:没存过偏好就按「只看本专业」 +sub("let onlyMajor = localStorage.getItem('zexiao_onlymajor') === '1';", + "let onlyMajor = localStorage.getItem('zexiao_onlymajor') !== '0';", + 'onlyMajor 默认值') + +# 2. 标题行布局:左块(主数字+副行)与右块(开关+上下文)同一行,左右分栏 +sub('''.list-count-row{display:block} +.list-count-main{font-size:13px;font-weight:700;color:#16233a;letter-spacing:-.2px}''', + '''.list-count-row{display:flex;align-items:flex-start;gap:10px} +.list-count-left{min-width:0;flex:1} +.list-count-main{font-size:13px;font-weight:700;color:#16233a;letter-spacing:-.2px}''', + '标题行分栏') + +sub('''.list-count-right{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-top:6px}''', + '''.list-count-right{display:flex;flex-direction:column;align-items:flex-end;gap:6px;flex:none}''', + '右块竖排') + +# 3. 320 下校名不换行:让 b 可压缩并省略 +sub('.e-result-title b{font-family:SimSun,serif;', + '.e-result-title b{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;flex:0 1 auto;font-family:SimSun,serif;', + '校名省略') + +# 4. 标题行结构体:左块 + 右块 +sub('''
${offerN} 所开设 ${esc(mName())}
+ ${offN ? `
另有 ${offN} 所院校在 2027 目录中没有 ${esc(major)}
` : ''} +
${offN ? `` : ''}
${act.length ? '筛选条件:'+esc(act.join(' · ')) : '全部院校'}
''', + '''
${offerN} 所开设 ${esc(mName())}
+ ${offN ? `
另有 ${offN} 所院校在 2027 目录中没有 ${esc(major)}
` : ''}
+
${offN ? `` : ''}
${act.length ? '筛选条件:'+esc(act.join(' · ')) : '全部院校'}
''', + '标题行结构') + +io.open(P, 'w', encoding='utf-8').write(s) +print('写入完成,%d 字节' % len(s)) diff --git a/运行暂存/ui_v35_fix2.py b/运行暂存/ui_v35_fix2.py new file mode 100644 index 000000000..300b85d95 --- /dev/null +++ b/运行暂存/ui_v35_fix2.py @@ -0,0 +1,27 @@ +# -*- coding: utf-8 -*- +"""修:默认只看本专业后,开关没了入口——开关是否出现不能依赖当前池里的未开设数。""" +import io + +P = r'D:\择校\docs\择校UI\index.html' +s = io.open(P, encoding='utf-8').read() + +old = """ const hasM = x => !!(D && D[String(x.no)]); + const offerN = arr.filter(hasM).length; + const offN = arr.length - offerN;""" +new = """ const hasM = x => !!(D && D[String(x.no)]); + const offerN = arr.filter(hasM).length; + const offN = arr.length - offerN; + // 开关要在「只看本专业」时也留着,否则切不回全部 + const offAll = D ? Math.max(0, S.length - Object.keys(D).length) : 0;""" +assert old in s, '锚点缺失' +assert s.count(old) == 1 +s = s.replace(old, new) + +old2 = '
${offN ? `