Auto-size hub order popup iframe so trade form shows without scrollbars.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-06-25 23:22:49 +08:00
parent 1767566951
commit 95d5469d12
7 changed files with 105 additions and 33 deletions
+11 -8
View File
@@ -2527,8 +2527,9 @@ button.btn-sm {
}
.order-popup-modal .order-popup-card {
width: min(920px, calc(100vw - 24px));
max-height: calc(100vh - 32px);
width: min(980px, calc(100vw - 20px));
max-width: none;
max-height: calc(100vh - 20px);
display: flex;
flex-direction: column;
padding: 0;
@@ -2536,7 +2537,7 @@ button.btn-sm {
}
.order-popup-head {
padding: 12px 14px;
padding: 10px 14px;
border-bottom: 1px solid var(--border-soft);
flex-shrink: 0;
}
@@ -2549,19 +2550,21 @@ button.btn-sm {
.order-popup-frame-wrap {
position: relative;
flex: 1;
min-height: 420px;
max-height: calc(100vh - 120px);
flex: 0 0 auto;
width: 100%;
min-height: 0;
overflow: hidden;
background: #0b0d14;
}
.order-popup-frame {
width: 100%;
height: 100%;
min-height: 420px;
height: 520px;
min-height: 0;
border: 0;
display: block;
background: #0b0d14;
overflow: hidden;
}
.order-popup-loading {
+25 -1
View File
@@ -458,12 +458,30 @@
modal.classList.toggle("is-loading", !!loading);
}
function applyOrderPopupFrameHeight(height) {
const frame = document.getElementById("order-popup-frame");
const wrap = document.querySelector(".order-popup-frame-wrap");
if (!frame || !wrap) return;
const maxH = Math.max(320, window.innerHeight - 96);
const h = Math.min(Math.max(Number(height) || 0, 320), maxH);
frame.style.height = h + "px";
wrap.style.height = h + "px";
}
function resetOrderPopupFrameHeight() {
const frame = document.getElementById("order-popup-frame");
const wrap = document.querySelector(".order-popup-frame-wrap");
if (frame) frame.style.height = "";
if (wrap) wrap.style.height = "";
}
function closeOrderPopup() {
const modal = document.getElementById("order-popup-modal");
const frame = document.getElementById("order-popup-frame");
orderPopupUrl = "";
orderPopupCtx = null;
if (frame) frame.src = "about:blank";
resetOrderPopupFrameHeight();
if (modal) {
modal.classList.add("hidden");
modal.setAttribute("aria-hidden", "true");
@@ -556,7 +574,13 @@
window.__hubOrderPopupMsgBound = true;
window.addEventListener("message", (ev) => {
const d = ev.data;
if (!d || d.type !== "hub-order-popup-done") return;
if (!d || typeof d !== "object") return;
if (d.type === "hub-order-popup-resize") {
applyOrderPopupFrameHeight(d.height);
setOrderPopupLoading(false);
return;
}
if (d.type !== "hub-order-popup-done") return;
refreshMonitorBoardNow();
showToast(
d.message || (d.ok ? "开仓请求已提交,请查看监控区" : "开仓提交可能失败,请查看表单提示"),
+1 -1
View File
@@ -1016,7 +1016,7 @@
<span class="instance-frame-spinner" aria-hidden="true"></span>
<span>加载实例下单页…</span>
</div>
<iframe id="order-popup-frame" class="order-popup-frame" title="实盘下单"></iframe>
<iframe id="order-popup-frame" class="order-popup-frame" title="实盘下单" scrolling="no"></iframe>
</div>
</div>
</div>