From 52d1caa7deb092c2603762fddb0638fa6de44594 Mon Sep 17 00:00:00 2001 From: Dustella Date: Sat, 8 Feb 2025 19:24:06 +0800 Subject: [PATCH] feat: map can do things --- package.json | 1 + pnpm-lock.yaml | 8 +++++ src/composables/dateOpt.ts | 3 +- src/layouts/map.vue | 1 + src/pages/map.vue | 62 ++++++++++++++++++++++++++++++++++---- tsconfig.json | 3 +- 6 files changed, 70 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index ff16eff..c5de318 100644 --- a/package.json +++ b/package.json @@ -18,6 +18,7 @@ }, "dependencies": { "@amap/amap-jsapi-loader": "^1.0.1", + "@amap/amap-jsapi-types": "^0.0.15", "@internationalized/date": "^3.7.0", "@unhead/vue": "^1.11.15", "@unocss/preset-web-fonts": "^65.4.3", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index de766c1..d325e51 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -16,6 +16,9 @@ importers: '@amap/amap-jsapi-loader': specifier: ^1.0.1 version: 1.0.1 + '@amap/amap-jsapi-types': + specifier: ^0.0.15 + version: 0.0.15 '@internationalized/date': specifier: ^3.7.0 version: 3.7.0 @@ -219,6 +222,9 @@ packages: '@amap/amap-jsapi-loader@1.0.1': resolution: {integrity: sha512-nPyLKt7Ow/ThHLkSvn2etQlUzqxmTVgK7bIgwdBRTg2HK5668oN7xVxkaiRe3YZEzGzfV2XgH5Jmu2T73ljejw==} + '@amap/amap-jsapi-types@0.0.15': + resolution: {integrity: sha512-oqyRqHpVDZh5bUe2mAJh41ZsziSj0eUzwcfIbiaBNB0eiTJnZNhKsTdk77VOklOjwuwNfsblpKW9LjmWNpeQ7A==} + '@ampproject/remapping@2.3.0': resolution: {integrity: sha512-30iZtAPgz+LTIYoeivqYo853f02jBYSd5uGnGpkFV0M3xOt9aN73erkgYAmZU43x4VfqcnLxW9Kpg3R5LC4YYw==} engines: {node: '>=6.0.0'} @@ -6295,6 +6301,8 @@ snapshots: '@amap/amap-jsapi-loader@1.0.1': {} + '@amap/amap-jsapi-types@0.0.15': {} + '@ampproject/remapping@2.3.0': dependencies: '@jridgewell/gen-mapping': 0.3.5 diff --git a/src/composables/dateOpt.ts b/src/composables/dateOpt.ts index af4e96a..36fcd67 100644 --- a/src/composables/dateOpt.ts +++ b/src/composables/dateOpt.ts @@ -3,9 +3,10 @@ import { type DateValue, parseDate } from '@internationalized/date' function _useOptions() { const options = reactive({ castBeginDate: '', - castDayNo: 0, + castDayNo: -1, renderMode: 'heatmap' as 'heatmap' | 'image', isPlaying: false, + mapping: {} as Record, }) function setCastBeginDate(date: DateValue) { diff --git a/src/layouts/map.vue b/src/layouts/map.vue index f19f3f7..abc9654 100644 --- a/src/layouts/map.vue +++ b/src/layouts/map.vue @@ -26,6 +26,7 @@ onMounted(async () => { const resp = await baseFetch('/tc/metadata').json() const data = resp.data.value.data mapping.value = data + options.mapping = data }) const isDateDisabled = computed(() => { diff --git a/src/pages/map.vue b/src/pages/map.vue index 257d650..c113107 100644 --- a/src/pages/map.vue +++ b/src/pages/map.vue @@ -4,28 +4,78 @@ meta: diff --git a/tsconfig.json b/tsconfig.json index 8bf87c1..a32ac9f 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -16,7 +16,8 @@ "vite-plugin-vue-layouts/client", "vite-plugin-pwa/client", "unplugin-vue-macros/macros-global", - "unplugin-vue-router/client" + "unplugin-vue-router/client", + "@amap/amap-jsapi-types" ], "allowJs": true, "strict": true,