持仓监控页整合期货下单、持仓与品种推荐三卡片。

程序报单状态与推荐表内嵌同一页面,/recommend 跳转至 #recommend。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-06-24 10:24:41 +08:00
parent 7b8a660309
commit 87aef80594
6 changed files with 121 additions and 31 deletions
+10 -5
View File
@@ -1,9 +1,14 @@
.trade-page{max-width:960px;margin:0 auto}
.trade-top-bar{display:flex;flex-wrap:wrap;gap:.65rem;align-items:center;margin-bottom:1rem}
.trade-subnav{display:flex;gap:1rem;margin-bottom:1rem;font-size:.88rem}
.trade-subnav span.active{color:var(--accent);font-weight:600;border-bottom:2px solid var(--accent);padding-bottom:.25rem}
.trade-subnav a{color:var(--text-muted);text-decoration:none}
.trade-page{max-width:1100px;margin:0 auto}
.trade-top-bar{display:flex;flex-wrap:wrap;gap:.65rem;align-items:center;margin-bottom:1.25rem}
.trade-dashboard{display:flex;flex-direction:column;gap:1.25rem}
.trade-card{margin-bottom:0}
.trade-card h2{margin-bottom:.65rem}
.trade-order-status{display:grid;gap:.55rem;margin:.75rem 0;padding:.85rem 1rem;background:var(--card-inner);border:1px solid var(--card-border);border-radius:8px;font-size:.85rem}
.trade-order-status .status-row{display:flex;flex-wrap:wrap;align-items:center;gap:.35rem .65rem}
.trade-order-status .trend-active{padding-top:.35rem;border-top:1px dashed var(--card-border)}
.trade-order-actions{display:flex;flex-wrap:wrap;align-items:center;gap:.75rem 1rem;margin-top:1rem}
.trade-footer{background:var(--card-inner);border-radius:8px;padding:.75rem 1rem;font-size:.82rem;line-height:1.55;border:1px solid var(--card-border);margin-top:1rem}
.trade-footer strong{color:var(--accent)}
.rec-blocked td{opacity:.55}
.rec-ok td:first-child{font-weight:600}
#positions .card-body{max-height:520px}
+8 -1
View File
@@ -114,6 +114,13 @@
.then(function (data) {
var cap = document.getElementById('cap-display');
if (cap && data.capital != null) cap.textContent = Number(data.capital).toFixed(2);
var recCap = document.getElementById('rec-capital');
if (recCap && data.capital != null) recCap.textContent = Number(data.capital).toFixed(2);
var riskBadge = document.getElementById('risk-badge');
if (riskBadge && data.risk_status) {
riskBadge.textContent = data.risk_status.status_label;
riskBadge.className = 'badge ' + (data.risk_status.can_trade ? 'profit' : 'loss');
}
var ctpBadge = document.getElementById('ctp-badge');
if (ctpBadge && data.ctp_status) {
ctpBadge.textContent = data.ctp_status.connected ? 'CTP 已连接' : 'CTP 未连接';
@@ -121,7 +128,7 @@
}
var rows = data.rows || [];
if (!rows.length) {
list.innerHTML = '<div class="empty-hint">暂无持仓。请先在「策略交易」开仓,或连接 CTP 同步柜台持仓。</div>';
list.innerHTML = '<div class="empty-hint">暂无持仓。请通过上方「期货下单 → 策略交易」开仓,或连接 CTP 同步柜台持仓。</div>';
return;
}
list.innerHTML = rows.map(buildPosCard).join('');