From 3f036dd6f7fe7946245ae97562f1eb735f309440 Mon Sep 17 00:00:00 2001
From: Administrator <15274802129@163.com>
Date: Wed, 08 Jul 2026 11:22:21 +0800
Subject: [PATCH] fix(gate-config): 修复配置页面API调用和DOM操作问题

---
 src/main/resources/static/gate-config.html |   20 ++++++++++----------
 1 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/src/main/resources/static/gate-config.html b/src/main/resources/static/gate-config.html
index 3313236..f0c146a 100644
--- a/src/main/resources/static/gate-config.html
+++ b/src/main/resources/static/gate-config.html
@@ -136,6 +136,8 @@
 let logLines = [];
 const logPanel = document.getElementById('logPanel');
 
+function $(id) { return document.getElementById(id); }
+
 function toast(msg, type) {
     const t = document.getElementById('toast');
     t.innerHTML = msg; t.className = 'toast ' + type;
@@ -181,7 +183,7 @@
     const key = document.getElementById('inputApiKey').value.trim();
     if (!key) return toast('请输入 API Key', 'error');
     try {
-        const d = await fetchApi(API + '/config/load?apiKey=' + encodeURIComponent(key));
+        const d = await fetchApi(API + '/config/load?apiKey=' + encodeURIComponent(key), { method: 'POST' });
         fillForm(d);
         toast('配置已加载', 'success');
     } catch(e) {
@@ -197,13 +199,13 @@
 }
 
 function fillForm(d) {
-    document.getElementById('gridRate').value = d.gridRate || '';
-    document.getElementById('expectedProfit').value = d.expectedProfit || '';
-    document.getElementById('maxLoss').value = d.maxLoss || '';
-    document.getElementById('baseQuantity').value = d.baseQuantity || '';
-    document.getElementById('quantity').value = d.quantity || '';
-    document.getElementById('maxPositionSize').value = d.maxPositionSize ?? '';
-    document.getElementById('stopLossCount').value = d.stopLossCount ?? '';
+    $('#gridRate').value = d.gridRate || '';
+    $('#expectedProfit').value = d.expectedProfit || '';
+    $('#maxLoss').value = d.maxLoss || '';
+    $('#baseQuantity').value = d.baseQuantity || '';
+    $('#quantity').value = d.quantity || '';
+    $('#maxPositionSize').value = d.maxPositionSize ?? '';
+    $('#stopLossCount').value = d.stopLossCount ?? '';
 }
 
 function collectForm() {
@@ -218,8 +220,6 @@
         stopLossCount: parseInt($('#stopLossCount').value) || 0
     };
 }
-
-function $(id) { return document.getElementById(id); }
 
 async function saveConfig() {
     if (!currentApiKey) return toast('请先输入 API Key', 'error');

--
Gitblit v1.9.1