diff --git a/auto-imports.d.ts b/auto-imports.d.ts index ce2b6d5..b4500cf 100644 --- a/auto-imports.d.ts +++ b/auto-imports.d.ts @@ -38,6 +38,7 @@ declare global { const getCurrentInstance: typeof import('vue')['getCurrentInstance'] const getCurrentScope: typeof import('vue')['getCurrentScope'] const h: typeof import('vue')['h'] + const hasConnection: typeof import('./src/composables/online')['hasConnection'] const ignorableWatch: typeof import('@vueuse/core')['ignorableWatch'] const inject: typeof import('vue')['inject'] const injectLocal: typeof import('@vueuse/core')['injectLocal'] @@ -335,6 +336,7 @@ declare module 'vue' { readonly getCurrentInstance: UnwrapRef readonly getCurrentScope: UnwrapRef readonly h: UnwrapRef + readonly hasConnection: UnwrapRef readonly ignorableWatch: UnwrapRef readonly inject: UnwrapRef readonly injectLocal: UnwrapRef diff --git a/src/App.vue b/src/App.vue index aa50e72..5fe6f05 100644 --- a/src/App.vue +++ b/src/App.vue @@ -100,7 +100,20 @@ const data = { }, ], }, + { + title: 'TIDI', + url: '#', + icon: 'mdi:telescope', + isActive: true, + items: [ + { + title: '波动', + url: '/tidi/waves', + }, + ], + }, ], + 关于: [ { name: 'Design Engineering', diff --git a/src/pages/radar/v1.vue b/src/pages/radar/v1.vue index 1e69b18..71705a5 100644 --- a/src/pages/radar/v1.vue +++ b/src/pages/radar/v1.vue @@ -19,7 +19,7 @@ const selectedDateType = ref('day') const selectedStation = ref('武汉左岭镇站') const selectedYear = ref('2017') const selectedWindType = ref('uwind') -const selectedH = ref(90000) +const selectedH = ref(94000) const selectedDate = ref('20170316') const selectedMonth = ref('1') @@ -55,6 +55,7 @@ const queryUrl = computed(() => { query.set('model_name', mode) query.set('wind_type', windType) query.set('H', selectedH.value.toString()) + query.set('mode', selectedDateType.value) if (selectedDateType.value === 'day') { const queryDay = `${selectedDate.value.slice(0, 4)}-${selectedDate.value.slice(4, 6)}-${selectedDate.value.slice(6, 8)}` query.set('day', queryDay) @@ -87,8 +88,8 @@ onMounted(async () => { const data = await resp.json() // use regex to extract the year from the path, // ./radar/data\\武汉左岭镇站\\2017\\ZLT_MET01_DLL_L21_01D_20170316.txt - const station_pattern = /data\\(.*?)\\/ - const year_pattern = /(\d{4})\\ZLT_/ + const station_pattern = /data\/(.*?)\// + const year_pattern = /(\d{4})\/ZLT_/ const date_pattern = /01D_(\d{8})\.txt/ const pairs = data.map((source_text: string) => { const station = source_text.match(station_pattern)?.[1] @@ -179,7 +180,7 @@ onMounted(async () => { id="start" v-model:model-value="selectedH" :format-options="{ useGrouping: false, - }" :default-value="90000" + }" :default-value="94000" > diff --git a/src/pages/radar/v2.vue b/src/pages/radar/v2.vue index 58a318b..37145c5 100644 --- a/src/pages/radar/v2.vue +++ b/src/pages/radar/v2.vue @@ -13,9 +13,11 @@ import type { ImageResult } from '~/components/ImageContainer.vue' import { API_BASE_URL } from '~/CONSTANT' -const selectedMode = ref('潮汐波') +const selectedMode = ref('2日行星波') +const selectedWave = ref('潮汐波') const selectedStation = ref('武汉左岭镇站') const selectedYear = ref('2017') +const selectedMonthRange = reactive({ start: '1', end: '12' }) const imageResult = reactive({ result: 'idle', imageUrl: '', @@ -23,7 +25,6 @@ const imageResult = reactive({ }) const modes = [ - '潮汐波', '2日行星波', '5日行星波', '10日行星波', @@ -35,15 +36,18 @@ const stations = ref>(new Set()) const years = ref>(new Set()) const queryUrl = computed(() => { - const station = encodeURIComponent(selectedStation.value) - const year = encodeURIComponent(selectedYear.value) - const mode = encodeURIComponent(selectedMode.value) - const query = `?station=${station}&year=${year}&model_name=${mode}` - const path = `${API_BASE_URL}/radar/render/v2${query}` + // const query = `?station=${station}&year=${year}&model_name=${mode}` + const query = new URLSearchParams() + query.set('station', selectedStation.value) + query.set('year', selectedYear.value) + query.set('model_name', selectedWave.value === '潮汐波' ? '潮汐波' : selectedMode.value) + query.set('start_month', selectedMonthRange.start) + query.set('end_month', selectedMonthRange.end) + const path = `${API_BASE_URL}/radar/render/changes?${query}` return path }) -const { onFetchResponse, isFetching, execute } = useFetch(queryUrl, { refetch: true }) +const { onFetchResponse, isFetching, execute } = useFetch(queryUrl, { immediate: false }) onFetchResponse(async (resp) => { const blob = await resp.blob() @@ -63,8 +67,8 @@ onMounted(async () => { const data = await resp.json() // use regex to extract the year from the path, // ./radar/data\\武汉左岭镇站\\2017\\ZLT_MET01_DLL_L21_01D_20170316.txt - const station_pattern = /data\\(.*?)\\/ - const year_pattern = /(\d{4})\\ZLT_/ + const station_pattern = /data\/(.*?)\// + const year_pattern = /(\d{4})\/ZLT_/ const pairs = data.map((source_text: string) => { const station = source_text.match(station_pattern)?.[1] const year = source_text.match(year_pattern)?.[1] @@ -86,19 +90,28 @@ onMounted(async () => {
- + + + + + 潮汐波 + + + 行星波 + + + +
+ + + + + {{ m.replace("行星波", "") }} + + + +
+ + + + + +
diff --git a/src/pages/tidi/waves.vue b/src/pages/tidi/waves.vue new file mode 100644 index 0000000..5188b4c --- /dev/null +++ b/src/pages/tidi/waves.vue @@ -0,0 +1,114 @@ + + + + + diff --git a/typed-router.d.ts b/typed-router.d.ts index 828d443..be241ca 100644 --- a/typed-router.d.ts +++ b/typed-router.d.ts @@ -28,5 +28,6 @@ declare module 'vue-router/auto-routes' { '/saber/day_fft_ifft_plot': RouteRecordInfo<'/saber/day_fft_ifft_plot', '/saber/day_fft_ifft_plot', Record, Record>, '/saber/month_power_wave_plot': RouteRecordInfo<'/saber/month_power_wave_plot', '/saber/month_power_wave_plot', Record, Record>, '/saber/plot_wave_fitting': RouteRecordInfo<'/saber/plot_wave_fitting', '/saber/plot_wave_fitting', Record, Record>, + '/tidi/waves': RouteRecordInfo<'/tidi/waves', '/tidi/waves', Record, Record>, } }