From 92d795ba88edc1659915fce396c6c722d49a2b47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=A5=E6=B5=A9?= Date: Wed, 12 Mar 2025 14:29:38 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E9=87=8D=E6=9E=84=E5=8D=AB?= =?UTF-8?q?=E6=98=9F=E9=80=89=E6=8B=A9=E5=99=A8=E4=B8=BA=E7=8B=AC=E7=AB=8B?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=EF=BC=8C=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E7=BB=93=E6=9E=84=E5=92=8C=E6=80=A7=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/layouts/sakai-vue/composables/layout.ts | 18 +- .../Cesium/components/SatelliteSelector.vue | 186 ++++++++++++++++++ src/pages/Satellite/Cesium/index.page.vue | 172 +--------------- vite.config.plugins.ts | 5 +- 4 files changed, 209 insertions(+), 172 deletions(-) create mode 100644 src/pages/Satellite/Cesium/components/SatelliteSelector.vue diff --git a/src/layouts/sakai-vue/composables/layout.ts b/src/layouts/sakai-vue/composables/layout.ts index 7ac5e85..fbdd010 100644 --- a/src/layouts/sakai-vue/composables/layout.ts +++ b/src/layouts/sakai-vue/composables/layout.ts @@ -1,4 +1,4 @@ -import { computed, reactive } from 'vue'; +import { computed, reactive, watch } from 'vue'; const layoutConfig = reactive({ darkTheme: false, @@ -8,17 +8,31 @@ const layoutConfig = reactive({ surface: null, }); +// 从 localStorage 读取初始状态,如果没有则使用默认值 false +const getStoredMenuState = (): boolean => { + const stored = localStorage.getItem('staticMenuDesktopInactive'); + return stored ? JSON.parse(stored) : false; +}; + const layoutState = reactive({ activeMenuItem: null, configSidebarVisible: false, menuHoverActive: false, overlayMenuActive: false, profileSidebarVisible: false, - staticMenuDesktopInactive: false, + staticMenuDesktopInactive: getStoredMenuState(), staticMenuMobileActive: false, }); export function useLayout() { + // 监听 staticMenuDesktopInactive 的变化并保存到 localStorage + watch( + () => layoutState.staticMenuDesktopInactive, + (newValue) => { + localStorage.setItem('staticMenuDesktopInactive', JSON.stringify(newValue)); + }, + ); + const setActiveMenuItem = (item: Record) => { layoutState.activeMenuItem = item.value || item; }; diff --git a/src/pages/Satellite/Cesium/components/SatelliteSelector.vue b/src/pages/Satellite/Cesium/components/SatelliteSelector.vue new file mode 100644 index 0000000..2b51b2e --- /dev/null +++ b/src/pages/Satellite/Cesium/components/SatelliteSelector.vue @@ -0,0 +1,186 @@ + + + + + diff --git a/src/pages/Satellite/Cesium/index.page.vue b/src/pages/Satellite/Cesium/index.page.vue index c22feea..4465a4e 100644 --- a/src/pages/Satellite/Cesium/index.page.vue +++ b/src/pages/Satellite/Cesium/index.page.vue @@ -1,61 +1,12 @@ @@ -188,21 +41,4 @@ const onCheckAllChange = (e: { target: { checked: boolean } }) => { #cesiumContainer { @apply absolute top-0 left-0 right-0 bottom-0; } - -.satellite-list { - scrollbar-width: thin; -} - -.satellite-list::-webkit-scrollbar { - width: 4px; -} - -.satellite-list::-webkit-scrollbar-thumb { - background-color: rgba(0, 0, 0, 0.2); - border-radius: 4px; -} - -.satellite-selector { - max-height: 80vh; -} diff --git a/vite.config.plugins.ts b/vite.config.plugins.ts index 3cf442b..6d29aee 100644 --- a/vite.config.plugins.ts +++ b/vite.config.plugins.ts @@ -39,10 +39,11 @@ export function Plugins() { const plugins: PluginOption[] = []; plugins.push( + // https://vue-macros.dev/zh-CN/guide/bundler-integration.html VueMacros({ plugins: { vue: Vue({ include: [/\.vue$/, /\.md$/] }), - vueJsx: VueJsx(), // 如有需要 + vueJsx: VueJsx(), // https://uvr.esm.is/guide/configuration.html // https://github.com/posva/unplugin-vue-router vueRouter: VueRouter({ @@ -53,7 +54,7 @@ export function Plugins() { routesFolder: 'src/pages', }), }, - }), // https://vue-macros.dev/zh-CN/guide/bundler-integration.html + }), // https://github.com/JohnCampionJr/vite-plugin-vue-layouts?tab=readme-ov-file#configuration // Layouts({ defaultLayout: 'sakai-vue/AppLayout', pagesDirs: [] }),