Show buy/sell as Chinese labels on live dashboard rows.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-10-21 20:32:24 +08:00
parent 9f6651da2f
commit 1bf353c505
+3 -2
View File
@@ -58,7 +58,7 @@
<td class="muted">{{ t.time_fmt }}</td> <td class="muted">{{ t.time_fmt }}</td>
<td>{{ t.machine_name or '—' }}</td> <td>{{ t.machine_name or '—' }}</td>
<td>{{ t.symbol }}</td> <td>{{ t.symbol }}</td>
<td><span class="tag {% if t.side=='buy' %}green{% else %}red{% endif %}">{{ t.side }}</span></td> <td><span class="tag {% if t.side=='buy' %}green{% else %}red{% endif %}">{% if t.side=='buy' %}买入{% elif t.side=='sell' %}卖出{% else %}{{ t.side }}{% endif %}</span></td>
<td>{{ t.volume if t.volume is not none else '—' }}</td> <td>{{ t.volume if t.volume is not none else '—' }}</td>
<td style="color:{% if t.profit is not none and t.profit>0 %}var(--green){% elif t.profit is not none and t.profit<0 %}var(--red){% else %}inherit{% endif %}"> <td style="color:{% if t.profit is not none and t.profit>0 %}var(--green){% elif t.profit is not none and t.profit<0 %}var(--red){% else %}inherit{% endif %}">
{% if t.profit is none %}—{% else %}{{ '%.2f'|format(t.profit) }}{% endif %} {% if t.profit is none %}—{% else %}{{ '%.2f'|format(t.profit) }}{% endif %}
@@ -143,11 +143,12 @@
} }
body.innerHTML = list.map(function (t) { body.innerHTML = list.map(function (t) {
var sideCls = t.side === 'buy' ? 'green' : 'red'; var sideCls = t.side === 'buy' ? 'green' : 'red';
var sideCn = t.side === 'buy' ? '买入' : (t.side === 'sell' ? '卖出' : (t.side || '—'));
return '<tr>' + return '<tr>' +
'<td class="muted">' + esc(t.time_fmt) + '</td>' + '<td class="muted">' + esc(t.time_fmt) + '</td>' +
'<td>' + esc(t.machine_name || '—') + '</td>' + '<td>' + esc(t.machine_name || '—') + '</td>' +
'<td>' + esc(t.symbol) + '</td>' + '<td>' + esc(t.symbol) + '</td>' +
'<td><span class="tag ' + sideCls + '">' + esc(t.side) + '</span></td>' + '<td><span class="tag ' + sideCls + '">' + esc(sideCn) + '</span></td>' +
'<td>' + esc(t.volume != null ? t.volume : '—') + '</td>' + '<td>' + esc(t.volume != null ? t.volume : '—') + '</td>' +
'<td style="color:' + profitColor(t.profit) + '">' + '<td style="color:' + profitColor(t.profit) + '">' +
(t.profit == null || t.profit === '' ? '—' : Number(t.profit).toFixed(2)) + (t.profit == null || t.profit === '' ? '—' : Number(t.profit).toFixed(2)) +