refactor(web): 重构全站界面与事件日志,优化功能与样式
1. 重构并统一票务、IC卡的事件日志格式化展示逻辑,替换原有零散的格式化函数,提升事件展示的一致性与可读性 2. 为AI助手面板新增折叠按钮与折叠逻辑,支持收起/展开面板,优化界面空间利用率 3. 移除多个页面的冗余介绍、提醒区块,精简页面结构 4. 修复IC卡购卡页面的充值选项按钮布局问题,将button元素改为div适配样式规范 5. 新增移动端卡片布局的横向滚动适配,优化小屏设备上的卡片展示与浏览体验 6. 更新后台管理页面的导航样式、文案与统计数据展示,新增车票、凭证的统计卡片 7. 统一全站品牌文案与页面格式,修复部分页面的DOCTYPE多余空格问题 8. 简化车票订单页面的地图加载逻辑,修复原有的冗余代码与加载异常问题
This commit is contained in:
+25
-14
@@ -107,18 +107,31 @@
|
||||
return [stationName, stationName && stationCode ? stationCode : ''].filter(Boolean).join(' ');
|
||||
};
|
||||
|
||||
const formatEventExtra = (event) => {
|
||||
const type = getEventType(event);
|
||||
const formatTicketEventUnified = (ev) => {
|
||||
const type = getEventType(ev);
|
||||
const action = String(ev.action || ev["动作"] || '').toLowerCase();
|
||||
const deviceId = ev.device || ev.device_id || ev["设备编号"] || ev["机器ID"] || '---';
|
||||
const timeStr = formatTime(ev.ts || ev["时间戳"]);
|
||||
|
||||
if (type === 'sale' || type === '售票') {
|
||||
const amount = event.amount ?? event["售票额"];
|
||||
if (amount != null && amount !== '') return `票价:¥ ${amount}`;
|
||||
const cost = ev.cost ?? ev.price ?? ev.amount ?? ev["票价"] ?? ev["售票额"] ?? '0';
|
||||
return \`机器ID: \${deviceId};票价: \${cost};时间: \${timeStr}\`;
|
||||
}
|
||||
|
||||
const stationEn = event.station_en || event["站点英文"] || '';
|
||||
const deviceId = event["设备编号"] || event.device_id || '';
|
||||
if (stationEn && deviceId) return `${stationEn} (${deviceId})`;
|
||||
if (deviceId) return `设备:${deviceId}`;
|
||||
return stationEn;
|
||||
if (type === 'entry' || action === 'entry') {
|
||||
const code = ev.station_code || ev["站点编号"] || '---';
|
||||
const name = ev.station_name || ev["站点中文"] || ev["发生站"] || '---';
|
||||
return \`机器ID: \${deviceId};站点编号: \${code};站点中文: \${name};时间: \${timeStr}\`;
|
||||
}
|
||||
if (type === 'exit' || action === 'exit') {
|
||||
const code = ev.station_code || ev["站点编号"] || '---';
|
||||
const name = ev.station_name || ev["站点中文"] || ev["发生站"] || '---';
|
||||
return \`机器ID: \${deviceId};站点编号: \${code};站点中文: \${name};时间: \${timeStr}\`;
|
||||
}
|
||||
|
||||
// fallback
|
||||
const code = ev.station_code || ev["站点编号"] || '---';
|
||||
const name = ev.station_name || ev["站点中文"] || ev["发生站"] || '---';
|
||||
return \`机器ID: \${deviceId};站点编号: \${code};站点中文: \${name};时间: \${timeStr}\`;
|
||||
};
|
||||
|
||||
function renderList(items) {
|
||||
@@ -219,12 +232,10 @@
|
||||
${evs.map(e => `
|
||||
<div class="jr-history-item">
|
||||
<div class="jr-history-row">
|
||||
<span class="jr-history-title">${formatEventTitle(e)}</span>
|
||||
<span class="jr-history-time">${formatTime(e.ts || e["时间戳"])}</span>
|
||||
<span class="jr-history-title">${escapeHtml(formatEventTitle(e))}</span>
|
||||
</div>
|
||||
<div class="jr-history-desc">
|
||||
<div>${formatEventLocation(e)}</div>
|
||||
<div style="margin-top:4px;">${formatEventExtra(e) || '---'}</div>
|
||||
<div style="margin-top:4px;">${escapeHtml(formatTicketEventUnified(e))}</div>
|
||||
</div>
|
||||
</div>
|
||||
`).join('')}
|
||||
|
||||
Reference in New Issue
Block a user