ui: 复盘表单紧凑布局、即时上传截图并移除占用时新开仓
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -77,12 +77,14 @@ from lib.strategy.strategy_trade_labels import (
|
||||
)
|
||||
from lib.exchange.okx_orders_lib import cancel_okx_all_open_orders, fetch_okx_all_open_orders
|
||||
from lib.instance.journal_images_lib import (
|
||||
collect_journal_slot_images,
|
||||
enrich_journal_api_item,
|
||||
images_json_dumps,
|
||||
journal_image_paths,
|
||||
normalize_journal_draft_id,
|
||||
primary_journal_image,
|
||||
save_journal_slot_uploads,
|
||||
)
|
||||
from lib.instance.journal_upload_api_lib import handle_journal_upload_slot
|
||||
from lib.instance.journal_chart_lib import (
|
||||
JOURNAL_CHART_DEFAULT_LIMIT,
|
||||
JOURNAL_CHART_DEFAULT_TF1,
|
||||
@@ -8459,8 +8461,9 @@ def add_journal():
|
||||
early_exit_raw = "是" if early_exit_trigger == "手动平仓" else "否"
|
||||
early_exit_reason_saved = compose_early_exit_reason_saved(early_exit_trigger, early_exit_note)
|
||||
exit_reason_stored = journal_exit_reason_stored(early_exit_trigger, early_exit_note)
|
||||
entry_id = uuid.uuid4().hex
|
||||
manual_images = save_journal_slot_uploads(
|
||||
entry_id = normalize_journal_draft_id(d.get("journal_draft_id")) or uuid.uuid4().hex
|
||||
manual_images = collect_journal_slot_images(
|
||||
d,
|
||||
request.files,
|
||||
entry_id,
|
||||
app.config["UPLOAD_FOLDER"],
|
||||
@@ -8548,7 +8551,7 @@ def add_journal():
|
||||
d.get("pnl"), entry_reason_norm, exit_reason_stored, d.get("expect_rr"), real_rr_text,
|
||||
early_exit_raw, early_exit_reason_saved, early_exit_trigger, early_exit_note,
|
||||
None, None, None, mood_issues,
|
||||
d.get("post_breakeven_stare"), d.get("new_trade_while_occupied"), d.get("note"), image_filename,
|
||||
d.get("post_breakeven_stare"), None, d.get("note"), image_filename,
|
||||
images_json_str,
|
||||
)
|
||||
)
|
||||
@@ -8571,6 +8574,17 @@ def add_journal():
|
||||
return _redirect_records()
|
||||
|
||||
|
||||
@app.route("/api/journal_upload_slot", methods=["POST"])
|
||||
@login_required
|
||||
def api_journal_upload_slot():
|
||||
payload, code = handle_journal_upload_slot(
|
||||
request,
|
||||
upload_folder=app.config["UPLOAD_FOLDER"],
|
||||
secure_filename_fn=secure_filename,
|
||||
)
|
||||
return jsonify(payload), code
|
||||
|
||||
|
||||
@app.route("/api/journals")
|
||||
@login_required
|
||||
def api_journals():
|
||||
|
||||
@@ -243,7 +243,7 @@
|
||||
.stats-period-block h3{font-size:1rem;color:#dbe4ff;margin-bottom:4px}
|
||||
.stats-period-block .sub{font-size:.78rem;color:#8892b0;margin-bottom:10px;line-height:1.4}
|
||||
</style>
|
||||
<link rel="stylesheet" href="/static/instance_theme.css?v=50">
|
||||
<link rel="stylesheet" href="/static/instance_theme.css?v=52">
|
||||
|
||||
</head>
|
||||
<body
|
||||
@@ -648,39 +648,11 @@
|
||||
<input type="hidden" name="stop_loss_hint" id="stop-loss-hint">
|
||||
<input type="hidden" name="exit_price_hint" id="exit-price-hint">
|
||||
<input type="hidden" name="direction_hint" id="direction-hint">
|
||||
<div class="form-grid">
|
||||
<input type="datetime-local" name="open_datetime" required>
|
||||
<input type="datetime-local" name="close_datetime" required>
|
||||
<input name="coin" placeholder="BTC" required>
|
||||
<input name="tf" placeholder="5m" required>
|
||||
<input name="pnl" placeholder="盈亏(U)" required>
|
||||
<select name="entry_reason" id="journal-entry-reason" required title="固定五种或选其他手写">
|
||||
<option value="">开仓类型(必选)</option>
|
||||
{% for er in entry_reason_options %}
|
||||
<option value="{{ er }}">{{ er }}</option>
|
||||
{% endfor %}
|
||||
<option value="{{ entry_reason_other_value }}">其他(自定义,见下方说明框)</option>
|
||||
</select>
|
||||
<input type="text" name="entry_reason_custom" id="journal-entry-reason-custom" maxlength="2000" placeholder="选「其他」时在此填写开仓类型说明" autocomplete="off" style="display:none">
|
||||
<input name="expect_rr" placeholder="预期RR">
|
||||
<input name="real_rr" placeholder="实际RR">
|
||||
<select name="early_exit_trigger" required title="平仓如何触发">
|
||||
<option value="">离场触发(必选)</option>
|
||||
<option value="止盈">止盈</option>
|
||||
<option value="保本止盈">保本止盈</option>
|
||||
<option value="移动止盈">移动止盈</option>
|
||||
<option value="时间平仓">时间平仓</option>
|
||||
<option value="手动平仓">手动平仓</option>
|
||||
<option value="止损">止损</option>
|
||||
<option value="其他">其他</option>
|
||||
</select>
|
||||
<input name="early_exit_note" id="early-exit-note" placeholder="离场补充(仅手工平仓必填)">
|
||||
<select name="post_breakeven_stare"><option value="否">保本后盯盘:否</option><option value="是">保本后盯盘:是</option></select>
|
||||
<select name="new_trade_while_occupied"><option value="否">占用时新开仓:否</option><option value="是">占用时新开仓:是</option></select>
|
||||
</div>
|
||||
{% from 'journal_form_fields.html' import journal_form_fields %}
|
||||
{{ journal_form_fields(entry_reason_options, entry_reason_other_value) }}
|
||||
{% from 'journal_upload_slots.html' import journal_upload_slots %}
|
||||
{{ journal_upload_slots() }}
|
||||
<div class="form-row" style="margin-top:8px;flex-wrap:wrap;gap:10px;align-items:center">
|
||||
<div class="form-row journal-chart-options" style="flex-wrap:wrap;align-items:center">
|
||||
<label style="display:flex;align-items:center;gap:6px;font-size:.82rem;color:#cfd3ef">
|
||||
<input type="checkbox" name="journal_exchange_chart" value="true">
|
||||
保存时自动生成 K 线图并作为截图
|
||||
@@ -709,8 +681,8 @@
|
||||
<option value="now" {% if journal_chart_default_anchor == 'now' %}selected{% endif %}>当前时间</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="sub" id="journal-chart-anchor-hint" style="font-size:.72rem;color:#8892b0;margin-top:4px">双周期上下排列;截止=平仓时间:开仓前背景至平仓;截止=当前时间:最近 N 根至此刻(可看平仓后走势);标注开仓、平仓与止损位</div>
|
||||
<div class="mood-grid" style="margin-top:8px">
|
||||
<div class="sub" id="journal-chart-anchor-hint" style="font-size:.72rem;color:#8892b0;margin-top:2px;margin-bottom:0">双周期上下排列;截止=平仓时间:开仓前背景至平仓;截止=当前时间:最近 N 根至此刻(可看平仓后走势);标注开仓、平仓与止损位</div>
|
||||
<div class="mood-grid">
|
||||
<label><input type="checkbox" name="mood_issues" value="怕踏空">怕踏空</label>
|
||||
<label><input type="checkbox" name="mood_issues" value="报复开仓">报复开仓</label>
|
||||
<label><input type="checkbox" name="mood_issues" value="盈利飘了">盈利飘了</label>
|
||||
@@ -816,8 +788,8 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="/static/instance_ui.js?v=5"></script>
|
||||
<script src="/static/journal_upload_slots.js?v=1"></script>
|
||||
<script src="/static/instance_ui.js?v=6"></script>
|
||||
<script src="/static/journal_upload_slots.js?v=3"></script>
|
||||
<script src="/static/instance_records_mobile.js?v=2"></script>
|
||||
<script src="/static/time_close_ui.js?v=2"></script>
|
||||
<script src="/static/ai_review_render.js?v=2"></script>
|
||||
|
||||
Reference in New Issue
Block a user