From 63d710114d35738a6a6fd6086b02e6b5dc594d1f Mon Sep 17 00:00:00 2001 From: HenryDu8133 <813367384@qq.com> Date: Tue, 14 Jul 2026 01:17:49 +0800 Subject: [PATCH] =?UTF-8?q?feat(ticket-order):=20=E5=B0=86=20TVM=20UI=20?= =?UTF-8?q?=E7=9A=84=E7=BD=91=E6=A0=BC=E7=AB=99=E7=82=B9=E6=94=B9=E4=B8=BA?= =?UTF-8?q?=E4=B8=8E=E5=90=8E=E5=8F=B0=E4=B8=80=E8=87=B4=E7=9A=84=E5=8D=95?= =?UTF-8?q?=E7=BA=BF=E5=9C=B0=E9=93=81=E5=9B=BE=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/ticket-order.js | 111 ++++++++++++++++++++++++++------------------ 1 file changed, 65 insertions(+), 46 deletions(-) diff --git a/web/ticket-order.js b/web/ticket-order.js index a6e765b..46973c8 100644 --- a/web/ticket-order.js +++ b/web/ticket-order.js @@ -144,8 +144,13 @@ const stopsRaw = Array.isArray(activeLine.stops) ? activeLine.stops : (Array.isArray(activeLine.站点列表) ? activeLine.站点列表 : []); const stops = stopsRaw.map(c => String(c || '').trim()).filter(Boolean); - let stationsHtml = `
`; + let stationsHtml = `
`; + stationsHtml += `
`; + + // The track line background + stationsHtml += `
`; + let hasStations = false; stops.forEach(code => { if (code === '-') return; // Skip breakpoints in this view @@ -156,7 +161,7 @@ const isSelectedFrom = selection[0] === code; const isSelectedTo = selection[1] === code; - const isSelected = isSelectedFrom || isSelectedTo; + const inRoute = Array.isArray(currentRoute) && currentRoute.includes(code); // Check transfers const canonical = stationCanonicalByCode[code] || code; @@ -170,66 +175,80 @@ }); const transferLines = Array.from(linesForThisStation).filter(l => String(l.id) !== String(activeLineId)); + const isTransfer = transferLines.length > 0; + + let nodeColor = activeLine.color || '#94a3b8'; + let nodeSize = isTransfer ? '20px' : '14px'; + let nodeBorder = isTransfer ? '4px' : '3px'; + let badgeHtml = ''; - let transferIcons = ''; - if (transferLines.length > 0) { - transferIcons = `
`; - transferLines.slice(0, 3).forEach(l => { - transferIcons += `
`; - }); - transferIcons += `
`; + if (isSelectedFrom) { + nodeColor = 'var(--success, #16a34a)'; + nodeSize = '24px'; + badgeHtml = `
起点
`; + } else if (isSelectedTo) { + nodeColor = 'var(--danger, #dc2626)'; + nodeSize = '24px'; + badgeHtml = `
终点
`; + } else if (inRoute) { + nodeColor = 'var(--primary, #facc15)'; + if (!isTransfer) nodeSize = '18px'; + else nodeSize = '24px'; } - let badgeHtml = ''; - let borderColor = 'var(--border-color, #e2e8f0)'; - let bgColor = 'var(--surface-color, #f8fafc)'; - let shadow = 'none'; - - if (isSelectedFrom) { - badgeHtml = `
起点
`; - borderColor = 'var(--success, #16a34a)'; - bgColor = '#f0fdf4'; - shadow = '0 4px 6px rgba(0,0,0,0.1)'; - } else if (isSelectedTo) { - badgeHtml = `
终点
`; - borderColor = 'var(--danger, #dc2626)'; - bgColor = '#fef2f2'; - shadow = '0 4px 6px rgba(0,0,0,0.1)'; - } else if (Array.isArray(currentRoute) && currentRoute.includes(code)) { - borderColor = 'var(--primary, #facc15)'; - bgColor = '#fefce8'; - if (Array.isArray(currentRouteTransfers) && currentRouteTransfers.includes(code)) { - badgeHtml = `
换乘
`; - } + let transferDotsHtml = ''; + if (isTransfer) { + transferDotsHtml = `
`; + transferLines.slice(0, 3).forEach(l => { + transferDotsHtml += `
`; + }); + transferDotsHtml += `
`; } stationsHtml += ` -
- ${badgeHtml} -
${code}
-
${name}
- ${enName ? `
${enName}
` : ''} - ${transferIcons} + align-items: center; + width: 70px; + flex-shrink: 0; + cursor: pointer; + transition: transform 0.2s ease; + " onmouseover="this.style.transform='translateY(-4px)'" onmouseout="this.style.transform='translateY(0)'"> + + +
+ ${badgeHtml} + ${transferDotsHtml} +
+
+ + +
+
${code}
+
${name}
+ ${enName ? `
${enName}
` : ''} +
`; }); if (!hasStations) { - stationsHtml += `
该线路暂无站点
`; + stationsHtml += `
该线路暂无站点
`; } - stationsHtml += `
`; + stationsHtml += `
`; mapContainer.innerHTML = tabsHtml + stationsHtml; }