diff --git a/web/ticket-order.js b/web/ticket-order.js index a5cc7c4..a6e765b 100644 --- a/web/ticket-order.js +++ b/web/ticket-order.js @@ -107,13 +107,13 @@ } // 1. Render Line Tabs - let tabsHtml = `
`; + let tabsHtml = `
`; allLinesData.forEach(line => { const color = line.color || '#94a3b8'; - const isActive = line.id === activeLineId; - const bg = isActive ? color : '#ffffff'; - const fg = isActive ? '#ffffff' : '#334155'; - const border = isActive ? color : '#cbd5e1'; + const isActive = String(line.id) === String(activeLineId); + const bg = isActive ? color : 'var(--bg-color, #ffffff)'; + const fg = isActive ? '#ffffff' : 'var(--text-color, #334155)'; + const border = isActive ? color : 'var(--border-color, #cbd5e1)'; tabsHtml += ` `; @@ -139,11 +140,11 @@ tabsHtml += `
`; // 2. Render Stations for Active Line - const activeLine = allLinesData.find(l => l.id === activeLineId) || allLinesData[0]; + const activeLine = allLinesData.find(l => String(l.id) === String(activeLineId)) || allLinesData[0]; 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 = `
`; let hasStations = false; stops.forEach(code => { @@ -168,7 +169,7 @@ }); }); - const transferLines = Array.from(linesForThisStation).filter(l => l.id !== activeLineId); + const transferLines = Array.from(linesForThisStation).filter(l => String(l.id) !== String(activeLineId)); let transferIcons = ''; if (transferLines.length > 0) { @@ -180,25 +181,25 @@ } let badgeHtml = ''; - let borderColor = '#e2e8f0'; - let bgColor = '#f8fafc'; + let borderColor = 'var(--border-color, #e2e8f0)'; + let bgColor = 'var(--surface-color, #f8fafc)'; let shadow = 'none'; if (isSelectedFrom) { - badgeHtml = `
起点
`; - borderColor = '#16a34a'; + badgeHtml = `
起点
`; + borderColor = 'var(--success, #16a34a)'; bgColor = '#f0fdf4'; shadow = '0 4px 6px rgba(0,0,0,0.1)'; } else if (isSelectedTo) { - badgeHtml = `
终点
`; - borderColor = '#dc2626'; + 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 = '#facc15'; + borderColor = 'var(--primary, #facc15)'; bgColor = '#fefce8'; if (Array.isArray(currentRouteTransfers) && currentRouteTransfers.includes(code)) { - badgeHtml = `
换乘
`; + badgeHtml = `
换乘
`; } } @@ -210,22 +211,22 @@ border: 2px solid ${borderColor}; background: ${bgColor}; cursor: pointer; - transition: all 0.2s; + transition: all 0.2s ease; display: flex; flex-direction: column; box-shadow: ${shadow}; - "> + " onmouseover="this.style.borderColor='var(--primary, #facc15)'" onmouseout="this.style.borderColor='${borderColor}'"> ${badgeHtml} -
${code}
-
${name}
- ${enName ? `
${enName}
` : ''} +
${code}
+
${name}
+ ${enName ? `
${enName}
` : ''} ${transferIcons}
`; }); if (!hasStations) { - stationsHtml += `
该线路暂无站点
`; + stationsHtml += `
该线路暂无站点
`; } stationsHtml += `
`;