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 = '

暂无定时任务

'; - return; - } - - let html = ` - - `; - - for (const t of data.tasks) { - const statusBadge = t.running - ? '运行中' - : t.enabled - ? '已停止' - : '已禁用'; - - html += ` - - - - - - - - `; - } - html += '
ID品种周期间隔状态最后执行操作
${t.id}${t.symbol}${t.periods.join(', ')}${t.interval_seconds}s${statusBadge}${t.last_run ? new Date(t.last_run).toLocaleString() : '-'} - ${t.running - ? `` - : `` - } - -
'; - document.getElementById('taskTable').innerHTML = html; - } catch (e) { - addLog(`加载任务失败: ${e.message}`, 'error'); - } - } - async function stopTask(id) { await fetch(`${API}/tasks/${id}/stop`, { method: 'POST' }); showToast('任务已停止', 'success'); diff --git a/data/buffer.db b/data/buffer.db index d71af57..d3fb694 100644 Binary files a/data/buffer.db and b/data/buffer.db differ diff --git a/data/futures_analysis.db b/data/futures_analysis.db index 6ff1d2a..df11f42 100644 Binary files a/data/futures_analysis.db and b/data/futures_analysis.db differ