From 52a5d064a576938433eb5dc017a53b1d70cb5cfe Mon Sep 17 00:00:00 2001 From: april Date: Mon, 14 Aug 2023 18:20:51 +0800 Subject: [PATCH 1/7] =?UTF-8?q?feat:=20=E5=AF=BC=E8=88=AA=E6=B7=B7?= =?UTF-8?q?=E5=90=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Former-commit-id: 5942884a809813c87b6e49cefd4343aa07169b91 --- src/layout/components/Sidebar/LeftMenu.vue | 41 ++++++++++ src/layout/components/Sidebar/TopMenu.vue | 52 ++++++++++++ src/layout/components/Sidebar/index.vue | 92 ++++++++++++++++------ src/layout/index.vue | 80 ++++++++++++++----- src/layout/main.vue | 57 ++++++++++++++ src/store/modules/app.ts | 12 ++- 6 files changed, 287 insertions(+), 47 deletions(-) create mode 100644 src/layout/components/Sidebar/LeftMenu.vue create mode 100644 src/layout/components/Sidebar/TopMenu.vue create mode 100644 src/layout/main.vue diff --git a/src/layout/components/Sidebar/LeftMenu.vue b/src/layout/components/Sidebar/LeftMenu.vue new file mode 100644 index 00000000..bae939cf --- /dev/null +++ b/src/layout/components/Sidebar/LeftMenu.vue @@ -0,0 +1,41 @@ + + diff --git a/src/layout/components/Sidebar/TopMenu.vue b/src/layout/components/Sidebar/TopMenu.vue new file mode 100644 index 00000000..35db809c --- /dev/null +++ b/src/layout/components/Sidebar/TopMenu.vue @@ -0,0 +1,52 @@ + + diff --git a/src/layout/components/Sidebar/index.vue b/src/layout/components/Sidebar/index.vue index 3eb734ae..16f36850 100644 --- a/src/layout/components/Sidebar/index.vue +++ b/src/layout/components/Sidebar/index.vue @@ -1,18 +1,15 @@ diff --git a/src/layout/index.vue b/src/layout/index.vue index 0d2e4589..7e3109bc 100644 --- a/src/layout/index.vue +++ b/src/layout/index.vue @@ -1,13 +1,15 @@ + diff --git a/src/store/modules/app.ts b/src/store/modules/app.ts index cd1c1860..b538d0cf 100644 --- a/src/store/modules/app.ts +++ b/src/store/modules/app.ts @@ -14,11 +14,12 @@ export const useAppStore = defineStore("app", () => { const language = useStorage("language", defaultSettings.language); const sidebarStatus = useStorage("sidebarStatus", "closed"); + const sidebar = reactive({ opened: sidebarStatus.value !== "closed", withoutAnimation: false, }); - + const activeTopMenu = useStorage("activeTop", ""); /** * 根据语言标识读取对应的语言包 */ @@ -68,18 +69,25 @@ export const useAppStore = defineStore("app", () => { function changeLanguage(val: string) { language.value = val; } - + /** + * 混合模式顶部切换 + */ + function changeTopActive(val: string) { + activeTopMenu.value = val; + } return { device, sidebar, language, locale, size, + activeTopMenu, toggleDevice, changeSize, changeLanguage, toggleSidebar, closeSideBar, openSideBar, + changeTopActive, }; }); From e01e221106f77c1e00fedf06e599a2e6536cb94f Mon Sep 17 00:00:00 2001 From: april Date: Mon, 14 Aug 2023 18:37:57 +0800 Subject: [PATCH 2/7] =?UTF-8?q?fix:=20=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Former-commit-id: 6b515ae7433a1a5a2a10d8cffeb95d4e92efe7e3 --- src/layout/components/Sidebar/TopMenu.vue | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/layout/components/Sidebar/TopMenu.vue b/src/layout/components/Sidebar/TopMenu.vue index 35db809c..72c3a75f 100644 --- a/src/layout/components/Sidebar/TopMenu.vue +++ b/src/layout/components/Sidebar/TopMenu.vue @@ -18,7 +18,6 @@ onMounted(() => { { + From e03d73bb48872b8851fad71af2b2c52afd85fa60 Mon Sep 17 00:00:00 2001 From: hxr <1490493387@qq.com> Date: Tue, 15 Aug 2023 05:35:35 +0800 Subject: [PATCH 3/7] =?UTF-8?q?fix:=20:bug:=20=E8=A1=A5=E5=85=85=20basePat?= =?UTF-8?q?h=20=E7=88=B6=E7=BA=A7=E8=B7=AF=E5=BE=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Former-commit-id: cce921b52b3f93fb9be8d9619c788a5b1b585fe9 --- src/layout/components/Sidebar/LeftMenu.vue | 27 ++++++++++++++++++- src/layout/components/Sidebar/SidebarItem.vue | 2 ++ src/layout/components/Sidebar/index.vue | 2 +- src/layout/index.vue | 14 +++++----- 4 files changed, 36 insertions(+), 9 deletions(-) diff --git a/src/layout/components/Sidebar/LeftMenu.vue b/src/layout/components/Sidebar/LeftMenu.vue index bae939cf..16d13282 100644 --- a/src/layout/components/Sidebar/LeftMenu.vue +++ b/src/layout/components/Sidebar/LeftMenu.vue @@ -5,6 +5,9 @@ import { useSettingsStore } from "@/store/modules/settings"; import { useAppStore } from "@/store/modules/app"; import variables from "@/styles/variables.module.scss"; +import path from "path-browserify"; +import { isExternal } from "@/utils/index"; + const settingsStore = useSettingsStore(); const appStore = useAppStore(); const currRoute = useRoute(); @@ -17,7 +20,29 @@ const props = defineProps({ }, type: Array, }, + basePath: { + type: String, + required: true, + }, }); + +/** + * 解析路径 + * + * @param routePath 路由路径 + */ +function resolvePath(routePath: string) { + if (isExternal(routePath)) { + return routePath; + } + if (isExternal(props.basePath)) { + return props.basePath; + } + + // 完整路径 = 父级路径(/level/level_3) + 路由路径 + const fullPath = path.resolve(props.basePath, routePath); // 相对路径 → 绝对路径 + return fullPath; +}