Refresh env UI on trade-mode change; hide hedge review tabs in options mode.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-07-30 08:38:19 +08:00
parent 83ce50b24e
commit fdbbde08df
6 changed files with 74 additions and 12 deletions
+16 -2
View File
@@ -248,8 +248,22 @@
return "持平";
}
function tradeModeFromDom() {
var tabs = document.querySelector(".or-tabs");
return (tabs && tabs.getAttribute("data-okx-trade-mode")) || "options";
}
function defaultSourceForMode(mode) {
if (mode === "options_options") return "options_options";
if (mode === "perp_options") return "perp_options";
return "option_spot";
}
function setActiveTab(source) {
activeSource = source || "option_spot";
var mode = tradeModeFromDom();
var allowed = defaultSourceForMode(mode);
activeSource = source || allowed;
if (activeSource !== allowed) activeSource = allowed;
tradesPage = 0;
reviewedPage = 0;
document.querySelectorAll(".or-tab").forEach(function (btn) {
@@ -1312,7 +1326,7 @@
hideJournalForm();
hideDetail();
hardenSearchAutofill();
setActiveTab("option_spot");
setActiveTab(defaultSourceForMode(tradeModeFromDom()));
}
function hardenSearchAutofill() {