From 2b1044ddb22c334b547ace710c51e134796c0526 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=94=B2=E8=BE=B0=E7=94=9F=E4=BA=A7?= Date: Sat, 11 Apr 2026 22:18:07 +0800 Subject: [PATCH] =?UTF-8?q?=E6=88=90=E4=BA=A4=E8=A1=8C=E6=83=85=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E6=8C=89=E5=88=86=E7=B1=BB=E6=8E=92=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/pages/News.jsx | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/frontend/src/pages/News.jsx b/frontend/src/pages/News.jsx index 2e864ca..2c16d42 100644 --- a/frontend/src/pages/News.jsx +++ b/frontend/src/pages/News.jsx @@ -104,7 +104,23 @@ export default function News() { } const data = await res.json() console.log('资讯列表:', data) - setInfoList(data || []) + + // 成交行情按分类排序 + let sortedData = data || [] + if (activeTab === 'deal') { + const categoryOrder = ['带4号', '带7号', '永恒号', '天马号', '天马王', '金山号', '金山王', '钻石号', '朦胧号', '朦胧王', '金马号', '金马王', '倒置号', '圆圆号'] + sortedData = [...(data || [])].sort((a, b) => { + const contentA = a.content || '' + const contentB = b.content || '' + const catA = contentA.match(/分类:\s*(.+?)(?:\n|$)/)?.[1]?.trim() || a.category || '' + const catB = contentB.match(/分类:\s*(.+?)(?:\n|$)/)?.[1]?.trim() || b.category || '' + const idxA = categoryOrder.indexOf(catA) + const idxB = categoryOrder.indexOf(catB) + return (idxA === -1 ? 999 : idxA) - (idxB === -1 ? 999 : idxB) + }) + } + + setInfoList(sortedData) } catch (e) { console.error(e) setInfoList([])