front/src/layout/default-layout.vue
zzh 188675e9bf
All checks were successful
Build and Deploy Front / deploy (push) Successful in 10m35s
refine: 管理端顶栏透明坞与右侧工具条收束
统一菜单坞、页签字号与右侧分组触控态,去掉用户名展示并优化仓库入口,避免再加第二坞。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-11-25 11:21:51 +08:00

152 lines
4.3 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<a-layout class="layout">
<!-- 运营端顶栏;客户/代理门户无顶栏(能力沉底侧栏) -->
<TopNav v-if="!isPortalShell" />
<!-- 客户/代理门户:全高侧栏 + 主区(无多页签,当前页由侧栏高亮) -->
<a-layout
v-if="isPortalShell"
class="layout-content layout-content--customer"
>
<CustomerSideRail v-if="isCustomerShell" />
<AgentSideRail v-else-if="isAgentShell" />
<a-layout class="layout-main-wrap">
<a-layout-content class="layout-main">
<PageLayout />
</a-layout-content>
<Footer v-if="footer" />
</a-layout>
</a-layout>
<!-- 运营端:与改前一致 -->
<a-layout v-else :style="adminContentStyle" class="layout-content">
<a-layout-content>
<PageLayout />
</a-layout-content>
<Footer v-if="footer" />
</a-layout>
<EdiAssistant />
<PortalSideDrawer v-if="isCustomerShell" />
<HelpSideDrawer v-if="!isAgentShell" />
</a-layout>
</template>
<script lang="ts" setup>
import { computed, defineAsyncComponent, onMounted } from 'vue';
import { useRoute } from 'vue-router';
import { useAppStore } from '@/store';
import { useRbacUserStore } from '@/store/modules/rbac-user';
import TopNav from '@/components/top-nav/index.vue';
import CustomerSideRail from '@/components/customer-side-rail/index.vue';
import AgentSideRail from '@/components/agent-side-rail/index.vue';
import usePermission from '@/hooks/permission';
import useResponsive from '@/hooks/responsive';
import PageLayout from './page-layout.vue';
import { setRapidPackageHostCookie } from '@/utils/rapidPackagePluginHost';
const Footer = defineAsyncComponent(() => import('@/components/footer/index.vue'));
const EdiAssistant = defineAsyncComponent(
() => import('@/components/EdiAssistant/index.vue'),
);
const PortalSideDrawer = defineAsyncComponent(
() => import('@/views/user/portal-drawer/PortalSideDrawer.vue'),
);
const HelpSideDrawer = defineAsyncComponent(
() => import('@/views/help/HelpSideDrawer/index.vue'),
);
const appStore = useAppStore();
const rbacUserStore = useRbacUserStore();
const route = useRoute();
const permission = usePermission();
useResponsive(true);
onMounted(() => {
setRapidPackageHostCookie();
});
const footer = computed(() => appStore.footer && !route.path.startsWith('/assistant'));
const isCustomerShell = computed(
() => rbacUserStore.isCustomerPortal() && rbacUserStore.isLoggedIn,
);
const isAgentShell = computed(
() => rbacUserStore.isAgentPortal() && rbacUserStore.isLoggedIn,
);
const isPortalShell = computed(() => isCustomerShell.value || isAgentShell.value);
// 仅运营端需要为 fixed 顶栏留白
const adminContentStyle = computed(() => {
// 与 top-nav:上边距 6 + 栏高 52(+ 页签 28)对齐
const headerHeight = 58;
const tabNavHeight = appStore.tabBar ? 28 : 0;
return { paddingTop: `${headerHeight + tabNavHeight}px` };
});
</script>
<style lang="less" scoped>
[class$='-container'] {
padding: var(--app-page-padding, 8px 16px 16px);
width: 100%;
height: 100%;
box-sizing: border-box;
min-height: 0;
max-width: 100%;
}
.layout {
width: 100%;
height: 100vh;
display: flex;
flex-direction: column;
background: transparent;
}
/* 运营端:与改前一致 */
.layout-content {
flex: 1;
overflow: hidden;
background-color: transparent;
transition: padding 0.2s cubic-bezier(0.34, 0.69, 0.1, 1);
margin-top: 0;
display: flex;
flex-direction: column;
:deep(.arco-layout-content) {
flex: 1;
overflow: hidden;
height: 100%;
}
}
/* 客户门户:无顶栏;侧栏与右侧内容卡片同 inset / 圆角 */
.layout-content--customer {
flex-direction: row;
align-items: stretch;
min-height: 0;
padding-top: 0;
gap: 0;
.layout-main-wrap {
flex: 1;
min-width: 0;
min-height: 0;
display: flex;
flex-direction: column;
overflow: hidden;
}
:deep(.arco-layout-content.layout-main),
.layout-main {
flex: 1;
overflow: hidden;
height: 100%;
min-width: 0;
min-height: 0;
display: flex;
flex-direction: column;
}
}
</style>