import { useState } from 'react'
const RADIUS = 40
const CIRCUMFERENCE = 2 * Math.PI * RADIUS
function MatchRing({ rate }) {
const color = rate >= 80 ? '#10B981' : rate >= 60 ? '#F59E0B' : '#EF4444'
const offset = CIRCUMFERENCE * (1 - rate / 100)
return (
)
}
function MatchBreakdown({ detail, rate }) {
if (!detail) return null
const bars = [
{ key: 'semantic', label: '语义匹配', weight: 40, color: '#6366F1' },
{ key: 'tags', label: '技能匹配', weight: 35, color: '#10B981' },
{ key: 'education', label: '学历匹配', weight: 25, color: '#F59E0B' },
]
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}%
)
})}
最终匹配度
= 80 ? '#10B981' : rate >= 60 ? '#F59E0B' : '#EF4444' }}>{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 && (
)}
{requirements && (
)}
{showMatch && match_detail &&
}
{showMatch ? (
) : (
)}
)}
)
}
export default JobCard