180 lines
4.2 KiB
Vue
180 lines
4.2 KiB
Vue
<template>
|
|
<div :class="classObj" class="app-wrapper">
|
|
<div v-if="(device === 'mobile' || layoutMode === 'top-bottom') && sidebar.opened" class="drawer-bg"
|
|
@click="handleClickOutside" />
|
|
|
|
<sidebar v-if="layoutMode !== 'top-bottom'" class="sidebar-container" />
|
|
|
|
<div class="main-container" :class="{ 'no-sidebar': layoutMode === 'top-bottom' }">
|
|
<div :class="{ 'fixed-header': fixedHeader, 'fixed-header-top': layoutMode === 'top-bottom' }" :style="{ height: shortcutExpanded ? '134px' : '97px' }">
|
|
<task-view />
|
|
</div>
|
|
<div v-if="fixedHeader" :style="{ height: shortcutExpanded ? '134px' : '97px' }"></div>
|
|
<div class="main-box">
|
|
<app-main />
|
|
<transition name="ai-slide">
|
|
<div class="ai-container" v-show="aiStore.isVisible" :style="{ top: shortcutExpanded ? '134px' : '97px', height: `calc(100vh - ${shortcutExpanded ? 134 : 97}px)` }">
|
|
<ai-chat />
|
|
</div>
|
|
</transition>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
import { computed, watch, onBeforeMount, onMounted, onBeforeUnmount } from 'vue'
|
|
import { useAppStore } from '@/stores/modules/app'
|
|
import { useSettingsStore } from '@/stores/modules/settings'
|
|
import { useAiStore } from '@/stores/modules/ai'
|
|
import Sidebar from './component/Sidebar/index.vue'
|
|
import TaskView from './component/TaskView/index.vue'
|
|
import AppMain from './component/AppMain.vue'
|
|
import AiChat from './component/AiChat/index.vue'
|
|
import { useWindowSize } from '@vueuse/core'
|
|
|
|
const { width } = useWindowSize()
|
|
const WIDTH = 992 // refer to Bootstrap's responsive design
|
|
|
|
const appStore = useAppStore()
|
|
const settingsStore = useSettingsStore()
|
|
const aiStore = useAiStore()
|
|
|
|
const sidebar = computed(() => appStore.sidebar)
|
|
const device = computed(() => appStore.device)
|
|
const fixedHeader = computed(() => settingsStore.fixedHeader)
|
|
const layoutMode = computed(() => settingsStore.layoutMode)
|
|
const shortcutExpanded = computed(() => settingsStore.shortcutExpanded)
|
|
|
|
const classObj = computed(() => {
|
|
return {
|
|
hideSidebar: !sidebar.value.opened,
|
|
openSidebar: sidebar.value.opened,
|
|
withoutAnimation: sidebar.value.withoutAnimation,
|
|
mobile: device.value === 'mobile',
|
|
'layout-top-bottom': layoutMode.value === 'top-bottom'
|
|
}
|
|
})
|
|
|
|
watch(width, (val) => {
|
|
if (val - 1 < WIDTH) {
|
|
appStore.toggleDevice('mobile')
|
|
appStore.closeSideBar(true)
|
|
} else {
|
|
appStore.toggleDevice('desktop')
|
|
}
|
|
}, { immediate: true })
|
|
|
|
const handleClickOutside = () => {
|
|
appStore.closeSideBar(false)
|
|
}
|
|
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
@use "@/styles/mixin.scss" as *;
|
|
@use "@/styles/variables.scss" as *;
|
|
|
|
.app-main {
|
|
padding: 0 !important;
|
|
display: flex;
|
|
}
|
|
|
|
.app-wrapper {
|
|
@include clearfix;
|
|
position: relative;
|
|
height: 100%;
|
|
width: 100%;
|
|
|
|
&.mobile.openSidebar {
|
|
position: fixed;
|
|
top: 0;
|
|
}
|
|
}
|
|
|
|
.drawer-bg {
|
|
background: #000;
|
|
opacity: 0.3;
|
|
width: 100%;
|
|
top: 0;
|
|
height: 100%;
|
|
position: absolute;
|
|
z-index: 999;
|
|
}
|
|
|
|
|
|
|
|
.fixed-header {
|
|
position: fixed;
|
|
top: 0;
|
|
right: 0;
|
|
z-index: 9;
|
|
width: calc(100% - #{$sideBarWidth});
|
|
transition: width 0.28s;
|
|
min-height: 97px;
|
|
max-height: 134px;
|
|
|
|
&.fixed-header-top {
|
|
width: 100% !important;
|
|
top: 0; // Menu is now inside Navbar
|
|
}
|
|
}
|
|
|
|
.hideSidebar .fixed-header {
|
|
width: calc(100% - #{$sideBarCollapsedWidth})
|
|
}
|
|
|
|
.hideSidebar .fixed-header-top {
|
|
width: 100% !important;
|
|
}
|
|
|
|
.mobile .fixed-header {
|
|
width: 100%;
|
|
}
|
|
|
|
.main-container {
|
|
min-height: 100%;
|
|
transition: margin-left 0.28s;
|
|
margin-left: #{$sideBarWidth};
|
|
position: relative;
|
|
|
|
&.no-sidebar {
|
|
margin-left: 0 !important;
|
|
}
|
|
}
|
|
|
|
.main-box {
|
|
display: flex;
|
|
flex-direction: row;
|
|
width: 100%;
|
|
|
|
:deep(.app-main) {
|
|
flex: 1;
|
|
min-width: 0;
|
|
}
|
|
|
|
.ai-container {
|
|
width: 600px;
|
|
height: auto;
|
|
flex-shrink: 0;
|
|
background-color: #fff;
|
|
// border-left: 1px solid #e6e6e6;
|
|
overflow: hidden;
|
|
box-shadow: -2px 0 8px rgba(0,0,0,0.15);
|
|
position: sticky;
|
|
z-index: 10;
|
|
}
|
|
}
|
|
|
|
.ai-slide-enter-active,
|
|
.ai-slide-leave-active {
|
|
transition: width 0.3s ease-in-out, opacity 0.3s ease-in-out;
|
|
}
|
|
|
|
.ai-slide-enter-from,
|
|
.ai-slide-leave-to {
|
|
width: 0;
|
|
opacity: 0;
|
|
}
|
|
</style>
|