diff --git a/core/frontend/bigscreen/src/app/app.component.ts b/core/frontend/bigscreen/src/app/app.component.ts index 3358909..219bfe8 100644 --- a/core/frontend/bigscreen/src/app/app.component.ts +++ b/core/frontend/bigscreen/src/app/app.component.ts @@ -140,6 +140,7 @@ export class BigscreenAppComponent implements OnInit, AfterViewInit, OnDestroy { this.focusOnStation(station); this.updateSummaryPanel(); + this.reloadTileTimesAndShow(); if (!auto) { this.scrollToTop(); } @@ -531,7 +532,14 @@ export class BigscreenAppComponent implements OnInit, AfterViewInit, OnDestroy { private async loadTileTimes(product: 'radar' | 'rain') { try { - const params = new URLSearchParams({ z: String(this.tileZ), y: String(this.tileY), x: String(this.tileX), limit: '60' }); + const params = new URLSearchParams({ z: String(this.tileZ), y: String(this.tileY), x: String(this.tileX) }); + const toFmt = (s: string) => s.replace('T', ' ') + ':00'; + if (this.start && this.end) { + params.set('from', toFmt(this.start)); + params.set('to', toFmt(this.end)); + } else { + params.set('limit', '60'); + } const path = product === 'rain' ? '/api/rain/times' : '/api/radar/times'; const r = await fetch(`${path}?${params.toString()}`); if (!r.ok) return; diff --git a/core/frontend/src/main.ts b/core/frontend/src/main.ts index 14ffd2f..2cf2859 100644 --- a/core/frontend/src/main.ts +++ b/core/frontend/src/main.ts @@ -316,7 +316,15 @@ export class AppComponent implements OnInit, AfterViewInit { async loadTileTimes(product: 'radar'|'rain') { try { - const params = new URLSearchParams({ z: String(this.tileZ), y: String(this.tileY), x: String(this.tileX), limit: '60' }); + const params = new URLSearchParams({ z: String(this.tileZ), y: String(this.tileY), x: String(this.tileX) }); + // 若指定了开始/结束时间,则按时间范围查询;否则按最近limit条 + const toFmt = (s: string) => s.replace('T',' ') + ':00'; + if (this.start && this.end) { + params.set('from', toFmt(this.start)); + params.set('to', toFmt(this.end)); + } else { + params.set('limit', '60'); + } const path = product==='rain' ? '/api/rain/times' : '/api/radar/times'; const r = await fetch(`${path}?${params.toString()}`); if (!r.ok) return;