2022-04-21 18:20:39 +08:00
|
|
|
<script lang="ts" setup>
|
2022-08-22 16:57:55 +08:00
|
|
|
import { computed } from "vue"
|
2023-05-21 10:47:42 +08:00
|
|
|
import { useAppStore, DeviceEnum } from "@/store/modules/app"
|
2022-04-22 01:16:02 +08:00
|
|
|
import { useSettingsStore } from "@/store/modules/settings"
|
|
|
|
import { AppMain, NavigationBar, Settings, Sidebar, TagsView, RightPanel } from "./components"
|
2022-08-22 16:57:55 +08:00
|
|
|
import useResize from "./hooks/useResize"
|
2022-04-21 18:20:39 +08:00
|
|
|
|
|
|
|
const appStore = useAppStore()
|
|
|
|
const settingsStore = useSettingsStore()
|
|
|
|
|
2022-08-22 16:57:55 +08:00
|
|
|
/** Layout 布局响应式 */
|
|
|
|
useResize()
|
|
|
|
|
2022-04-21 18:20:39 +08:00
|
|
|
const classObj = computed(() => {
|
|
|
|
return {
|
2022-08-22 16:57:55 +08:00
|
|
|
hideSidebar: !appStore.sidebar.opened,
|
|
|
|
openSidebar: appStore.sidebar.opened,
|
|
|
|
withoutAnimation: appStore.sidebar.withoutAnimation,
|
2023-05-21 10:47:42 +08:00
|
|
|
mobile: appStore.device === DeviceEnum.Mobile,
|
2022-12-08 18:06:01 +08:00
|
|
|
showGreyMode: showGreyMode.value,
|
|
|
|
showColorWeakness: showColorWeakness.value
|
2022-04-21 18:20:39 +08:00
|
|
|
}
|
|
|
|
})
|
2022-12-08 18:06:01 +08:00
|
|
|
|
2022-04-21 18:20:39 +08:00
|
|
|
const showSettings = computed(() => {
|
|
|
|
return settingsStore.showSettings
|
|
|
|
})
|
|
|
|
const showTagsView = computed(() => {
|
|
|
|
return settingsStore.showTagsView
|
|
|
|
})
|
|
|
|
const fixedHeader = computed(() => {
|
|
|
|
return settingsStore.fixedHeader
|
|
|
|
})
|
2022-12-08 18:06:01 +08:00
|
|
|
const showGreyMode = computed(() => {
|
|
|
|
return settingsStore.showGreyMode
|
|
|
|
})
|
|
|
|
const showColorWeakness = computed(() => {
|
|
|
|
return settingsStore.showColorWeakness
|
|
|
|
})
|
2022-08-22 16:57:55 +08:00
|
|
|
const handleClickOutside = () => {
|
|
|
|
appStore.closeSidebar(false)
|
|
|
|
}
|
2022-04-21 18:20:39 +08:00
|
|
|
</script>
|
|
|
|
|
2022-04-22 12:47:04 +08:00
|
|
|
<template>
|
|
|
|
<div :class="classObj" class="app-wrapper">
|
2022-08-22 16:57:55 +08:00
|
|
|
<div v-if="classObj.mobile && classObj.openSidebar" class="drawer-bg" @click="handleClickOutside" />
|
2022-04-22 12:47:04 +08:00
|
|
|
<Sidebar class="sidebar-container" />
|
|
|
|
<div :class="{ hasTagsView: showTagsView }" class="main-container">
|
|
|
|
<div :class="{ 'fixed-header': fixedHeader }">
|
|
|
|
<NavigationBar />
|
2023-03-30 09:13:00 +08:00
|
|
|
<TagsView v-show="showTagsView" />
|
2022-04-22 12:47:04 +08:00
|
|
|
</div>
|
|
|
|
<AppMain />
|
|
|
|
<RightPanel v-if="showSettings">
|
|
|
|
<Settings />
|
|
|
|
</RightPanel>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
2022-04-21 18:20:39 +08:00
|
|
|
<style lang="scss" scoped>
|
2022-04-22 01:16:02 +08:00
|
|
|
@import "@/styles/mixins.scss";
|
2022-04-21 18:20:39 +08:00
|
|
|
|
|
|
|
.app-wrapper {
|
|
|
|
@include clearfix;
|
|
|
|
position: relative;
|
|
|
|
width: 100%;
|
|
|
|
}
|
|
|
|
|
2022-12-08 18:06:01 +08:00
|
|
|
.showGreyMode {
|
|
|
|
filter: grayscale(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
.showColorWeakness {
|
|
|
|
filter: invert(0.8);
|
|
|
|
}
|
|
|
|
|
2022-04-21 18:20:39 +08:00
|
|
|
.drawer-bg {
|
2022-05-25 21:53:38 +08:00
|
|
|
background-color: #000;
|
2022-04-21 18:20:39 +08:00
|
|
|
opacity: 0.3;
|
|
|
|
width: 100%;
|
|
|
|
top: 0;
|
|
|
|
height: 100%;
|
|
|
|
position: absolute;
|
|
|
|
z-index: 999;
|
|
|
|
}
|
|
|
|
|
|
|
|
.main-container {
|
|
|
|
min-height: 100%;
|
|
|
|
transition: margin-left 0.28s;
|
2022-05-25 21:53:38 +08:00
|
|
|
margin-left: var(--v3-sidebar-width);
|
2022-04-21 18:20:39 +08:00
|
|
|
position: relative;
|
|
|
|
}
|
|
|
|
|
|
|
|
.sidebar-container {
|
|
|
|
transition: width 0.28s;
|
2022-05-25 21:53:38 +08:00
|
|
|
width: var(--v3-sidebar-width) !important;
|
2022-04-21 18:20:39 +08:00
|
|
|
height: 100%;
|
|
|
|
position: fixed;
|
2022-08-22 17:14:58 +08:00
|
|
|
font-size: 0px;
|
2022-04-21 18:20:39 +08:00
|
|
|
top: 0;
|
|
|
|
bottom: 0;
|
|
|
|
left: 0;
|
|
|
|
z-index: 1001;
|
|
|
|
overflow: hidden;
|
|
|
|
}
|
|
|
|
|
|
|
|
.fixed-header {
|
|
|
|
position: fixed;
|
|
|
|
top: 0;
|
|
|
|
right: 0;
|
|
|
|
z-index: 9;
|
2022-05-25 21:53:38 +08:00
|
|
|
width: calc(100% - var(--v3-sidebar-width));
|
2022-04-21 18:20:39 +08:00
|
|
|
transition: width 0.28s;
|
|
|
|
}
|
|
|
|
|
|
|
|
.hideSidebar {
|
|
|
|
.main-container {
|
2022-05-25 21:53:38 +08:00
|
|
|
margin-left: var(--v3-sidebar-hide-width);
|
2022-04-21 18:20:39 +08:00
|
|
|
}
|
|
|
|
.sidebar-container {
|
2022-05-25 21:53:38 +08:00
|
|
|
width: var(--v3-sidebar-hide-width) !important;
|
2022-04-21 18:20:39 +08:00
|
|
|
}
|
|
|
|
.fixed-header {
|
2022-05-25 21:53:38 +08:00
|
|
|
width: calc(100% - var(--v3-sidebar-hide-width));
|
2022-04-21 18:20:39 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// for mobile response 适配移动端
|
|
|
|
.mobile {
|
|
|
|
.main-container {
|
2022-08-22 17:14:58 +08:00
|
|
|
margin-left: 0px;
|
2022-04-21 18:20:39 +08:00
|
|
|
}
|
|
|
|
.sidebar-container {
|
|
|
|
transition: transform 0.28s;
|
2022-05-25 21:53:38 +08:00
|
|
|
width: var(--v3-sidebar-width) !important;
|
2022-04-21 18:20:39 +08:00
|
|
|
}
|
|
|
|
&.openSidebar {
|
|
|
|
position: fixed;
|
|
|
|
top: 0;
|
|
|
|
}
|
|
|
|
&.hideSidebar {
|
|
|
|
.sidebar-container {
|
|
|
|
pointer-events: none;
|
|
|
|
transition-duration: 0.3s;
|
2022-05-25 21:53:38 +08:00
|
|
|
transform: translate3d(calc(0px - var(--v3-sidebar-width)), 0, 0);
|
2022-04-21 18:20:39 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
.fixed-header {
|
|
|
|
width: 100%;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
.withoutAnimation {
|
|
|
|
.main-container,
|
|
|
|
.sidebar-container {
|
|
|
|
transition: none;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|