合约详情默认显示最近 7 天,点击显示全部展开所有数据
This commit is contained in:
@@ -24,15 +24,20 @@
|
||||
{% endif %}
|
||||
|
||||
<div class="section-title">日线数据</div>
|
||||
<p style="font-size:0.78rem;color:var(--sub);margin-bottom:12px;">
|
||||
<div style="display:flex;align-items:center;justify-content:space-between;margin-bottom:10px;">
|
||||
<p style="font-size:0.78rem;color:var(--sub);margin:0;">
|
||||
振幅 = 近 5 日 (最高−最低) 均值取整 · 点击振幅值查看计算过程
|
||||
</p>
|
||||
{% if rows|length > 7 %}
|
||||
<button id="toggle-all" class="btn" style="font-size:0.78rem;padding:4px 14px;background:var(--surface);color:var(--accent);border:1px solid var(--accent);border-radius:5px;cursor:pointer;" onclick="toggleAll()">显示全部 ({{ rows|length }}条)</button>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<div class="table-wrap">
|
||||
<table id="bars-table">
|
||||
<tr><th>日期</th><th>星期</th><th>开盘</th><th>收盘</th><th>最高</th><th>最低</th><th>波幅</th><th>5日均振幅</th></tr>
|
||||
{% for row in rows %}
|
||||
<tr data-index="{{ loop.index0 }}" data-diff="{{ row.diff }}" data-date="{{ row.date }}" data-weekday="{{ row.weekday }}">
|
||||
<tr data-index="{{ loop.index0 }}" data-diff="{{ row.diff }}" data-date="{{ row.date }}" data-weekday="{{ row.weekday }}"{% if loop.index0 >= 7 %} class="extra-row" style="display:none;"{% endif %}>
|
||||
<td>{{ row.date }}</td>
|
||||
<td>{{ row.weekday }}</td>
|
||||
<td>{{ row.open }}</td>
|
||||
@@ -53,6 +58,15 @@
|
||||
</div>
|
||||
|
||||
<script>
|
||||
|
||||
var allShown = false;
|
||||
function toggleAll() {
|
||||
allShown = !allShown;
|
||||
var btn = document.getElementById('toggle-all');
|
||||
var rows = document.querySelectorAll('.extra-row');
|
||||
rows.forEach(function(r) { r.style.display = allShown ? '' : 'none'; });
|
||||
btn.textContent = allShown ? '收起' : '显示全部 ({{ rows|length }}条)';
|
||||
}
|
||||
document.querySelectorAll('.amp-cell').forEach(function(cell) {
|
||||
cell.addEventListener('click', function() {
|
||||
var row = cell.parentElement.parentElement;
|
||||
|
||||
Reference in New Issue
Block a user