新增品种简介查询页,支持东方财富/新浪合约规格展示

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-06-15 15:54:38 +08:00
parent 706a0fd1a3
commit b77f30b3ff
7 changed files with 425 additions and 0 deletions
+9
View File
@@ -372,6 +372,14 @@
.btn-verify:disabled{opacity:.45;cursor:not-allowed}
.badge.result-manual{background:var(--dir-bg);color:var(--accent)}
.badge.result-external{background:var(--expired-bg);color:var(--expired-text)}
.profile-page .profile-head{display:flex;align-items:center;gap:.65rem;flex-wrap:wrap;margin:1rem 0 .75rem;font-size:.9rem}
.profile-page .profile-source{font-size:.72rem;color:var(--text-muted)}
.profile-spec{max-width:820px;border:1px solid var(--card-border);border-radius:10px;background:var(--card-inner);padding:.25rem .85rem}
.profile-row{display:grid;grid-template-columns:minmax(120px,28%) 1fr;gap:.5rem 1rem;padding:.6rem 0;border-bottom:1px solid var(--table-border);align-items:start}
.profile-row:last-child{border-bottom:none}
.profile-label{color:var(--text-muted);font-size:.84rem;line-height:1.4}
.profile-value{color:var(--text-primary);font-size:.86rem;line-height:1.5;word-break:break-word}
.profile-hint{color:var(--planned-text);font-size:.74rem;margin-top:.25rem;line-height:1.35}
.calc-readonly{background:var(--calc-bg);color:var(--accent)}
@media(max-width:1100px){
.split-grid{grid-template-columns:1fr}
@@ -406,6 +414,7 @@
<a href="{{ url_for('records') }}" class="{% if request.endpoint in ('records', 'trades') %}active{% endif %}">交易记录与复盘</a>
<a href="{{ url_for('stats') }}" class="{% if request.endpoint == 'stats' %}active{% endif %}">统计分析</a>
<a href="{{ url_for('fees') }}" class="{% if request.endpoint == 'fees' %}active{% endif %}">手续费配置</a>
<a href="{{ url_for('contract_profile_page') }}" class="{% if request.endpoint == 'contract_profile_page' %}active{% endif %}">品种简介</a>
<a href="{{ url_for('settings') }}" class="{% if request.endpoint == 'settings' %}active{% endif %}">系统设置</a>
</nav>
</header>
+47
View File
@@ -0,0 +1,47 @@
{% extends "base.html" %}
{% block title %}品种简介 - 国内期货监控系统{% endblock %}
{% block content %}
<div class="card profile-page">
<h2>品种简介</h2>
<div class="card-body">
<form id="contract-search-form" class="form-row" method="get" action="{{ url_for('contract_profile_page') }}">
<div class="symbol-wrap" style="flex:1;min-width:220px;max-width:360px">
<input type="text" class="symbol-input" id="contract-symbol-input"
placeholder="输入品种或合约,如 螺纹钢 / rb2510" autocomplete="off" required>
<input type="hidden" name="symbol" id="contract-symbol-hidden" value="{{ symbol or '' }}">
<div class="symbol-dropdown"></div>
<div class="symbol-selected"></div>
</div>
<button type="submit" class="btn-primary">查询</button>
</form>
<p class="hint">展示交易所合约规格:交易单位、最小变动、保证金、交割规则等(数据来源:东方财富 / 新浪)。</p>
{% if error %}
<div class="flash" style="margin-top:1rem">{{ error }}</div>
{% elif profile %}
<div class="profile-head">
<strong>{{ profile.symbol_name or profile.ths_code }}</strong>
<span class="text-muted">{{ profile.ths_code }}</span>
{% if profile.exchange %}<span class="badge active">{{ profile.exchange }}</span>{% endif %}
<span class="profile-source">来源:{{ profile.source }}</span>
</div>
<div class="profile-spec">
{% for row in profile.rows %}
<div class="profile-row">
<div class="profile-label">{{ row.label }}</div>
<div class="profile-value">
{{ row.value }}
{% if row.hint %}<div class="profile-hint">{{ row.hint }}</div>{% endif %}
</div>
</div>
{% endfor %}
</div>
{% elif symbol %}
<p class="text-muted" style="margin-top:1rem">未查询到该合约简介,请检查合约代码是否正确。</p>
{% endif %}
</div>
</div>
{% endblock %}
{% block extra_js %}
<script src="{{ url_for('static', filename='js/contract.js') }}"></script>
{% endblock %}