fix: 市价加仓预览后无法执行滚仓
修复 embed 壳拦截 roll-form 提交,以及策略 tab 切换后未重新绑定顺势加仓脚本的问题。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -841,7 +841,7 @@
|
|||||||
<script src="/static/ai_review_render.js?v=2"></script>
|
<script src="/static/ai_review_render.js?v=2"></script>
|
||||||
<script src="/static/form_submit_guard.js?v=2"></script>
|
<script src="/static/form_submit_guard.js?v=2"></script>
|
||||||
<script src="/static/manual_order_rr_preview.js?v=5"></script>
|
<script src="/static/manual_order_rr_preview.js?v=5"></script>
|
||||||
<script src="/static/strategy_roll.js?v=5"></script>
|
<script src="/static/strategy_roll.js?v=6"></script>
|
||||||
<script>
|
<script>
|
||||||
const JOURNAL_ENTRY_REASON_OPTIONS = {{ entry_reason_options | tojson }};
|
const JOURNAL_ENTRY_REASON_OPTIONS = {{ entry_reason_options | tojson }};
|
||||||
const JOURNAL_ENTRY_REASON_OTHER = {{ entry_reason_other_value | tojson }};
|
const JOURNAL_ENTRY_REASON_OTHER = {{ entry_reason_other_value | tojson }};
|
||||||
|
|||||||
@@ -808,7 +808,7 @@
|
|||||||
<script src="/static/ai_review_render.js?v=2"></script>
|
<script src="/static/ai_review_render.js?v=2"></script>
|
||||||
<script src="/static/form_submit_guard.js?v=2"></script>
|
<script src="/static/form_submit_guard.js?v=2"></script>
|
||||||
<script src="/static/manual_order_rr_preview.js?v=5"></script>
|
<script src="/static/manual_order_rr_preview.js?v=5"></script>
|
||||||
<script src="/static/strategy_roll.js?v=5"></script>
|
<script src="/static/strategy_roll.js?v=6"></script>
|
||||||
<script>
|
<script>
|
||||||
const JOURNAL_ENTRY_REASON_OPTIONS = {{ entry_reason_options | tojson }};
|
const JOURNAL_ENTRY_REASON_OPTIONS = {{ entry_reason_options | tojson }};
|
||||||
const JOURNAL_ENTRY_REASON_OTHER = {{ entry_reason_other_value | tojson }};
|
const JOURNAL_ENTRY_REASON_OTHER = {{ entry_reason_other_value | tojson }};
|
||||||
|
|||||||
@@ -808,7 +808,7 @@
|
|||||||
<script src="/static/ai_review_render.js?v=2"></script>
|
<script src="/static/ai_review_render.js?v=2"></script>
|
||||||
<script src="/static/form_submit_guard.js?v=2"></script>
|
<script src="/static/form_submit_guard.js?v=2"></script>
|
||||||
<script src="/static/manual_order_rr_preview.js?v=5"></script>
|
<script src="/static/manual_order_rr_preview.js?v=5"></script>
|
||||||
<script src="/static/strategy_roll.js?v=5"></script>
|
<script src="/static/strategy_roll.js?v=6"></script>
|
||||||
<script>
|
<script>
|
||||||
const JOURNAL_ENTRY_REASON_OPTIONS = {{ entry_reason_options | tojson }};
|
const JOURNAL_ENTRY_REASON_OPTIONS = {{ entry_reason_options | tojson }};
|
||||||
const JOURNAL_ENTRY_REASON_OTHER = {{ entry_reason_other_value | tojson }};
|
const JOURNAL_ENTRY_REASON_OTHER = {{ entry_reason_other_value | tojson }};
|
||||||
|
|||||||
@@ -837,7 +837,7 @@
|
|||||||
<script src="/static/ai_review_render.js?v=2"></script>
|
<script src="/static/ai_review_render.js?v=2"></script>
|
||||||
<script src="/static/form_submit_guard.js?v=2"></script>
|
<script src="/static/form_submit_guard.js?v=2"></script>
|
||||||
<script src="/static/manual_order_rr_preview.js?v=5"></script>
|
<script src="/static/manual_order_rr_preview.js?v=5"></script>
|
||||||
<script src="/static/strategy_roll.js?v=5"></script>
|
<script src="/static/strategy_roll.js?v=6"></script>
|
||||||
<script>
|
<script>
|
||||||
const JOURNAL_ENTRY_REASON_OPTIONS = {{ entry_reason_options | tojson }};
|
const JOURNAL_ENTRY_REASON_OPTIONS = {{ entry_reason_options | tojson }};
|
||||||
const JOURNAL_ENTRY_REASON_OTHER = {{ entry_reason_other_value | tojson }};
|
const JOURNAL_ENTRY_REASON_OTHER = {{ entry_reason_other_value | tojson }};
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
let loadingTab = false;
|
let loadingTab = false;
|
||||||
|
|
||||||
/** 自带校验后 form.submit() 的表单,勿在捕获阶段再 fetch 一份(会双发 POST) */
|
/** 自带校验后 form.submit() 的表单,勿在捕获阶段再 fetch 一份(会双发 POST) */
|
||||||
const CUSTOM_SUBMIT_FORM_IDS = new Set(["add-order-form", "key-form"]);
|
const CUSTOM_SUBMIT_FORM_IDS = new Set(["add-order-form", "key-form", "roll-form"]);
|
||||||
|
|
||||||
function isEmbedShell() {
|
function isEmbedShell() {
|
||||||
return document.body && document.body.getAttribute("data-embed-shell") === "1";
|
return document.body && document.body.getAttribute("data-embed-shell") === "1";
|
||||||
@@ -71,6 +71,9 @@
|
|||||||
if (tab === "key_monitor" && global.KeyMonitorForm && typeof global.KeyMonitorForm.init === "function") {
|
if (tab === "key_monitor" && global.KeyMonitorForm && typeof global.KeyMonitorForm.init === "function") {
|
||||||
global.KeyMonitorForm.init();
|
global.KeyMonitorForm.init();
|
||||||
}
|
}
|
||||||
|
if (tab === "strategy" && typeof global.initStrategyRollForm === "function") {
|
||||||
|
global.initStrategyRollForm();
|
||||||
|
}
|
||||||
if (tab === "records") {
|
if (tab === "records") {
|
||||||
if (typeof global.loadJournals === "function") global.loadJournals();
|
if (typeof global.loadJournals === "function") global.loadJournals();
|
||||||
if (typeof global.loadReviews === "function") global.loadReviews();
|
if (typeof global.loadReviews === "function") global.loadReviews();
|
||||||
|
|||||||
@@ -30,6 +30,23 @@
|
|||||||
|
|
||||||
window.syncRollFormMode = syncRollFormMode;
|
window.syncRollFormMode = syncRollFormMode;
|
||||||
|
|
||||||
|
function isEmbedShell() {
|
||||||
|
return document.body && document.body.getAttribute("data-embed-shell") === "1";
|
||||||
|
}
|
||||||
|
|
||||||
|
function submitRollForm(form) {
|
||||||
|
if (isEmbedShell() && window.InstanceEmbed && typeof window.InstanceEmbed.postFormAndReload === "function") {
|
||||||
|
window.InstanceEmbed.postFormAndReload(form, "执行中…");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (window.FormSubmitGuard && typeof window.FormSubmitGuard.nativeSubmitOnce === "function") {
|
||||||
|
window.FormSubmitGuard.nativeSubmitOnce(form, "执行中…");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
form.submit();
|
||||||
|
}
|
||||||
|
|
||||||
|
function initStrategyRollForm() {
|
||||||
const form = document.getElementById("roll-form");
|
const form = document.getElementById("roll-form");
|
||||||
if (!form) return;
|
if (!form) return;
|
||||||
if (form.dataset.rollJsInit === "1") return;
|
if (form.dataset.rollJsInit === "1") return;
|
||||||
@@ -81,9 +98,12 @@
|
|||||||
if (!submitBtn || trendLocked) return;
|
if (!submitBtn || trendLocked) return;
|
||||||
if (isMonitorMode()) {
|
if (isMonitorMode()) {
|
||||||
submitBtn.disabled = false;
|
submitBtn.disabled = false;
|
||||||
|
submitBtn.removeAttribute("disabled");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
submitBtn.disabled = !previewOk || !!countdownTimer;
|
const blocked = !previewOk || !!countdownTimer;
|
||||||
|
submitBtn.disabled = blocked;
|
||||||
|
if (!blocked) submitBtn.removeAttribute("disabled");
|
||||||
}
|
}
|
||||||
|
|
||||||
function clearMessageBox() {
|
function clearMessageBox() {
|
||||||
@@ -206,7 +226,10 @@
|
|||||||
requestPreview()
|
requestPreview()
|
||||||
.then(function (data) {
|
.then(function (data) {
|
||||||
monitorSubmitting = false;
|
monitorSubmitting = false;
|
||||||
if (submitBtn && !trendLocked) submitBtn.disabled = false;
|
if (submitBtn && !trendLocked) {
|
||||||
|
submitBtn.disabled = false;
|
||||||
|
submitBtn.removeAttribute("disabled");
|
||||||
|
}
|
||||||
if (!data.ok) {
|
if (!data.ok) {
|
||||||
showReject(data.msg || "无法提交监控");
|
showReject(data.msg || "无法提交监控");
|
||||||
return;
|
return;
|
||||||
@@ -223,11 +246,14 @@
|
|||||||
if (!confirm("确认提交「" + modeLabel + "」?\n" + summary)) {
|
if (!confirm("确认提交「" + modeLabel + "」?\n" + summary)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
form.submit();
|
submitRollForm(form);
|
||||||
})
|
})
|
||||||
.catch(function () {
|
.catch(function () {
|
||||||
monitorSubmitting = false;
|
monitorSubmitting = false;
|
||||||
if (submitBtn && !trendLocked) submitBtn.disabled = false;
|
if (submitBtn && !trendLocked) {
|
||||||
|
submitBtn.disabled = false;
|
||||||
|
submitBtn.removeAttribute("disabled");
|
||||||
|
}
|
||||||
showReject("校验请求失败,请稍后重试");
|
showReject("校验请求失败,请稍后重试");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -263,27 +289,30 @@
|
|||||||
});
|
});
|
||||||
if (previewBtn) previewBtn.addEventListener("click", runPreview);
|
if (previewBtn) previewBtn.addEventListener("click", runPreview);
|
||||||
form.addEventListener("submit", function (e) {
|
form.addEventListener("submit", function (e) {
|
||||||
if (isMonitorMode()) {
|
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
if (isMonitorMode()) {
|
||||||
runMonitorSubmit();
|
runMonitorSubmit();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!previewOk) {
|
if (!previewOk) {
|
||||||
e.preventDefault();
|
|
||||||
showReject("请先点击「预览」并通过校验");
|
showReject("请先点击「预览」并通过校验");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (submitBtn && submitBtn.disabled) {
|
if (submitBtn && submitBtn.disabled) {
|
||||||
e.preventDefault();
|
|
||||||
showReject("请等待 10 秒确认倒计时结束后再执行市价加仓");
|
showReject("请等待 10 秒确认倒计时结束后再执行市价加仓");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const modeLabel = modeSel.options[modeSel.selectedIndex].text;
|
const modeLabel = modeSel.options[modeSel.selectedIndex].text;
|
||||||
if (!confirm("确认提交「" + modeLabel + "」?")) {
|
if (!confirm("确认提交「" + modeLabel + "」?")) {
|
||||||
e.preventDefault();
|
return;
|
||||||
}
|
}
|
||||||
|
submitRollForm(form);
|
||||||
});
|
});
|
||||||
|
|
||||||
syncDirectionLock();
|
syncDirectionLock();
|
||||||
syncFieldVisibility();
|
syncFieldVisibility();
|
||||||
|
}
|
||||||
|
|
||||||
|
window.initStrategyRollForm = initStrategyRollForm;
|
||||||
|
initStrategyRollForm();
|
||||||
})();
|
})();
|
||||||
|
|||||||
@@ -118,9 +118,9 @@
|
|||||||
<script src="/static/ai_review_render.js?v=2"></script>
|
<script src="/static/ai_review_render.js?v=2"></script>
|
||||||
<script src="/static/form_submit_guard.js?v=2"></script>
|
<script src="/static/form_submit_guard.js?v=2"></script>
|
||||||
<script src="/static/manual_order_rr_preview.js?v=5"></script>
|
<script src="/static/manual_order_rr_preview.js?v=5"></script>
|
||||||
<script src="/static/strategy_roll.js?v=5"></script>
|
<script src="/static/strategy_roll.js?v=6"></script>
|
||||||
<script src="/static/key_monitor_form.js?v=2"></script>
|
<script src="/static/key_monitor_form.js?v=2"></script>
|
||||||
{% include 'embed_boot_scripts.html' %}
|
{% include 'embed_boot_scripts.html' %}
|
||||||
<script src="/static/instance_embed.js?v=5"></script>
|
<script src="/static/instance_embed.js?v=6"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -14,6 +14,6 @@
|
|||||||
{% include 'strategy_roll_panel.html' %}
|
{% include 'strategy_roll_panel.html' %}
|
||||||
<p class="rule-tip" style="margin-top:12px"><a href="/strategy/roll/docs" style="color:#8fc8ff">顺势加仓完整逻辑说明</a></p>
|
<p class="rule-tip" style="margin-top:12px"><a href="/strategy/roll/docs" style="color:#8fc8ff">顺势加仓完整逻辑说明</a></p>
|
||||||
</div>
|
</div>
|
||||||
<script src="/static/strategy_roll.js?v=5"></script>
|
<script src="/static/strategy_roll.js?v=6"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
Reference in New Issue
Block a user