Relax perp order dialog spacing; fix styles when dialog mounts on body.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-10-14 16:25:22 +08:00
parent 7d29181a04
commit 5c95625817
3 changed files with 194 additions and 39 deletions
+17 -5
View File
@@ -1385,9 +1385,17 @@
const tag = $("hp-perp-acct-tag");
if (tag) tag.textContent = acctLabel;
const amtPrec = d.amount_precision != null ? Number(d.amount_precision) : 4;
// 弹窗只保留一行行情;明细进测算折叠
const markEl = $("hp-po-mark");
if (markEl) markEl.textContent = "标记 " + fmt(d.mark, 2);
// 指数优先用行情接口,期权链慢/失败时也不再显示 --
if (markEl) {
markEl.textContent =
"标记 " +
fmt(d.mark, 2) +
" · 永续" +
(d.perp_direction === "short" ? "空" : "多") +
" · 面值 " +
fmt(d.contract_size, 4);
}
const mIdx = d.index_px != null ? Number(d.index_px) : NaN;
if (Number.isFinite(mIdx) && mIdx > 0) {
const idxLine = $("hp-index-line");
@@ -1399,7 +1407,6 @@
ooIdx.textContent = "指数 " + fmt(mIdx, 2);
}
}
// OKX 交易账户 USDT 共用,永续行情不单独显示「可用 USDT」
const quoteHtml =
"卖一 " +
fmt(d.ask, 2) +
@@ -1414,7 +1421,12 @@
? " · 永续方向 " + (d.perp_direction === "short" ? "空" : "多")
: "");
const q = $("hp-perp-quote");
if (q) q.innerHTML = quoteHtml;
if (q) {
q.innerHTML = quoteHtml;
// 弹窗内行情已压缩到 mark 行,避免重复挤占
if (q.closest && q.closest(".hp-po-order-dialog")) q.setAttribute("hidden", "");
else q.removeAttribute("hidden");
}
const contractsInput = $("hp-contracts");
if (contractsInput) {
const step = amtPrec <= 0 ? "1" : String(Math.pow(10, -amtPrec));
@@ -1732,7 +1744,7 @@
const ct = Number(state.selected.ct_mult || 0.01);
const ask = Number(state.selected.ask || 0);
const prem = ask * sheets * ct;
line.textContent = "预估权利金 ≈ " + fmt(prem, 4) + " 币(币本位) · 卖一 " + fmt(ask, 4);
line.textContent = "权利金 ≈ " + fmt(prem, 4) + " 币 · 卖一 " + fmt(ask, 4);
}
function buildStraddleRows(contracts) {