fix: 修改雷达瓦片调取
This commit is contained in:
parent
e2878477de
commit
3161a89857
@ -140,6 +140,7 @@ export class BigscreenAppComponent implements OnInit, AfterViewInit, OnDestroy {
|
|||||||
|
|
||||||
this.focusOnStation(station);
|
this.focusOnStation(station);
|
||||||
this.updateSummaryPanel();
|
this.updateSummaryPanel();
|
||||||
|
this.reloadTileTimesAndShow();
|
||||||
if (!auto) {
|
if (!auto) {
|
||||||
this.scrollToTop();
|
this.scrollToTop();
|
||||||
}
|
}
|
||||||
@ -531,7 +532,14 @@ export class BigscreenAppComponent implements OnInit, AfterViewInit, OnDestroy {
|
|||||||
|
|
||||||
private async loadTileTimes(product: 'radar' | 'rain') {
|
private async loadTileTimes(product: 'radar' | 'rain') {
|
||||||
try {
|
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 path = product === 'rain' ? '/api/rain/times' : '/api/radar/times';
|
||||||
const r = await fetch(`${path}?${params.toString()}`);
|
const r = await fetch(`${path}?${params.toString()}`);
|
||||||
if (!r.ok) return;
|
if (!r.ok) return;
|
||||||
|
|||||||
@ -316,7 +316,15 @@ export class AppComponent implements OnInit, AfterViewInit {
|
|||||||
|
|
||||||
async loadTileTimes(product: 'radar'|'rain') {
|
async loadTileTimes(product: 'radar'|'rain') {
|
||||||
try {
|
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 path = product==='rain' ? '/api/rain/times' : '/api/radar/times';
|
||||||
const r = await fetch(`${path}?${params.toString()}`);
|
const r = await fetch(`${path}?${params.toString()}`);
|
||||||
if (!r.ok) return;
|
if (!r.ok) return;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user