修改
This commit is contained in:
@@ -62,6 +62,8 @@
|
||||
.pnl-loss{color:#ff6666;font-weight:600}
|
||||
.pnl-neutral{color:#cfd3ef;font-weight:600}
|
||||
.flash{padding:10px;background:#1e2533;color:#4cc2ff;border-radius:10px;margin-bottom:12px;text-align:center;border:1px solid #304164}
|
||||
form.is-form-submitting{opacity:.88;pointer-events:none}
|
||||
form.is-form-submitting button[type=submit],form.is-form-submitting input[type=submit]{cursor:wait}
|
||||
.ai-result{background:#1a1a29;border:1px solid #2e2e45;border-radius:8px;padding:10px;white-space:pre-wrap;max-height:220px;overflow:auto;font-size:.84rem;line-height:1.45;margin-top:8px}
|
||||
.ai-result.ai-result-md,.detail-modal .panel-body.md-review{white-space:normal}
|
||||
.ai-result-md p,.detail-modal .panel-body.md-review p{margin:6px 0;color:#dde2ff}
|
||||
@@ -318,7 +320,7 @@
|
||||
</select>
|
||||
<button type="submit">手动划转</button>
|
||||
</form>
|
||||
<form action="/add_order" method="post" class="form-row">
|
||||
<form id="add-order-form" action="/add_order" method="post" class="form-row">
|
||||
<input id="order-symbol" name="symbol" placeholder="BTC 或 BTC/USDT" required>
|
||||
<select id="order-direction" name="direction" required>
|
||||
<option value="">方向</option><option value="long">做多</option><option value="short">做空</option>
|
||||
@@ -701,6 +703,7 @@
|
||||
</div>
|
||||
|
||||
<script src="/static/ai_review_render.js?v=1"></script>
|
||||
<script src="/static/form_submit_guard.js?v=1"></script>
|
||||
<script>
|
||||
const JOURNAL_ENTRY_REASON_OPTIONS = {{ entry_reason_options | tojson }};
|
||||
const JOURNAL_ENTRY_REASON_OTHER = {{ entry_reason_other_value | tojson }};
|
||||
@@ -1392,26 +1395,48 @@ const keyForm = document.getElementById("key-form");
|
||||
if(keyForm){
|
||||
keyForm.addEventListener("submit", (e)=>{
|
||||
e.preventDefault();
|
||||
if(window.FormSubmitGuard && FormSubmitGuard.isLocked(keyForm)) return;
|
||||
const symbolEl = keyForm.querySelector('[name="symbol"]');
|
||||
const symbol = (symbolEl ? symbolEl.value : "").trim();
|
||||
if(!symbol){
|
||||
alert("请先输入交易对");
|
||||
return;
|
||||
}
|
||||
if(window.FormSubmitGuard) FormSubmitGuard.lock(keyForm, "校验排名中…");
|
||||
fetch(`/api/symbol_liquidity_rank?symbol=${encodeURIComponent(symbol)}`)
|
||||
.then(r=>r.json().then(d=>({status:r.status, data:d})))
|
||||
.then(({status,data})=>{
|
||||
if(status >= 400 || !data.ok){
|
||||
alert((data && data.msg) || "日成交量排名读取失败");
|
||||
if(window.FormSubmitGuard) FormSubmitGuard.unlock(keyForm);
|
||||
return;
|
||||
}
|
||||
if(!data.in_top30){
|
||||
alert(`${data.symbol} 当前日成交量排名 ${data.rank}/${data.total},不在前30,已拦截。`);
|
||||
if(window.FormSubmitGuard) FormSubmitGuard.unlock(keyForm);
|
||||
return;
|
||||
}
|
||||
keyForm.submit();
|
||||
if(window.FormSubmitGuard) FormSubmitGuard.nativeSubmitOnce(keyForm, "提交中…");
|
||||
else keyForm.submit();
|
||||
})
|
||||
.catch(()=>alert("日成交量排名检查失败,请稍后重试"));
|
||||
.catch(()=>{
|
||||
alert("日成交量排名检查失败,请稍后重试");
|
||||
if(window.FormSubmitGuard) FormSubmitGuard.unlock(keyForm);
|
||||
});
|
||||
});
|
||||
}
|
||||
const addOrderForm = document.getElementById("add-order-form");
|
||||
if(addOrderForm){
|
||||
addOrderForm.addEventListener("submit", function(ev){
|
||||
if(addOrderForm.dataset.submitOnce === "1"){
|
||||
addOrderForm.dataset.submitOnce = "0";
|
||||
return;
|
||||
}
|
||||
ev.preventDefault();
|
||||
if(window.FormSubmitGuard && FormSubmitGuard.isLocked(addOrderForm)) return;
|
||||
addOrderForm.dataset.submitOnce = "1";
|
||||
if(window.FormSubmitGuard) FormSubmitGuard.nativeSubmitOnce(addOrderForm, "开仓提交中…");
|
||||
else addOrderForm.submit();
|
||||
});
|
||||
}
|
||||
// 复盘/AI列表:初次进入页面后再异步刷新一次,避免浏览器 bfcache/重定向后仍显示旧缓存
|
||||
|
||||
Reference in New Issue
Block a user