K线本地缓存、图表交互优化与交易记录表格修复

新增 kline_store 优先读本地库;修复加载中遮挡、支持缩放与交易时段刷新;修复交易记录操作列被裁切。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-06-15 17:27:31 +08:00
parent a9f4e2b1a5
commit b804bd19a7
7 changed files with 505 additions and 80 deletions
+27 -10
View File
@@ -388,21 +388,38 @@
.pos-del{font-size:.75rem;padding:.35rem .65rem}
.trade-toolbar{display:flex;align-items:center;gap:1rem;margin-bottom:1rem;flex-wrap:wrap}
.trade-switch-label{
display:flex;align-items:center;gap:.35rem;
font-size:.68rem;color:var(--text-muted);
white-space:nowrap;margin-bottom:.65rem;cursor:pointer;
display:flex;align-items:center;gap:.4rem;
font-size:.78rem;color:var(--text-muted);
white-space:normal;margin-bottom:.65rem;cursor:pointer;
line-height:1.45;max-width:100%;
}
.trade-switch-label span{line-height:1}
.trade-switch-label input{flex-shrink:0}
.trade-table-wrap{overflow-x:auto}
.trade-table{font-size:.8rem}
.trade-table th{font-size:.75rem;padding:.55rem .45rem}
.trade-table td{padding:.45rem .4rem;vertical-align:middle}
.trade-switch-label span{line-height:1.45;color:var(--text-muted)}
.trade-switch-label input{flex-shrink:0;width:auto}
.trade-table-wrap{
overflow:auto;
max-height:420px;
width:100%;
-webkit-overflow-scrolling:touch;
border-radius:10px;
border:1px solid var(--table-border);
background:var(--card-inner);
}
.trade-table{font-size:.8rem;width:max-content;min-width:100%;table-layout:auto}
.trade-table th{font-size:.75rem;padding:.55rem .45rem;white-space:nowrap;background:var(--card-inner)}
.trade-table td{padding:.45rem .4rem;vertical-align:middle;white-space:nowrap;background:var(--card-inner)}
.trade-table th:last-child,
.trade-table td:last-child{
position:sticky;right:0;z-index:3;
box-shadow:-6px 0 10px rgba(0,0,0,.08);
}
.trade-table thead th:last-child{z-index:4}
.trade-table input,.trade-table select{
padding:.35rem .45rem;font-size:.78rem;border-radius:6px;width:100%;min-width:0;
}
.trade-table .cell-readonly{color:var(--text-primary)}
.trade-actions{display:flex;gap:.35rem;flex-wrap:wrap}
.records-trade-card{overflow:visible}
.records-trade-card .card-body{overflow:visible}
.trade-actions{display:flex;gap:.35rem;flex-wrap:wrap;align-items:center;min-width:148px}
.trade-actions a,.trade-actions button{font-size:.72rem;padding:.3rem .55rem;border-radius:6px;text-decoration:none;border:none;cursor:pointer}
.btn-fill{background:var(--dir-bg);color:var(--accent)}
.btn-verify{background:var(--nav-active);color:#fff}
+22 -1
View File
@@ -26,11 +26,19 @@
<span class="market-quote-price" id="market-quote-price"></span>
<span class="market-quote-meta text-muted" id="market-quote-meta"></span>
</div>
<div class="market-chart-toolbar">
<div class="market-chart-zoom">
<button type="button" class="chart-zoom-btn" id="chart-zoom-in" title="放大"></button>
<button type="button" class="chart-zoom-btn" id="chart-zoom-out" title="缩小"></button>
<button type="button" class="chart-zoom-btn chart-zoom-reset" id="chart-zoom-reset">重置</button>
</div>
<span class="market-refresh-hint text-muted" id="market-refresh-hint"></span>
</div>
<div class="market-chart-wrap">
<div id="market-chart" class="market-chart" aria-label="K线图"></div>
<div class="market-chart-empty" id="market-chart-empty">请选择合约并点击「查看」</div>
</div>
<p class="hint">数据来源:新浪财经。分时图为当日分钟走势;2分/2小时/周线由基础周期合成</p>
<p class="hint">数据来源:新浪财经。支持滚轮/拖拽缩放 K 线;交易时段内行情与 K 线约 1 秒刷新</p>
</div>
<style>
@@ -61,6 +69,19 @@
}
.market-quote-name{font-weight:600;color:var(--text-title)}
.market-quote-price{font-size:1.35rem;font-weight:700;color:var(--accent);font-variant-numeric:tabular-nums}
.market-chart-toolbar{
display:flex;align-items:center;justify-content:space-between;gap:.75rem;
margin-bottom:.5rem;flex-wrap:wrap;
}
.market-chart-zoom{display:flex;gap:.35rem;align-items:center}
.chart-zoom-btn{
width:32px;height:32px;padding:0;border-radius:8px;
border:1px solid var(--input-border);background:var(--toggle-bg);
color:var(--text-primary);font-size:1rem;line-height:1;cursor:pointer;
}
.chart-zoom-btn:hover{border-color:var(--accent);color:var(--accent)}
.chart-zoom-reset{width:auto;padding:0 .65rem;font-size:.75rem}
.market-refresh-hint{font-size:.72rem}
.market-chart-wrap{
position:relative;border-radius:12px;border:1px solid var(--card-border);
background:var(--card-inner);min-height:420px;
+2 -2
View File
@@ -1,14 +1,14 @@
{% extends "base.html" %}
{% block title %}交易记录与复盘 - 国内期货监控系统{% endblock %}
{% block content %}
<div class="card" style="margin-bottom:1.25rem">
<div class="card records-trade-card" style="margin-bottom:1.25rem">
<h2>交易记录</h2>
<div class="card-body">
<label class="trade-switch-label">
<input type="checkbox" id="trade-edit-switch">
<span>修改/核对开关(开启后可编辑关键字段)</span>
</label>
<div class="trade-table-wrap card-scroll">
<div class="trade-table-wrap">
<table class="trade-table">
<thead>
<tr>