front/src/layout/default-layout.vue
zzh ba565f7384
All checks were successful
Build and Deploy Front / deploy (push) Successful in 3m27s
feat: 工作台美区 ZIP3 与官网/登录体验收敛
补齐客户工作台地图 ZIP3/港口数据与 keep-alive 重挂,并轻量化官网导航弹层与可拖意图 IP,登录页改为居中舞台。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-12-03 15:10:05 +08:00

217 lines
6.7 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(工具在页签行右侧) -->
<TopNav v-if="!isPortalShell" />
<!-- 客户/代理门户:全高侧栏 + 主区(页签与运营端同一套 TabBar) -->
<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">
<div
v-if="portalTabBarEnable || isCustomerShell"
class="portal-tab-nav"
:class="{ 'portal-tab-nav--tools-only': !portalTabBarEnable }"
>
<TabBar v-if="portalTabBarEnable" />
<CustomerPortalTopTools v-if="isCustomerShell" />
</div>
<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 CustomerPortalTopTools from '@/components/customer-side-rail/CustomerPortalTopTools.vue';
import AgentSideRail from '@/components/agent-side-rail/index.vue';
import TabBar from '@/components/tab-bar/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);
/** 与运营端同一开关:settings.tabBar */
const portalTabBarEnable = computed(() => !!appStore.tabBar);
// 仅运营端需要为 fixed 顶栏留白
const adminContentStyle = computed(() => {
// 与 top-nav:上边距 4 + 栏高 48(+ 页签 28)对齐
const headerHeight = 52;
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: var(--app-page-bg, #f0f3f4);
}
/* 运营端:整页壳跟页面背景走(含顶栏下方主区) */
.layout-content {
flex: 1;
overflow: hidden;
background-color: var(--app-page-bg, #f0f3f4);
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%;
background-color: var(--app-page-bg, #f0f3f4);
}
}
/* 客户/代理门户:无顶栏;侧栏与主区同 inset,中间留间隙,页面根勿再叠一层 padding */
.layout-content--customer {
/* 与 customer-side-rail --csr-panel-inset / agent --asr-panel-inset 对齐 */
--portal-panel-inset: 16px;
--app-page-padding: 0;
--app-page-padding-list: 0;
--app-page-padding-top: 0;
flex-direction: row;
align-items: stretch;
min-height: 0;
padding-top: 0;
/* 侧栏面板与主区之间的空隙(原先左右 margin 都是 0 会贴死) */
gap: var(--portal-panel-inset);
.layout-main-wrap {
flex: 1;
min-width: 0;
min-height: 0;
/* 顶/底/右与侧栏外缘齐平;左侧间距交给 gap */
margin: var(--portal-panel-inset) var(--portal-panel-inset) var(--portal-panel-inset) 0;
display: flex;
flex-direction: column;
overflow: hidden;
}
/* 页签占左侧弹性区,工具靠右,互不抢满宽 */
.portal-tab-nav {
flex-shrink: 0;
height: 36px;
display: flex;
align-items: center;
gap: 12px;
background: transparent;
border-bottom: 1px dashed rgba(26, 46, 56, 0.14);
box-sizing: border-box;
padding-right: 12px;
/* 虚线分割与下方页面内容留白(原先贴死到工作台卡片) */
margin-bottom: var(--portal-panel-inset);
:deep(.tab-bar) {
flex: 1 1 auto;
min-width: 0;
padding-left: 16px;
padding-right: 4px;
}
:deep(.tab-bar.is-overflow-left::before) {
left: 16px;
}
:deep(.tab-bar.is-overflow-right::after) {
right: 40px;
}
&--tools-only {
justify-content: flex-end;
}
}
: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;
}
/*
* 主区已与侧栏同高 inset;页面根再 padding 会矮一截且像多套灰底。
* 列表白卡片内部留白放在 *-page-card / 内容面板上。
*/
:deep(.page-layout-root > [class*='-container']),
:deep(.page-layout-root > [class*='-page']),
:deep(.page-layout-root > [class*='-layout']) {
padding: 0 !important;
}
}
</style>