修复持仓监控页长时间空白:品种推荐改为异步加载。

页面先渲染三卡片,推荐表并行拉行情,持仓与推荐分别通过 API 加载。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-06-24 10:34:34 +08:00
parent 55d95b4c39
commit 38a38cb51d
4 changed files with 68 additions and 21 deletions
+2 -11
View File
@@ -80,17 +80,8 @@
<th>品种</th><th>交易所</th><th>参考价</th><th>1手保证金</th><th>建议最低资金</th><th>状态</th>
</tr>
</thead>
<tbody>
{% for r in recommend_rows %}
<tr class="rec-{{ r.status }}">
<td><strong>{{ r.name }}</strong> <span class="text-muted">{{ r.ths }}</span></td>
<td>{{ r.exchange }}</td>
<td>{% if r.price %}{{ r.price }}{% else %}—{% endif %}</td>
<td>{% if r.margin_one_lot %}{{ r.margin_one_lot }}{% else %}—{% endif %}</td>
<td>{% if r.min_capital_one_lot %}{{ r.min_capital_one_lot }}{% else %}—{% endif %}</td>
<td><span class="badge {% if r.status=='ok' %}profit{% elif r.status=='blocked' %}loss{% else %}planned{% endif %}">{{ r.status_label }}</span></td>
</tr>
{% endfor %}
<tbody id="recommend-list">
<tr><td colspan="6" class="empty-hint">品种推荐加载中…</td></tr>
</tbody>
</table>
</div>