Show options-page price clock and drive header trade stats from pure options.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-08-16 15:59:26 +08:00
parent 82d891ac92
commit 4ade3be2eb
8 changed files with 84 additions and 9 deletions
@@ -1175,6 +1175,10 @@ function accountSnapshotFundingMissing(data){
let accountSnapshotRetryCount = 0;
function applyAccountSnapshot(data){
if(!data || typeof data !== "object") return;
if(data.updated_at){
const updatedEl = document.getElementById("price-last-updated");
if(updatedEl) updatedEl.innerText = data.updated_at;
}
if(typeof data.show_perp_funds !== "undefined"){
applyPerpFundsVisibility(data.show_perp_funds);
}
@@ -1266,7 +1270,11 @@ function applyAccountSnapshot(data){
}
function refreshAccountSnapshot(opts){
const options = opts || {};
const qs = options.force ? "?force=1" : "";
const params = new URLSearchParams();
if(options.force) params.set("force", "1");
const page = (document.body && document.body.getAttribute("data-page")) || "";
if(page) params.set("page", page);
const qs = params.toString() ? ("?" + params.toString()) : "";
fetch("/api/account_snapshot" + qs).then(r=>r.json()).then(data=>{
applyAccountSnapshot(data);
if(accountSnapshotFundingMissing(data) && !options.force && accountSnapshotRetryCount < 3){
+3 -3
View File
@@ -7,7 +7,7 @@
<script src="/static/autofill_guard.js?v=1"></script>
<link rel="stylesheet" href="/static/instance_theme_early.css?v=4">
<link rel="stylesheet" href="/static/account_risk_badge.css?v=4">
<link rel="stylesheet" href="/static/instance_page.css?v=15">
<link rel="stylesheet" href="/static/instance_page.css?v=16">
<link rel="stylesheet" href="/static/instance_theme.css?v=118">
<script src="/static/account_risk_badge.js?v=4"></script>
<script src="/static/open_submit_gate.js?v=1"></script>
@@ -55,7 +55,7 @@
<div id="embed-flash" class="flash" style="display:none" role="status"></div>
{% include 'instance_header_panel.html' %}
{% if initial_tab not in ('settings', 'risk_policy', 'system_guide', 'env_config') and include_transfer_block %}
{% if initial_tab not in ('settings', 'risk_policy', 'system_guide', 'env_config', 'options_review') and include_transfer_block %}
{% include 'instance_top_bar.html' %}
{% endif %}
@@ -146,7 +146,7 @@ window.__INSTANCE_DISPLAY__ = {{ display | tojson }};
</script>
<script src="/static/instance_settings_prefs.js?v=22"></script>
<script src="/static/instance_live.js?v=7"></script>
<script src="/static/instance_embed.js?v=31"></script>
<script src="/static/instance_embed.js?v=32"></script>
<script src="/static/instance_mobile_nav.js?v=2"></script>
</body>
</html>
+11 -3
View File
@@ -18,7 +18,7 @@
<link rel="apple-touch-icon" href="/static/icons/apple-touch-icon.png">
<link rel="manifest" href="/static/icons/manifest.webmanifest">
<title>{{ pwa_app_name }}</title>
<link rel="stylesheet" href="/static/instance_page.css?v=15">
<link rel="stylesheet" href="/static/instance_page.css?v=16">
<link rel="stylesheet" href="/static/instance_theme.css?v=118">
</head>
@@ -178,7 +178,7 @@
{% with msg=get_flashed_messages() %}{% if msg %}<div class="flash">{{ msg[0] }}</div>{% endif %}{% endwith %}
{% include 'instance_header_panel.html' %}
{% if page not in ('settings', 'risk_policy', 'system_guide', 'env_config', 'options', 'options_review', 'hedge_plan') %}
{% if page not in ('settings', 'risk_policy', 'system_guide', 'env_config', 'options_review') %}
{% include 'instance_top_bar.html' %}
{% endif %}
@@ -1441,6 +1441,10 @@ function accountSnapshotFundingMissing(data){
let accountSnapshotRetryCount = 0;
function applyAccountSnapshot(data){
if(!data || typeof data !== "object") return;
if(data.updated_at){
const updatedEl = document.getElementById("price-last-updated");
if(updatedEl) updatedEl.innerText = data.updated_at;
}
if(typeof data.show_perp_funds !== "undefined"){
applyPerpFundsVisibility(data.show_perp_funds);
}
@@ -1541,7 +1545,11 @@ function applyAccountSnapshot(data){
}
function refreshAccountSnapshot(opts){
const options = opts || {};
const qs = options.force ? "?force=1" : "";
const params = new URLSearchParams();
if(options.force) params.set("force", "1");
const page = (document.body && document.body.getAttribute("data-page")) || "";
if(page) params.set("page", page);
const qs = params.toString() ? ("?" + params.toString()) : "";
fetch("/api/account_snapshot" + qs).then(r=>r.json()).then(data=>{
applyAccountSnapshot(data);
if(accountSnapshotFundingMissing(data) && !options.force && accountSnapshotRetryCount < 3){
+1 -1
View File
@@ -1,4 +1,4 @@
{# 三所统一顶栏:实时价(划转已移至系统设置;切点前开仓说明见风控说明·交易执行) #}
<div class="rule-tip instance-price-bar">
<div class="rule-tip instance-top-bar instance-price-bar">
实时价格更新:<span id="price-last-updated">--</span>(北京时间 UTC+8)
</div>