Fix trend strategy symbol input clearing on every keystroke.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-06-26 22:40:33 +08:00
parent 69cf94d1df
commit d3b92de703
3 changed files with 27 additions and 2 deletions
+23
View File
@@ -0,0 +1,23 @@
"""Deploy strategy symbol input fix."""
import paramiko
import sys
from pathlib import Path
sys.stdout.reconfigure(encoding="utf-8", errors="replace")
root = Path(__file__).resolve().parents[1]
files = ["templates/strategy.html", "static/js/symbol.js"]
c = paramiko.SSHClient()
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
c.connect("192.168.8.21", username="root", password="woaini88", timeout=15)
sftp = c.open_sftp()
for rel in files:
sftp.put(str(root / rel), f"/opt/qihuo/{rel.replace(chr(92), '/')}")
print("uploaded", rel)
sftp.close()
html = open(root / "templates/strategy.html", encoding="utf-8").read()
js = open(root / "static/js/symbol.js", encoding="utf-8").read()
ok = "symbol-ths-code" in html and 'name="symbol"' not in html.split("symbol-input")[1].split(">")[0]
print("strategy.html pattern OK" if ok else "FAIL strategy.html")
print("symbol.js guard OK" if "hiddenThs !== input" in js else "FAIL symbol.js")
c.close()
+1 -1
View File
@@ -226,7 +226,7 @@
}
input.addEventListener('input', function () {
if (hiddenThs) hiddenThs.value = '';
if (hiddenThs && hiddenThs !== input) hiddenThs.value = '';
if (hiddenName) hiddenName.value = '';
if (hiddenMarket) hiddenMarket.value = '';
if (hiddenSina) hiddenSina.value = '';
+3 -1
View File
@@ -30,8 +30,10 @@
<form id="trend-form" class="form-compact">
<div class="form-line line-2">
<div class="symbol-wrap symbol-mains">
<input class="symbol-input" name="symbol" placeholder="品种,输入中文或代码" autocomplete="off" required>
<input type="text" class="symbol-input" placeholder="品种,输入中文或代码" autocomplete="off" required>
<input type="hidden" name="symbol" class="symbol-ths-code">
<div class="symbol-dropdown"></div>
<div class="symbol-selected"></div>
</div>
<select name="direction"><option value="long">做多</option><option value="short">做空</option></select>
</div>