diff --git a/src/components/DenseFramework.vue b/src/components/DenseFramework.vue index 0f40a79..896211f 100644 --- a/src/components/DenseFramework.vue +++ b/src/components/DenseFramework.vue @@ -86,7 +86,9 @@ function download() { - + + + diff --git a/src/components/ImageContainer.vue b/src/components/ImageContainer.vue index e586c93..c657529 100644 --- a/src/components/ImageContainer.vue +++ b/src/components/ImageContainer.vue @@ -5,6 +5,7 @@ export interface ImageResult { result: 'success' | 'error' | 'pending' | 'idle' resourceId: string message?: string + extraMetadata?: Record } defineProps<{ @@ -17,6 +18,7 @@ defineProps<{ 图片输出 +
正在加载图片 diff --git a/src/components/dense/RadarSingle.vue b/src/components/dense/RadarSingle.vue index c0ed661..1cea481 100644 --- a/src/components/dense/RadarSingle.vue +++ b/src/components/dense/RadarSingle.vue @@ -48,7 +48,7 @@ const queryUrl = computed(() => { const queryDay = `${selectedDate.value.slice(0, 4)}-${selectedDate.value.slice(4, 6)}-${selectedDate.value.slice(6, 8)}` query.set('day', queryDay) } - else if (selectedDateType.value === 'month') { + if (selectedDateType.value === 'month') { query.set('month', selectedMonth.value) } // const query = `?station=${station}&year=${year}&model_name=${mode}&wind_type=${windType}&H=${selectedH.value}` @@ -65,7 +65,7 @@ onMounted(async () => { const data = await resp.data.value // use regex to extract the year from the path, // ./radar/data\\武汉左岭镇站\\2017\\ZLT_MET01_DLL_L21_01D_20170316.txt - const station_pattern = /data\/(.*?)\// + const station_pattern = /data\/radar\/(.*?)\// const year_pattern = /(\d{4})\/ZLT_/ const date_pattern = /01D_(\d{8})\.txt/ const pairs = data.map((source_text: string) => { diff --git a/src/components/dense/saber/utils.ts b/src/components/dense/saber/utils.ts index 1a80d0b..af7e0f4 100644 --- a/src/components/dense/saber/utils.ts +++ b/src/components/dense/saber/utils.ts @@ -17,7 +17,7 @@ async function refreshCurrentSaberDays(path: string) { currentSaberDays.value = data! } function renderPath(path: string) { - const yearPattern = /\/data\/(\d{4})/ + const yearPattern = /\/data\/saber\/(\d{4})/ const year = path.match(yearPattern)?.[1] const monthPattern = /Temp_O3_(.*)(\d{4})/ const month_mapping = { diff --git a/src/pages/balloon/single.vue b/src/pages/balloon/single.vue index 750816f..1ac543b 100644 --- a/src/pages/balloon/single.vue +++ b/src/pages/balloon/single.vue @@ -53,6 +53,8 @@ const queryUrl = computed(() => { return `${API_BASE_URL}/balloon/render/single?mode=${encodeURIComponent(selectedMode)}&path=${encodeURIComponent(selectedDate)}` }) +const metadata = ref({} as Record) + async function customHandle(resp: Response) { if (resp.status === 204) { const res: ImageResult = { @@ -60,12 +62,15 @@ async function customHandle(resp: Response) { result: 'error', resourceId: '', } + metadata.value = {} return res } if (resp.status === 200) { - const blob = await resp.blob() + const data = await resp.json() + const blob = await fetch(`data:image/png;base64,${data.image}`).then(r => r.blob()) const url = URL.createObjectURL(blob) + metadata.value = data.metadata const res: ImageResult = { message: '成功', result: 'success', @@ -83,6 +88,11 @@ async function customHandle(resp: Response) {