Rename positions nav to order monitor and set as default landing page.
Remove stats recalculate button; login and home now open /positions without affecting refresh on other routes. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -709,7 +709,7 @@ def login_required(f):
|
||||
@app.route("/")
|
||||
def index():
|
||||
if session.get("logged_in"):
|
||||
return redirect(url_for("plans"))
|
||||
return redirect(url_for("positions"))
|
||||
return redirect(url_for("login"))
|
||||
|
||||
|
||||
@@ -738,7 +738,7 @@ def login():
|
||||
if u == admin_u and check_password_hash(admin_hash, p):
|
||||
session["logged_in"] = True
|
||||
session["username"] = u
|
||||
return redirect(url_for("plans"))
|
||||
return redirect(url_for("positions"))
|
||||
flash("账号或密码错误")
|
||||
return render_template("login.html")
|
||||
|
||||
@@ -916,13 +916,6 @@ def api_position_live():
|
||||
return jsonify(out)
|
||||
|
||||
|
||||
@login_required
|
||||
def index():
|
||||
if nav_enabled(get_setting, "plans"):
|
||||
return redirect(url_for("plans"))
|
||||
return redirect(url_for("positions"))
|
||||
|
||||
|
||||
@app.route("/plans")
|
||||
@login_required
|
||||
@require_nav("plans")
|
||||
|
||||
@@ -145,29 +145,11 @@
|
||||
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
var viewSel = document.getElementById('stats-view-select');
|
||||
var refreshBtn = document.getElementById('stats-refresh-btn');
|
||||
if (viewSel) {
|
||||
viewSel.addEventListener('change', function () {
|
||||
renderBreakdown(this.value);
|
||||
});
|
||||
}
|
||||
if (refreshBtn) {
|
||||
refreshBtn.addEventListener('click', function () {
|
||||
var btn = this;
|
||||
btn.disabled = true;
|
||||
btn.textContent = '计算中…';
|
||||
fetch('/api/stats/refresh', { method: 'POST' })
|
||||
.then(function (r) { return r.json(); })
|
||||
.then(applyData)
|
||||
.catch(function () {
|
||||
alert('重新计算失败');
|
||||
})
|
||||
.finally(function () {
|
||||
btn.disabled = false;
|
||||
btn.textContent = '重新计算';
|
||||
});
|
||||
});
|
||||
}
|
||||
loadStats();
|
||||
});
|
||||
})();
|
||||
|
||||
+1
-1
@@ -518,7 +518,7 @@
|
||||
<h1 class="site-title">国内期货 · 交易监控 + 复盘<span class="site-title-sub">FUTURES MONITOR SYSTEM</span></h1>
|
||||
<button type="button" class="nav-backdrop" id="nav-backdrop" aria-label="关闭菜单" hidden></button>
|
||||
<nav class="site-nav" id="site-nav">
|
||||
<a href="{{ url_for('positions') }}" class="{% if request.endpoint in ('positions', 'trade_page', 'recommend_page') %}active{% endif %}">持仓监控</a>
|
||||
<a href="{{ url_for('positions') }}" class="{% if request.endpoint in ('positions', 'trade_page', 'recommend_page') %}active{% endif %}">下单监控</a>
|
||||
{% if nav_items.strategy %}<a href="{{ url_for('strategy_page') }}" class="{% if request.endpoint in ('strategy_page', 'strategy_records_page') %}active{% endif %}">策略交易</a>{% endif %}
|
||||
{% if nav_items.plans %}<a href="{{ url_for('plans') }}" class="{% if request.endpoint == 'plans' %}active{% endif %}">开单计划</a>{% endif %}
|
||||
<a href="{{ url_for('keys') }}" class="{% if request.endpoint == 'keys' %}active{% endif %}">关键位监控</a>
|
||||
|
||||
@@ -70,7 +70,7 @@
|
||||
<h2>导航显示</h2>
|
||||
<form action="{{ url_for('settings') }}" method="post">
|
||||
<input type="hidden" name="action" value="nav">
|
||||
<p class="hint" style="margin-bottom:.75rem">关闭后顶栏隐藏对应入口,直接访问 URL 也会跳转回持仓监控。</p>
|
||||
<p class="hint" style="margin-bottom:.75rem">关闭后顶栏隐藏对应入口,直接访问 URL 也会跳转回下单监控。</p>
|
||||
<div class="check-row">
|
||||
{% for key, label in nav_toggles.items() %}
|
||||
<label style="display:flex;align-items:center;gap:.5rem;cursor:pointer;white-space:nowrap">
|
||||
@@ -322,7 +322,7 @@
|
||||
<div class="card">
|
||||
<h2>使用提示</h2>
|
||||
<ul class="settings-tips">
|
||||
<li>持仓监控:连接 CTP 后下单、看持仓与品种推荐</li>
|
||||
<li>下单监控:连接 CTP 后下单、看持仓与品种推荐</li>
|
||||
<li>策略交易:趋势回调自动补仓;顺势加仓需先开仓</li>
|
||||
<li>手续费:默认 CTP 柜台费率,连接后点同步</li>
|
||||
<li>手机端:浏览器菜单可「添加到主屏幕」安装 App</li>
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
<div class="card stats-summary-card">
|
||||
<div class="stats-toolbar">
|
||||
<span id="stats-updated" class="hint">正在加载统计…</span>
|
||||
<button type="button" class="btn-secondary" id="stats-refresh-btn">重新计算</button>
|
||||
</div>
|
||||
<div class="stat-grid stat-grid-summary" id="stats-summary">
|
||||
<div class="stat-item"><div class="label">总交易次数</div><div class="value" data-k="total_trades">-</div></div>
|
||||
@@ -45,9 +44,7 @@
|
||||
|
||||
<style>
|
||||
.stats-summary-card{margin-bottom:1.25rem}
|
||||
.stats-toolbar{display:flex;align-items:center;justify-content:space-between;gap:1rem;margin-bottom:.75rem;flex-wrap:wrap}
|
||||
.stats-toolbar .btn-secondary{width:auto;padding:.45rem .85rem;border-radius:8px;border:1px solid var(--input-border);background:var(--toggle-bg);color:var(--text-primary);cursor:pointer;font-size:.78rem}
|
||||
.stats-toolbar .btn-secondary:hover{border-color:var(--accent);color:var(--accent)}
|
||||
.stats-toolbar{display:flex;align-items:center;justify-content:flex-start;gap:1rem;margin-bottom:.75rem;flex-wrap:wrap}
|
||||
.stat-grid-summary{
|
||||
display:flex;flex-wrap:nowrap;align-items:stretch;gap:0;
|
||||
margin-bottom:0;overflow-x:auto;-webkit-overflow-scrolling:touch;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{% extends "base.html" %}
|
||||
{% block title %}持仓监控 - 国内期货监控系统{% endblock %}
|
||||
{% block title %}下单监控 - 国内期货监控系统{% endblock %}
|
||||
{% block extra_css %}
|
||||
<link rel="stylesheet" href="{{ url_for('static', filename='css/trade.css') }}">
|
||||
{% endblock %}
|
||||
@@ -105,7 +105,7 @@
|
||||
</div>
|
||||
|
||||
<div class="card trade-card" id="positions">
|
||||
<h2>持仓监控</h2>
|
||||
<h2>当前持仓</h2>
|
||||
<p class="hint pos-hint">开仓委托先显示「挂单中」,柜台成交后写入监控;超过 <strong>{{ pending_order_timeout_min }}</strong> 分钟未成交自动撤单,可手动撤单。</p>
|
||||
<div class="card-body card-scroll" id="position-live-list">
|
||||
<div class="empty-hint" id="position-placeholder">加载本地持仓…</div>
|
||||
|
||||
Reference in New Issue
Block a user