From 442ae06c47c601b34cc626d182eedb80db70e63d Mon Sep 17 00:00:00 2001 From: pany <939630029@qq.com> Date: Thu, 6 Jul 2023 13:02:52 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9E=E6=B7=B7=E5=90=88?= =?UTF-8?q?=E5=B8=83=E5=B1=80=E6=A8=A1=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/config/layout.ts | 11 +- src/layout/LeftMode.vue | 165 ++++++++++++++++++ src/layout/LeftTopMode.vue | 108 ++++++++++++ src/layout/components/AppMain.vue | 18 -- src/layout/components/Logo/index.vue | 70 ++++++++ src/layout/components/NavigationBar/index.vue | 4 +- src/layout/components/Settings/index.vue | 24 ++- src/layout/components/Sidebar/SidebarLogo.vue | 53 ------ src/layout/components/Sidebar/index.vue | 9 +- src/layout/components/TagsView/index.vue | 5 +- src/layout/components/index.ts | 1 + src/layout/index.vue | 158 +++-------------- src/styles/theme/core/layout.scss | 27 +-- src/styles/transition.scss | 10 +- src/styles/variables.css | 3 +- 15 files changed, 431 insertions(+), 235 deletions(-) create mode 100644 src/layout/LeftMode.vue create mode 100644 src/layout/LeftTopMode.vue create mode 100644 src/layout/components/Logo/index.vue delete mode 100644 src/layout/components/Sidebar/SidebarLogo.vue diff --git a/src/config/layout.ts b/src/config/layout.ts index 7d2f377..ac5ab6e 100644 --- a/src/config/layout.ts +++ b/src/config/layout.ts @@ -1,13 +1,15 @@ import { getConfigLayout } from "@/utils/cache/local-storage" -/** 布局配置 */ +/** 项目配置 */ export interface LayoutSettings { /** 是否显示 Settings Panel */ showSettings: boolean + /** 布局模式 */ + layoutMode: "left" | "top" | "left-top" /** 是否显示标签栏 */ showTagsView: boolean - /** 是否显示侧边栏 Logo */ - showSidebarLogo: boolean + /** 是否显示 Logo */ + showLogo: boolean /** 是否固定 Header */ fixedHeader: boolean /** 是否显示消息通知 */ @@ -25,10 +27,11 @@ export interface LayoutSettings { } export const layoutSettings: LayoutSettings = getConfigLayout() ?? { + layoutMode: "left", showSettings: true, showTagsView: true, fixedHeader: true, - showSidebarLogo: true, + showLogo: true, showNotify: true, showThemeSwitch: true, showScreenfull: true, diff --git a/src/layout/LeftMode.vue b/src/layout/LeftMode.vue new file mode 100644 index 0000000..fa50740 --- /dev/null +++ b/src/layout/LeftMode.vue @@ -0,0 +1,165 @@ + + + + + diff --git a/src/layout/LeftTopMode.vue b/src/layout/LeftTopMode.vue new file mode 100644 index 0000000..43e5c32 --- /dev/null +++ b/src/layout/LeftTopMode.vue @@ -0,0 +1,108 @@ + + + + + diff --git a/src/layout/components/AppMain.vue b/src/layout/components/AppMain.vue index 9b26c41..02f5c89 100644 --- a/src/layout/components/AppMain.vue +++ b/src/layout/components/AppMain.vue @@ -30,10 +30,7 @@ const key = computed(() => { @import "@/styles/mixins.scss"; .app-main { - min-height: calc(100vh - var(--v3-navigationbar-height)); width: 100%; - position: relative; - overflow: hidden; background-color: var(--v3-body-bg-color); } @@ -42,19 +39,4 @@ const key = computed(() => { overflow: auto; @include scrollbar; } - -.fixed-header + .app-main { - padding-top: var(--v3-navigationbar-height); - height: 100vh; - overflow: auto; -} - -.hasTagsView { - .app-main { - min-height: calc(100vh - var(--v3-header-height)); - } - .fixed-header + .app-main { - padding-top: var(--v3-header-height); - } -} diff --git a/src/layout/components/Logo/index.vue b/src/layout/components/Logo/index.vue new file mode 100644 index 0000000..9426dbb --- /dev/null +++ b/src/layout/components/Logo/index.vue @@ -0,0 +1,70 @@ + + + + + diff --git a/src/layout/components/NavigationBar/index.vue b/src/layout/components/NavigationBar/index.vue index 87ac6ae..0e647d3 100644 --- a/src/layout/components/NavigationBar/index.vue +++ b/src/layout/components/NavigationBar/index.vue @@ -5,8 +5,8 @@ import { useAppStore } from "@/store/modules/app" import { useSettingsStore } from "@/store/modules/settings" import { useUserStore } from "@/store/modules/user" import { UserFilled } from "@element-plus/icons-vue" -import Breadcrumb from "../Breadcrumb/index.vue" import Hamburger from "../Hamburger/index.vue" +import Breadcrumb from "../Breadcrumb/index.vue" import ThemeSwitch from "@/components/ThemeSwitch/index.vue" import Screenfull from "@/components/Screenfull/index.vue" import Notify from "@/components/Notify/index.vue" @@ -68,7 +68,7 @@ const logout = () => { .navigation-bar { height: var(--v3-navigationbar-height); overflow: hidden; - background: #fff; + background: var(--v3-header-bg-color); .hamburger { display: flex; align-items: center; diff --git a/src/layout/components/Settings/index.vue b/src/layout/components/Settings/index.vue index eafa840..b8e16eb 100644 --- a/src/layout/components/Settings/index.vue +++ b/src/layout/components/Settings/index.vue @@ -1,4 +1,5 @@ - - - - diff --git a/src/layout/components/Sidebar/index.vue b/src/layout/components/Sidebar/index.vue index eca0654..c83f453 100644 --- a/src/layout/components/Sidebar/index.vue +++ b/src/layout/components/Sidebar/index.vue @@ -6,7 +6,7 @@ import { useAppStore } from "@/store/modules/app" import { usePermissionStore } from "@/store/modules/permission" import { useSettingsStore } from "@/store/modules/settings" import SidebarItem from "./SidebarItem.vue" -import SidebarLogo from "./SidebarLogo.vue" +import Logo from "../Logo/index.vue" import { getCssVariableValue } from "@/utils" const v3SidebarMenuBgColor = getCssVariableValue("--v3-sidebar-menu-bg-color") @@ -18,7 +18,7 @@ const appStore = useAppStore() const permissionStore = usePermissionStore() const settingsStore = useSettingsStore() -const { showSidebarLogo } = storeToRefs(settingsStore) +const { layoutMode, showLogo } = storeToRefs(settingsStore) const activeMenu = computed(() => { const { @@ -29,11 +29,12 @@ const activeMenu = computed(() => { }) const isCollapse = computed(() => !appStore.sidebar.opened) +const isLogo = computed(() => layoutMode.value === "left" && showLogo.value)