fix(ui): 右上角时间改为同时显示价格数据时间+页面刷新时间,各带图标和标签

This commit is contained in:
hmo
2026-07-27 09:42:06 +08:00
parent 52b2a67a90
commit f0407f3a98
2 changed files with 22 additions and 3 deletions
+9 -2
View File
@@ -265,16 +265,23 @@ async function fetchJSON(url) {
async function refreshAll() {
document.getElementById('tab-overview').classList.add('loading');
const [overview, portfolio, watchlist, reports] = await Promise.all([
const [overview, portfolio, watchlist, reports, watchData] = await Promise.all([
fetchJSON('/api/overview'),
fetchJSON('/api/portfolio'),
fetchJSON('/api/watchlist'),
fetchJSON('/api/reports'),
fetchJSON('/api/watch'),
]);
portfolioData = portfolio;
watchlistData = watchlist;
reportsData = Array.isArray(reports) ? reports : [];
document.getElementById('updateTime').textContent = '更新 ' + new Date().toLocaleTimeString('zh-CN', {hour:'2-digit',minute:'2-digit'});
// 右上角时间显示:来源时间说明
let timeParts = ['⏱页面 ' + new Date().toLocaleTimeString('zh-CN', {hour:'2-digit',minute:'2-digit'})];
if (watchData && watchData.data_time) {
const dt = watchData.data_time.slice(5,16);
timeParts.unshift('📡价格 ' + dt);
}
document.getElementById('updateTime').textContent = timeParts.join(' | ');
document.getElementById('tab-overview').classList.remove('loading');
renderTab(document.querySelector('.tab-btn.active')?.dataset?.tab || 'overview');
}