2025-07-23 17:02:24 +08:00
|
|
|
<script setup>
|
2025-06-16 14:42:26 +08:00
|
|
|
import { useAppStore } from '@/stores';
|
|
|
|
|
import { useResponsive } from '@/hooks';
|
2025-06-20 18:16:40 +08:00
|
|
|
import JoinModal from '@/components/join-modal.vue';
|
|
|
|
|
import { getQueryParam } from '@/utils/helper';
|
2025-07-23 17:02:24 +08:00
|
|
|
import { useUserStore } from '@/stores';
|
|
|
|
|
|
2025-06-22 22:52:03 -04:00
|
|
|
import { ref, onMounted, computed } from 'vue';
|
|
|
|
|
import { useRoute } from 'vue-router';
|
2025-06-16 14:42:26 +08:00
|
|
|
|
2025-06-20 18:16:40 +08:00
|
|
|
const joinEnterpriseVisible = ref(false);
|
2025-07-23 17:02:24 +08:00
|
|
|
const joinModalRef = ref(null);
|
2025-06-16 14:42:26 +08:00
|
|
|
const appStore = useAppStore();
|
2025-07-23 17:02:24 +08:00
|
|
|
const userStore = useUserStore();
|
2025-06-16 14:42:26 +08:00
|
|
|
const router = useRouter();
|
2025-06-22 22:52:03 -04:00
|
|
|
const route = useRoute();
|
2025-06-16 14:42:26 +08:00
|
|
|
|
|
|
|
|
useResponsive(true);
|
2025-07-01 16:00:35 +08:00
|
|
|
const navbarHeight = `72px`;
|
2025-06-16 14:42:26 +08:00
|
|
|
const navbar = computed(() => appStore.navbar);
|
|
|
|
|
const renderMenu = computed(() => appStore.menu && !appStore.topMenu);
|
|
|
|
|
const hideMenu = computed(() => appStore.hideMenu);
|
|
|
|
|
|
|
|
|
|
const menuWidth = computed(() => {
|
|
|
|
|
return appStore.menuCollapse ? 48 : appStore.menuWidth;
|
|
|
|
|
});
|
|
|
|
|
const collapsed = computed(() => {
|
|
|
|
|
return appStore.menuCollapse;
|
|
|
|
|
});
|
2025-06-30 18:37:27 +08:00
|
|
|
const showSidebar = computed(() => {
|
|
|
|
|
return !(route.meta && route.meta.hideSidebar);
|
|
|
|
|
});
|
2025-06-16 14:42:26 +08:00
|
|
|
const paddingStyle = computed(() => {
|
2025-06-30 18:37:27 +08:00
|
|
|
const paddingLeft =
|
|
|
|
|
showSidebar.value && renderMenu.value && !hideMenu.value ? { paddingLeft: `${menuWidth.value}px` } : {};
|
2025-06-16 14:42:26 +08:00
|
|
|
const paddingTop = navbar.value ? { paddingTop: navbarHeight } : {};
|
|
|
|
|
return { ...paddingLeft, ...paddingTop };
|
|
|
|
|
});
|
2025-06-30 18:37:27 +08:00
|
|
|
|
2025-06-20 18:16:40 +08:00
|
|
|
onMounted(() => {
|
|
|
|
|
checkHasInviteCode();
|
|
|
|
|
});
|
2025-07-23 17:02:24 +08:00
|
|
|
const setCollapsed = (val) => {
|
2025-06-16 14:42:26 +08:00
|
|
|
appStore.updateSettings({ menuCollapse: val });
|
|
|
|
|
};
|
|
|
|
|
|
2025-06-20 18:16:40 +08:00
|
|
|
const checkHasInviteCode = () => {
|
|
|
|
|
const inviteCode = getQueryParam('invite_code');
|
2025-07-23 17:02:24 +08:00
|
|
|
if (userStore.isLogin && inviteCode) {
|
2025-06-20 18:16:40 +08:00
|
|
|
joinEnterpriseVisible.value = true;
|
2025-07-23 17:02:24 +08:00
|
|
|
joinModalRef.value?.getEnterprise?.();
|
2025-06-20 18:16:40 +08:00
|
|
|
}
|
|
|
|
|
};
|
2025-06-16 14:42:26 +08:00
|
|
|
const drawerVisible = ref(false);
|
|
|
|
|
const drawerCancel = () => {
|
|
|
|
|
drawerVisible.value = false;
|
|
|
|
|
};
|
|
|
|
|
provide('toggleDrawerMenu', () => {
|
|
|
|
|
drawerVisible.value = !drawerVisible.value;
|
|
|
|
|
});
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<template>
|
|
|
|
|
<a-layout :class="['layout', { mobile: appStore.hideMenu }]">
|
2025-07-23 17:02:24 +08:00
|
|
|
<JoinModal v-model:visible="joinEnterpriseVisible" ref="joinModalRef" />
|
2025-06-16 14:42:26 +08:00
|
|
|
<div v-if="navbar" class="layout-navbar">
|
|
|
|
|
<base-navbar />
|
|
|
|
|
</div>
|
|
|
|
|
<a-layout>
|
|
|
|
|
<a-layout>
|
|
|
|
|
<a-layout-sider
|
2025-06-22 22:52:03 -04:00
|
|
|
v-if="renderMenu && showSidebar"
|
2025-06-16 14:42:26 +08:00
|
|
|
v-show="!hideMenu"
|
|
|
|
|
class="layout-sider"
|
|
|
|
|
breakpoint="xl"
|
|
|
|
|
:collapsed="collapsed"
|
|
|
|
|
:width="menuWidth"
|
2025-07-01 16:00:35 +08:00
|
|
|
:style="{ paddingTop: navbar ? '72px' : '' }"
|
2025-06-16 14:42:26 +08:00
|
|
|
collapsible
|
|
|
|
|
hide-trigger
|
|
|
|
|
@collapse="setCollapsed"
|
|
|
|
|
>
|
|
|
|
|
<div class="menu-wrapper">
|
|
|
|
|
<base-menu />
|
|
|
|
|
</div>
|
|
|
|
|
</a-layout-sider>
|
|
|
|
|
<a-drawer
|
|
|
|
|
v-if="hideMenu"
|
|
|
|
|
:visible="drawerVisible"
|
|
|
|
|
placement="left"
|
|
|
|
|
:footer="false"
|
|
|
|
|
mask-closable
|
|
|
|
|
:closable="false"
|
|
|
|
|
@cancel="drawerCancel"
|
|
|
|
|
>
|
|
|
|
|
<base-menu />
|
|
|
|
|
</a-drawer>
|
|
|
|
|
<a-layout class="layout-content" :style="paddingStyle">
|
|
|
|
|
<base-tab-bar v-if="appStore.tabBar" />
|
2025-06-25 18:26:03 +08:00
|
|
|
<a-layout-content class="px-5 py-5">
|
2025-06-16 14:42:26 +08:00
|
|
|
<base-breadcrumb />
|
|
|
|
|
<layout-page />
|
|
|
|
|
</a-layout-content>
|
|
|
|
|
</a-layout>
|
|
|
|
|
</a-layout>
|
|
|
|
|
</a-layout>
|
|
|
|
|
</a-layout>
|
|
|
|
|
</template>
|
|
|
|
|
|
2025-07-11 16:50:48 +08:00
|
|
|
<style scoped lang="scss">
|
|
|
|
|
$nav-size-height: 72px;
|
|
|
|
|
$layout-max-width: 1100px;
|
2025-06-16 14:42:26 +08:00
|
|
|
|
|
|
|
|
.layout {
|
|
|
|
|
width: 100%;
|
|
|
|
|
height: 100%;
|
|
|
|
|
}
|
|
|
|
|
.layout-navbar {
|
|
|
|
|
position: fixed;
|
|
|
|
|
top: 0;
|
|
|
|
|
left: 0;
|
|
|
|
|
z-index: 100;
|
|
|
|
|
width: 100%;
|
2025-07-11 16:50:48 +08:00
|
|
|
height: $nav-size-height;
|
2025-06-16 14:42:26 +08:00
|
|
|
}
|
|
|
|
|
.layout-sider {
|
|
|
|
|
position: fixed;
|
|
|
|
|
top: 0;
|
|
|
|
|
left: 0;
|
|
|
|
|
z-index: 99;
|
|
|
|
|
height: 100%;
|
|
|
|
|
transition: all 0.2s cubic-bezier(0.34, 0.69, 0.1, 1);
|
|
|
|
|
|
|
|
|
|
&::after {
|
|
|
|
|
position: absolute;
|
|
|
|
|
top: 0;
|
|
|
|
|
right: -1px;
|
|
|
|
|
display: block;
|
|
|
|
|
width: 1px;
|
|
|
|
|
height: 100%;
|
|
|
|
|
background-color: var(--color-border);
|
|
|
|
|
content: '';
|
|
|
|
|
}
|
|
|
|
|
> :deep(.arco-layout-sider-children) {
|
|
|
|
|
overflow-y: hidden;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
.menu-wrapper {
|
|
|
|
|
height: 100%;
|
|
|
|
|
overflow: auto;
|
|
|
|
|
overflow-x: hidden;
|
|
|
|
|
|
|
|
|
|
:deep(.arco-menu) {
|
|
|
|
|
::-webkit-scrollbar {
|
|
|
|
|
width: 12px;
|
|
|
|
|
height: 4px;
|
|
|
|
|
}
|
|
|
|
|
::-webkit-scrollbar-thumb {
|
|
|
|
|
border: 4px solid transparent;
|
|
|
|
|
background-clip: padding-box;
|
|
|
|
|
border-radius: 7px;
|
|
|
|
|
background-color: var(--color-text-4);
|
|
|
|
|
}
|
|
|
|
|
::-webkit-scrollbar-thumb:hover {
|
|
|
|
|
background-color: var(--color-text-3);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
.layout-content {
|
|
|
|
|
min-width: 1366px;
|
|
|
|
|
min-height: 100vh;
|
|
|
|
|
overflow-y: hidden;
|
|
|
|
|
background-color: var(--color-fill-2);
|
|
|
|
|
transition: padding 0.2s cubic-bezier(0.34, 0.69, 0.1, 1);
|
|
|
|
|
}
|
|
|
|
|
</style>
|