2025-06-17 22:37:37 +08:00
|
|
|
|
<!-- 纵向布局作为基础布局 -->
|
|
|
|
|
|
<script setup lang="ts">
|
2025-11-16 22:39:42 +08:00
|
|
|
|
import SystemAnnouncementDialog from '@/components/SystemAnnouncementDialog/index.vue';
|
2025-06-17 22:37:37 +08:00
|
|
|
|
import { useSafeArea } from '@/hooks/useSafeArea';
|
|
|
|
|
|
import { useWindowWidthObserver } from '@/hooks/useWindowWidthObserver';
|
|
|
|
|
|
import Aside from '@/layouts/components/Aside/index.vue';
|
|
|
|
|
|
import Header from '@/layouts/components/Header/index.vue';
|
|
|
|
|
|
import Main from '@/layouts/components/Main/index.vue';
|
2025-11-16 22:39:42 +08:00
|
|
|
|
import { useAnnouncementStore, useDesignStore } from '@/stores';
|
2025-06-17 22:37:37 +08:00
|
|
|
|
|
|
|
|
|
|
const designStore = useDesignStore();
|
2025-11-16 22:39:42 +08:00
|
|
|
|
const announcementStore = useAnnouncementStore();
|
2025-06-17 22:37:37 +08:00
|
|
|
|
|
|
|
|
|
|
const isCollapse = computed(() => designStore.isCollapse);
|
|
|
|
|
|
|
|
|
|
|
|
/* 是否移入了安全区 */
|
|
|
|
|
|
useSafeArea({
|
|
|
|
|
|
direction: 'left',
|
|
|
|
|
|
size: 50,
|
|
|
|
|
|
onChange(isInSafeArea) {
|
|
|
|
|
|
// 设置悬停为 true
|
|
|
|
|
|
designStore.isSafeAreaHover = isInSafeArea;
|
|
|
|
|
|
},
|
|
|
|
|
|
enabled: isCollapse, // 折叠才开启监听
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
/** 监听窗口大小变化,折叠侧边栏 */
|
|
|
|
|
|
useWindowWidthObserver();
|
2025-11-16 22:39:42 +08:00
|
|
|
|
|
|
|
|
|
|
// 应用加载时检查是否需要显示公告弹窗
|
2025-11-17 01:20:20 +08:00
|
|
|
|
onMounted(() => {
|
2025-11-16 22:39:42 +08:00
|
|
|
|
console.log('announcementStore.shouldShowDialog--', announcementStore.shouldShowDialog);
|
|
|
|
|
|
// 检查是否应该显示弹窗(只有"关闭一周"且未超过7天才不显示)
|
2025-11-17 01:20:20 +08:00
|
|
|
|
// 数据获取已移至 SystemAnnouncementDialog 组件内部,每次打开弹窗时都会获取最新数据
|
2025-11-16 22:39:42 +08:00
|
|
|
|
if (announcementStore.shouldShowDialog) {
|
|
|
|
|
|
announcementStore.openDialog();
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
2025-06-17 22:37:37 +08:00
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<template>
|
|
|
|
|
|
<el-container class="layout-container">
|
|
|
|
|
|
<el-header class="layout-header">
|
|
|
|
|
|
<Header />
|
|
|
|
|
|
</el-header>
|
|
|
|
|
|
<el-container class="layout-container-main">
|
|
|
|
|
|
<Aside />
|
|
|
|
|
|
<el-main class="layout-main">
|
|
|
|
|
|
<!-- 路由页面 -->
|
|
|
|
|
|
<Main />
|
|
|
|
|
|
</el-main>
|
|
|
|
|
|
</el-container>
|
|
|
|
|
|
</el-container>
|
2025-11-16 22:39:42 +08:00
|
|
|
|
<!-- 系统公告弹窗 -->
|
|
|
|
|
|
<SystemAnnouncementDialog />
|
2025-06-17 22:37:37 +08:00
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
|
|
.layout-container {
|
|
|
|
|
|
position: relative;
|
|
|
|
|
|
width: 100%;
|
|
|
|
|
|
height: 100vh;
|
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
|
.layout-header {
|
|
|
|
|
|
padding: 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
.layout-main {
|
|
|
|
|
|
height: 100%;
|
|
|
|
|
|
padding: 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
.layout-container-main {
|
|
|
|
|
|
margin-left: var(--sidebar-left-container-default-width, 0);
|
|
|
|
|
|
transition: margin-left 0.3s ease;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/** 去除菜单右侧边框 */
|
|
|
|
|
|
.el-menu {
|
|
|
|
|
|
border-right: none;
|
|
|
|
|
|
}
|
|
|
|
|
|
.layout-scrollbar {
|
|
|
|
|
|
width: 100%;
|
|
|
|
|
|
}
|
|
|
|
|
|
</style>
|