feat: 询价发布助手详情面板增加发布按钮

This commit is contained in:
Sisyphus 2026-06-30 17:20:03 +08:00
parent 3a72d6396c
commit c1c7342621

View File

@ -625,6 +625,33 @@ export default function InquiryPage({ onLeadDetail }: { onLeadDetail?: (id: stri
<p className="text-xs text-slate-600">{drawerLead.publishTime || '-'}</p>
</div>
<div className="flex gap-2 pt-2 border-t border-border-subtle">
{drawerLead.publish !== '已发布' && (
<button
className="flex-1 py-2 bg-emerald-600 text-white text-center rounded-lg text-xs font-semibold hover:bg-emerald-700 disabled:opacity-50"
disabled={pubLoading}
onClick={async () => {
setPubLoading(true)
try {
const res = await fetch(`${API}/${drawerLead.id}/publish`, { method: 'POST' })
if (res.ok) {
drawerLead.publish = '已发布'
setFiltered([...filtered])
showToast('发布成功')
setDrawerLead({ ...drawerLead })
} else {
const errBody = await res.json().catch(() => ({}))
showToast(errBody.message || `发布失败 (${res.status})`)
}
} catch (e) {
showToast(e instanceof Error ? e.message : '发布失败')
} finally {
setPubLoading(false)
}
}}
>
{pubLoading ? '发布中...' : '发布'}
</button>
)}
<button className="flex-1 py-2 bg-secondary text-white text-center rounded-lg text-xs font-semibold hover:opacity-90" onClick={() => { onLeadDetail?.(drawerLead.id); setDrawerLead(null) }}>查看完整详情</button>
<button className="px-4 py-2 bg-white border border-border-subtle rounded-lg text-xs hover:bg-slate-50" onClick={() => setDrawerLead(null)}>关闭</button>
</div>