fix(ui): 右上角时间改为同时显示价格数据时间+页面刷新时间,各带图标和标签
This commit is contained in:
+9
-2
@@ -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');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user