fix(settings): equal columns, form-style option transfers, compact export
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -16,31 +16,6 @@
|
||||
el.classList.toggle("opt-error", !!isErr);
|
||||
}
|
||||
|
||||
function wireChipGroup(id) {
|
||||
const group = document.getElementById(id);
|
||||
if (!group) return function () {
|
||||
return null;
|
||||
};
|
||||
const chips = group.querySelectorAll(".opt-set-chip");
|
||||
chips.forEach(function (chip) {
|
||||
chip.addEventListener("click", function () {
|
||||
chips.forEach(function (c) {
|
||||
c.classList.remove("active");
|
||||
});
|
||||
chip.classList.add("active");
|
||||
});
|
||||
});
|
||||
return function () {
|
||||
return group.querySelector(".opt-set-chip.active");
|
||||
};
|
||||
}
|
||||
|
||||
const activeSwapDir = wireChipGroup("opt-set-swap-dir");
|
||||
const activeIntDir = wireChipGroup("opt-set-int-dir");
|
||||
const activeIntCcy = wireChipGroup("opt-set-int-ccy");
|
||||
const activeCrossDir = wireChipGroup("opt-set-cross-dir");
|
||||
const activeCrossCcy = wireChipGroup("opt-set-cross-ccy");
|
||||
|
||||
const swapBtn = document.getElementById("opt-set-swap-btn");
|
||||
if (swapBtn) {
|
||||
swapBtn.addEventListener("click", async function () {
|
||||
@@ -49,12 +24,11 @@
|
||||
setMsg("opt-set-swap-msg", "请输入有效数量", true);
|
||||
return;
|
||||
}
|
||||
const dirChip = activeSwapDir();
|
||||
const d = await apiJson("/api/options/spot/swap", {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({
|
||||
direction: (dirChip && dirChip.getAttribute("data-dir")) || "usdt_to_usdc",
|
||||
direction: document.getElementById("opt-set-swap-dir").value,
|
||||
amount: amount,
|
||||
}),
|
||||
});
|
||||
@@ -70,15 +44,13 @@
|
||||
setMsg("opt-set-int-msg", "请输入有效数量", true);
|
||||
return;
|
||||
}
|
||||
const dirChip = activeIntDir();
|
||||
const ccyChip = activeIntCcy();
|
||||
const d = await apiJson("/api/options/transfer", {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({
|
||||
ccy: (ccyChip && ccyChip.getAttribute("data-ccy")) || "USDC",
|
||||
from: (dirChip && dirChip.getAttribute("data-from")) || "funding",
|
||||
to: (dirChip && dirChip.getAttribute("data-to")) || "trading",
|
||||
ccy: document.getElementById("opt-set-int-ccy").value,
|
||||
from: document.getElementById("opt-set-int-from").value,
|
||||
to: document.getElementById("opt-set-int-to").value,
|
||||
amount: amount,
|
||||
}),
|
||||
});
|
||||
@@ -94,17 +66,15 @@
|
||||
setMsg("opt-set-cross-msg", "请输入有效数量", true);
|
||||
return;
|
||||
}
|
||||
const dirChip = activeCrossDir();
|
||||
const ccyChip = activeCrossCcy();
|
||||
const d = await apiJson("/api/options/cross-transfer", {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({
|
||||
ccy: (ccyChip && ccyChip.getAttribute("data-ccy")) || "USDT",
|
||||
ccy: document.getElementById("opt-set-cross-ccy").value,
|
||||
amount: amount,
|
||||
from_account: "funding",
|
||||
to_account: "funding",
|
||||
direction: (dirChip && dirChip.getAttribute("data-dir")) || "sub_to_main",
|
||||
from_account: document.getElementById("opt-set-cross-from").value,
|
||||
to_account: document.getElementById("opt-set-cross-to").value,
|
||||
direction: document.getElementById("opt-set-cross-dir").value,
|
||||
}),
|
||||
});
|
||||
setMsg("opt-set-cross-msg", d.ok ? "划转成功" : (d.msg || "失败"), !d.ok);
|
||||
|
||||
Reference in New Issue
Block a user