import { useState, useEffect } from 'react' const RADIUS = 40 const CIRCUMFERENCE = 2 * Math.PI * RADIUS function MatchRing({ rate }) { const [small, setSmall] = useState(window.innerWidth <= 767) useEffect(() => { const mq = window.matchMedia('(max-width: 767px)') const handler = (e) => setSmall(e.matches) mq.addEventListener('change', handler) return () => mq.removeEventListener('change', handler) }, []) const size = small ? 64 : 96 const colorVar = rate >= 80 ? 'var(--color-success)' : rate >= 60 ? 'var(--color-warning)' : 'var(--color-error)' const offset = CIRCUMFERENCE * (1 - rate / 100) return ( {rate}% ) } function MatchBreakdown({ detail, rate }) { if (!detail) return null const bars = [ { key: 'semantic', label: '语义匹配', weight: 40, color: 'var(--color-primary-light)' }, { key: 'tags', label: '技能匹配', weight: 35, color: 'var(--color-success)' }, { key: 'education', label: '学历匹配', weight: 25, color: 'var(--color-warning)' }, ] const rateClass = rate >= 80 ? 'text-success' : rate >= 60 ? 'text-warning' : 'text-error' return (

匹配度计算

总分 = 语义×40% + 技能×35% + 学历×25%
{bars.map(b => { const val = detail[b.key] || 0 const pct = Math.round(val * 100) return (
{b.label}
{pct}% ×{b.weight}%
) })}
最终匹配度 {rate}%
) } function ExpectationSignals({ signals }) { if (!signals || signals.length === 0) return null return (

岗位画像

{signals.map((signal, i) => (
{signal.name || signal.tag} {signal.evidence && ( {signal.evidence} )} {signal.confidence !== undefined && (
置信度
{Math.round(signal.confidence * 100)}%
)}
))}
) } function JobCard({ job, onClick, lowMatchWarning, showMatch = true, onUploadClick }) { const { job_id, name: title, company, city, match_rate, match_detail, tags = [], description, requirements, expectation_signals } = job const [expanded, setExpanded] = useState(false) const visibleTags = tags.slice(0, 3) const extraCount = tags.length - 3 const descSummary = description && description.length > 80 ? description.slice(0, 80) + '...' : description return (
setExpanded(!expanded)}>
{showMatch && (
)}

{title}

{company}

{city} {visibleTags.map((tag, i) => ( {tag} ))} {extraCount > 0 && ( +{extraCount} )}
{showMatch && lowMatchWarning && (
{match_rate < 60 ? '匹配度较低,别灰心,看看建议提升一下吧' : '匹配度较低'}
)} {descSummary && (

{descSummary}

)}
{expanded && (
{description && (

职位描述

{description}

)} {requirements && (

职位要求

{requirements}

)} {showMatch && match_detail && }
{showMatch ? ( ) : ( )}
)}
) } export default JobCard