From dd317df58a9285dc3448c25a5160ae9464772645 Mon Sep 17 00:00:00 2001 From: yangsy Date: Thu, 14 Aug 2025 13:06:22 +0800 Subject: [PATCH] chore --- src/components/station-card.vue | 54 ++++++++++ .../query/use-station-list-query.ts | 33 ++++++ src/pages/alarm-page.vue | 7 ++ src/pages/dashboard-page.vue | 31 ++++++ src/pages/device-page.vue | 7 ++ src/pages/log-page.vue | 7 ++ src/pages/login-page.vue | 101 ++++++++++++++++++ src/pages/not-found-page.vue | 20 ++++ src/pages/statistics-page.vue | 7 ++ 9 files changed, 267 insertions(+) create mode 100644 src/components/station-card.vue create mode 100644 src/composables/query/use-station-list-query.ts create mode 100644 src/pages/alarm-page.vue create mode 100644 src/pages/dashboard-page.vue create mode 100644 src/pages/device-page.vue create mode 100644 src/pages/log-page.vue create mode 100644 src/pages/login-page.vue create mode 100644 src/pages/not-found-page.vue create mode 100644 src/pages/statistics-page.vue diff --git a/src/components/station-card.vue b/src/components/station-card.vue new file mode 100644 index 0000000..a81a377 --- /dev/null +++ b/src/components/station-card.vue @@ -0,0 +1,54 @@ + + + + + diff --git a/src/composables/query/use-station-list-query.ts b/src/composables/query/use-station-list-query.ts new file mode 100644 index 0000000..a5306ea --- /dev/null +++ b/src/composables/query/use-station-list-query.ts @@ -0,0 +1,33 @@ +import type { Station } from '@/apis/domains'; +import { ndmVerify } from '@/apis/requests'; +import { useQuery } from '@tanstack/vue-query'; +import { useStationStore } from '@/stores/station'; +import axios from 'axios'; +import dayjs from 'dayjs'; +import { storeToRefs } from 'pinia'; + +export function useStationListQuery() { + const stationStore = useStationStore(); + const { stationList } = storeToRefs(stationStore); + useQuery({ + queryKey: ['station-list'], + queryFn: async () => { + const { data: ndmStationList } = await axios.get<{ code: string; name: string }[]>(`/minio/ndm/ndm-stations.json?_t=${dayjs().unix()}`); + + stationList.value = ndmStationList.map((record) => ({ + code: record.code ?? '', + name: record.name ?? '', + online: false, + })); + + const pingResultList = await Promise.allSettled(stationList.value.map((station) => ndmVerify(station.code))); + + stationList.value = stationList.value.map((station, index) => ({ + ...station, + online: pingResultList[index].status === 'fulfilled', + })); + + return stationList.value; + }, + }); +} diff --git a/src/pages/alarm-page.vue b/src/pages/alarm-page.vue new file mode 100644 index 0000000..25a8705 --- /dev/null +++ b/src/pages/alarm-page.vue @@ -0,0 +1,7 @@ + + + + + diff --git a/src/pages/dashboard-page.vue b/src/pages/dashboard-page.vue new file mode 100644 index 0000000..5620871 --- /dev/null +++ b/src/pages/dashboard-page.vue @@ -0,0 +1,31 @@ + + + + + diff --git a/src/pages/device-page.vue b/src/pages/device-page.vue new file mode 100644 index 0000000..fc884c4 --- /dev/null +++ b/src/pages/device-page.vue @@ -0,0 +1,7 @@ + + + + + diff --git a/src/pages/log-page.vue b/src/pages/log-page.vue new file mode 100644 index 0000000..7edc285 --- /dev/null +++ b/src/pages/log-page.vue @@ -0,0 +1,7 @@ + + + + + diff --git a/src/pages/login-page.vue b/src/pages/login-page.vue new file mode 100644 index 0000000..a8f6495 --- /dev/null +++ b/src/pages/login-page.vue @@ -0,0 +1,101 @@ + + + + + diff --git a/src/pages/not-found-page.vue b/src/pages/not-found-page.vue new file mode 100644 index 0000000..8f097ba --- /dev/null +++ b/src/pages/not-found-page.vue @@ -0,0 +1,20 @@ + + + + + diff --git a/src/pages/statistics-page.vue b/src/pages/statistics-page.vue new file mode 100644 index 0000000..1683e02 --- /dev/null +++ b/src/pages/statistics-page.vue @@ -0,0 +1,7 @@ + + + + +