Show product name, main contract badge, and exchange on position cards.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-06-26 10:55:37 +08:00
parent 42f2dad52a
commit deb9501cbe
4 changed files with 78 additions and 13 deletions
+3 -1
View File
@@ -65,7 +65,9 @@
.gap-badge{font-size:.72rem}
.rec-market-link{color:inherit;text-decoration:none;display:inline-flex;flex-wrap:wrap;align-items:baseline;gap:.2rem .35rem}
.rec-market-link:hover strong,.rec-market-link:hover .text-accent{color:var(--accent);text-decoration:underline}
.rec-change-up{color:var(--profit)}
.pos-symbol-sub{font-size:.72rem;line-height:1.35}
.pos-main-badge{font-size:.68rem;vertical-align:middle}
.pos-change-up{color:var(--profit)}
.rec-change-down{color:var(--loss)}
#recommend .trade-table-wrap{max-height:min(70vh,520px)}
#positions .card-body.card-scroll{flex:1;max-height:none;overflow-y:auto}
+26 -6
View File
@@ -806,6 +806,25 @@
return '<span class="text-muted">未开启</span>';
}
function posSymbolTitleHtml(row, extraBadges) {
extraBadges = extraBadges || '';
var name = row.symbol_name || row.symbol || '';
var code = row.symbol_code || '';
var mainBadge = row.symbol_is_main ? ' <span class="badge planned pos-main-badge">主力</span>' : '';
var title = name + mainBadge;
if (code && String(name).toLowerCase() !== String(code).toLowerCase()) {
title += ' <span class="text-accent">' + code + '</span>';
} else if (!name && code) {
title = '<span class="text-accent">' + code + '</span>';
}
return title + extraBadges;
}
function posSymbolSubHtml(row) {
if (row.symbol_exchange) return row.symbol_exchange;
return row.symbol_code || '';
}
function buildPendingOrderCard(row) {
var dirBadge = row.direction_label || (row.direction === 'long' ? '做多' : '做空');
var openT = (row.open_time || '').replace('T', ' ').slice(0, 16);
@@ -827,10 +846,10 @@
' · <span class="text-muted">约 ' + remainMin + ' 分钟内未成交自动撤单</span>';
return (
'<div class="pos-card is-pending">' +
'<div class="pos-card-head"><div><div class="title">' + row.symbol +
' <span class="badge dir">' + dirBadge + '</span>' +
' <span class="badge pending">挂单中</span></div>' +
'<div class="text-muted" style="font-size:.72rem">' + (row.symbol_code || '') + '</div></div>' +
'<div class="pos-card-head"><div><div class="title">' + posSymbolTitleHtml(row,
' <span class="badge dir">' + dirBadge + '</span>' +
' <span class="badge pending">挂单中</span>') + '</div>' +
'<div class="text-muted pos-symbol-sub">' + posSymbolSubHtml(row) + '</div></div>' +
'<div class="pos-card-actions">' + cancelBtn + '</div></div>' +
'<div class="pos-card-meta pos-card-meta-line">' + metaLine + '</div>' +
'<div class="pos-metrics">' +
@@ -897,8 +916,9 @@
var openLabel = '开仓';
return (
'<div class="pos-card">' +
'<div class="pos-card-head"><div><div class="title">' + row.symbol + ' <span class="badge dir">' + dirBadge + '</span></div>' +
'<div class="text-muted" style="font-size:.72rem">' + (row.symbol_code || '') + '</div></div>' +
'<div class="pos-card-head"><div><div class="title">' + posSymbolTitleHtml(row,
' <span class="badge dir">' + dirBadge + '</span>') + '</div>' +
'<div class="text-muted pos-symbol-sub">' + posSymbolSubHtml(row) + '</div></div>' +
actionBtns + '</div>' +
'<div class="pos-card-meta pos-card-meta-line">' + metaLine + '</div>' +
'<div class="pos-metrics">' +