diff --git a/app/static/index.html b/app/static/index.html index 2cd175f..2c27ad5 100644 --- a/app/static/index.html +++ b/app/static/index.html @@ -1330,10 +1330,14 @@ // Navigation function navigateTo(page) { + if (!page) return; + const pageEl = document.getElementById(`page-${page}`); + if (!pageEl) return; + document.querySelectorAll('.page').forEach(p => p.classList.remove('active')); document.querySelectorAll('.nav-item').forEach(n => n.classList.remove('active')); - document.getElementById(`page-${page}`).classList.add('active'); + pageEl.classList.add('active'); document.querySelector(`.nav-item[data-page="${page}"]`).classList.add('active'); const titles = { @@ -1347,7 +1351,7 @@ document.getElementById('pageTitle').textContent = titles[page] || page; } - document.querySelectorAll('.nav-item').forEach(item => { + document.querySelectorAll('.nav-item[data-page]').forEach(item => { item.addEventListener('click', () => navigateTo(item.dataset.page)); }); @@ -2019,15 +2023,15 @@ const jsonStr = JSON.stringify(exportObj, null, 2); const blob = new Blob([jsonStr], { type: 'application/json' }); - const url = URL.createObjectURL(blob); + const downloadUrl = URL.createObjectURL(blob); const a = document.createElement('a'); - a.href = url; + a.href = downloadUrl; a.download = filename; document.body.appendChild(a); a.click(); document.body.removeChild(a); - URL.revokeObjectURL(url); + URL.revokeObjectURL(downloadUrl); const periodCount = currentQueryData.timeframes.length; const totalCandles = currentQueryData.timeframes.reduce((sum, tf) => sum + (tf.candles ? tf.candles.length : 0), 0); @@ -2096,9 +2100,9 @@ } const queryString = params.toString(); - const url = `${API}/data/latest/${symbol}${queryString ? '?' + queryString : ''}`; + const fetchUrl = `${API}/data/latest/${symbol}${queryString ? '?' + queryString : ''}`; - const fetchRes = await fetch(url); + const fetchRes = await fetch(fetchUrl); if (!fetchRes.ok) { failedCount++; failedSymbols.push(symbol); @@ -2133,15 +2137,15 @@ const jsonStr = JSON.stringify(exportObj, null, 2); const blob = new Blob([jsonStr], { type: 'application/json' }); - const url = URL.createObjectURL(blob); + const downloadUrl = URL.createObjectURL(blob); const a = document.createElement('a'); - a.href = url; + a.href = downloadUrl; a.download = filename; document.body.appendChild(a); a.click(); document.body.removeChild(a); - URL.revokeObjectURL(url); + URL.revokeObjectURL(downloadUrl); const candleCount = fetchData.timeframes.reduce((sum, tf) => sum + (tf.candles ? tf.candles.length : 0), 0); successCount++; @@ -2618,51 +2622,6 @@ } } - // Load Tasks - async function loadTasks() { - try { - const res = await fetch(`${API}/tasks`); - const data = await res.json(); - - if (!data.tasks.length) { - document.getElementById('taskTable').innerHTML = '
暂无定时任务
| ID | 品种 | 周期 | 间隔 | 状态 | 最后执行 | 操作 |
|---|---|---|---|---|---|---|
| ${t.id} | -${t.symbol} |
- ${t.periods.join(', ')} | -${t.interval_seconds}s | -${statusBadge} | -${t.last_run ? new Date(t.last_run).toLocaleString() : '-'} | -- ${t.running - ? `` - : `` - } - - | -