优化
This commit is contained in:
@@ -22,7 +22,10 @@ const groupId = computed(() => `client-nav-group-${props.node.key}`)
|
|||||||
<li
|
<li
|
||||||
class="client-nav-node"
|
class="client-nav-node"
|
||||||
v-if="node.children"
|
v-if="node.children"
|
||||||
:class="{ 'is-active-parent': activeParentKeys.has(node.key) }"
|
:class="{
|
||||||
|
'has-divider-before': node.dividerBefore,
|
||||||
|
'is-active-parent': activeParentKeys.has(node.key),
|
||||||
|
}"
|
||||||
>
|
>
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
@@ -54,7 +57,7 @@ const groupId = computed(() => `client-nav-group-${props.node.key}`)
|
|||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li v-else class="client-nav-node">
|
<li v-else class="client-nav-node" :class="{ 'has-divider-before': node.dividerBefore }">
|
||||||
<RouterLink
|
<RouterLink
|
||||||
:to="node.path"
|
:to="node.path"
|
||||||
class="client-sidebar-link"
|
class="client-sidebar-link"
|
||||||
|
|||||||
@@ -18,9 +18,10 @@ test('source contract: renders the grouped sidebar menu and mobile drawer contro
|
|||||||
assert.match(layoutSource, /<aside\s+ref="sidebarRef"\s+id="client-sidebar"\s+class="client-sidebar"\s+:inert="!desktopViewport && !mobileMenuOpen"\s+:aria-hidden="!desktopViewport && !mobileMenuOpen \? 'true' : undefined"\s*>/)
|
assert.match(layoutSource, /<aside\s+ref="sidebarRef"\s+id="client-sidebar"\s+class="client-sidebar"\s+:inert="!desktopViewport && !mobileMenuOpen"\s+:aria-hidden="!desktopViewport && !mobileMenuOpen \? 'true' : undefined"\s*>/)
|
||||||
assert.doesNotMatch(layoutSource, /<aside[^>]*aria-label=/)
|
assert.doesNotMatch(layoutSource, /<aside[^>]*aria-label=/)
|
||||||
assert.match(layoutSource, /<nav aria-label="客户工作台导航">/)
|
assert.match(layoutSource, /<nav aria-label="客户工作台导航">/)
|
||||||
assert.match(layoutSource, /<div class="client-sidebar-header">\s*<strong>功能导航<\/strong>/s)
|
assert.match(layoutSource, /<div class="client-sidebar-brand">[\s\S]*?<RouterLink class="client-sidebar-brand-link" to="\/" aria-label="返回业务总览" @click="closeMobileMenu">[\s\S]*?柏悦物流[\s\S]*?客户工作台/s)
|
||||||
assert.match(layoutSource, /<button[^>]*ref="sidebarCloseButtonRef"[^>]*aria-label="关闭导航"[^>]*@click="closeMobileMenu"[^>]*>\s*<X :size="20" \/>/s)
|
assert.match(layoutSource, /<button[^>]*ref="sidebarCloseButtonRef"[^>]*aria-label="关闭导航"[^>]*@click="closeMobileMenu"[^>]*>\s*<X :size="20" \/>/s)
|
||||||
assert.match(layoutSource, /<ClientSidebarMenu\s+:active-path="route\.path"\s+@navigate="closeMobileMenu"\s*\/>/s)
|
assert.match(layoutSource, /<ClientSidebarMenu\s+:active-path="route\.path"\s+@navigate="closeMobileMenu"\s*\/>/s)
|
||||||
|
assert.match(layoutSource, /<button type="button" class="client-sidebar-logout" @click="handleLogout">[\s\S]*?退出登录/s)
|
||||||
assert.doesNotMatch(layoutSource, /v-for="item in clientNavigation"/)
|
assert.doesNotMatch(layoutSource, /v-for="item in clientNavigation"/)
|
||||||
assert.doesNotMatch(layoutSource, /from '@\/router'/)
|
assert.doesNotMatch(layoutSource, /from '@\/router'/)
|
||||||
})
|
})
|
||||||
@@ -44,20 +45,22 @@ test('source contract: removes the header and main content from the accessibilit
|
|||||||
assert.match(layoutSource, /<main\s+class="client-main"\s+:inert="mobileMenuOpen"\s+:aria-hidden="mobileMenuOpen \? 'true' : undefined"\s*>/)
|
assert.match(layoutSource, /<main\s+class="client-main"\s+:inert="mobileMenuOpen"\s+:aria-hidden="mobileMenuOpen \? 'true' : undefined"\s*>/)
|
||||||
})
|
})
|
||||||
|
|
||||||
test('source contract: keeps route context and user actions in the compact header without tenant identity', () => {
|
test('source contract: keeps route context and user identity in the compact header', () => {
|
||||||
assert.match(layoutSource, /const pageTitle = computed\(\(\) => route\.meta\.title \|\| '业务总览'\)/)
|
assert.match(layoutSource, /const pageTitle = computed\(\(\) => route\.meta\.title \|\| '业务总览'\)/)
|
||||||
assert.match(layoutSource, /const pageDescription = computed\(\(\) => route\.meta\.description \|\| ''\)/)
|
assert.match(layoutSource, /const pageDescription = computed\(\(\) => route\.meta\.description \|\| ''\)/)
|
||||||
assert.match(layoutSource, /<div class="client-header-heading">\s*<h1>\{\{ pageTitle \}\}<\/h1>\s*<p v-if="pageDescription">\{\{ pageDescription \}\}<\/p>/s)
|
assert.match(layoutSource, /<div class="client-header-heading">\s*<h1>\{\{ pageTitle \}\}<\/h1>\s*<p v-if="pageDescription">\{\{ pageDescription \}\}<\/p>/s)
|
||||||
assert.match(layoutSource, /<div class="client-user">[\s\S]*\{\{ auth\.user\?\.name \}\}[\s\S]*aria-label="退出登录"/)
|
assert.match(layoutSource, /<div class="client-user">[\s\S]*\{\{ auth\.user\?\.name \}\}/)
|
||||||
|
assert.doesNotMatch(layoutSource, /<div class="client-user">[\s\S]*aria-label="退出登录"/)
|
||||||
assert.doesNotMatch(layoutSource, /Building2|tenant-name|tenantName/)
|
assert.doesNotMatch(layoutSource, /Building2|tenant-name|tenantName/)
|
||||||
assert.doesNotMatch(routerSource, /showPageHeading|showTenantName/)
|
assert.doesNotMatch(routerSource, /showPageHeading|showTenantName/)
|
||||||
})
|
})
|
||||||
|
|
||||||
test('source contract: uses compact desktop padding and a bounded mobile header', () => {
|
test('source contract: aligns the top bar beside the prototype sidebar and bounds the mobile header', () => {
|
||||||
assert.match(shellStyles, /\.top-header \{[^}]*padding: 0 20px;/)
|
assert.match(shellStyles, /\.top-header \{[^}]*inset: 0 0 auto 250px;[^}]*max-width: calc\(100vw - 250px\);[^}]*padding: 0 24px;/)
|
||||||
|
assert.match(shellStyles, /\.client-sidebar \{[^}]*inset: 0 auto 0 0;[^}]*width: 250px;[^}]*background: linear-gradient\(180deg, #0b1f3a 0%, #0c2a52 100%\)/)
|
||||||
|
assert.match(shellStyles, /\.client-sidebar-brand \{[^}]*border-bottom: 1px solid rgba\(255, 255, 255, \.1\)/)
|
||||||
assert.match(shellStyles, /\.client-main \{[^}]*padding: 88px 20px 40px;/)
|
assert.match(shellStyles, /\.client-main \{[^}]*padding: 88px 20px 40px;/)
|
||||||
assert.match(globalStyles, /@media \(max-width: 720px\) \{[\s\S]*\.top-header \{ padding: 0 14px; \}/)
|
assert.match(globalStyles, /@media \(max-width: 720px\) \{[\s\S]*\.top-header \{ inset: 0;[^}]*padding: 0 14px; \}/)
|
||||||
assert.match(globalStyles, /\.client-brand \{ display: none; \}/)
|
|
||||||
assert.match(globalStyles, /\.client-header-menu-button \{ display: grid; \}/)
|
assert.match(globalStyles, /\.client-header-menu-button \{ display: grid; \}/)
|
||||||
assert.match(globalStyles, /\.client-header-heading p, \.client-user-copy \{ display: none; \}/)
|
assert.match(globalStyles, /\.client-header-heading p, \.client-user-copy \{ display: none; \}/)
|
||||||
})
|
})
|
||||||
@@ -106,6 +109,7 @@ test('source contract: uses a native recursive disclosure list without Element m
|
|||||||
assert.match(sidebarMenuSource, /:active-parent-keys="activeParentKeys"/)
|
assert.match(sidebarMenuSource, /:active-parent-keys="activeParentKeys"/)
|
||||||
assert.match(sidebarMenuSource, /@toggle="handleToggle"/)
|
assert.match(sidebarMenuSource, /@toggle="handleToggle"/)
|
||||||
assert.match(sidebarMenuNodeSource, /<li\s+class="client-nav-node"[\s\S]*?v-if="node\.children"/)
|
assert.match(sidebarMenuNodeSource, /<li\s+class="client-nav-node"[\s\S]*?v-if="node\.children"/)
|
||||||
|
assert.match(sidebarMenuNodeSource, /'has-divider-before': node\.dividerBefore/)
|
||||||
assert.match(sidebarMenuNodeSource, /<button[\s\S]*?:aria-expanded="openedKeys\.has\(node\.key\)"[\s\S]*?:aria-controls="groupId"[\s\S]*?@click="emit\('toggle', node\.key\)"/)
|
assert.match(sidebarMenuNodeSource, /<button[\s\S]*?:aria-expanded="openedKeys\.has\(node\.key\)"[\s\S]*?:aria-controls="groupId"[\s\S]*?@click="emit\('toggle', node\.key\)"/)
|
||||||
assert.match(sidebarMenuNodeSource, /<ul\s+v-show="openedKeys\.has\(node\.key\)"\s+:id="groupId"\s+class="client-nav-submenu"\s*>/)
|
assert.match(sidebarMenuNodeSource, /<ul\s+v-show="openedKeys\.has\(node\.key\)"\s+:id="groupId"\s+class="client-nav-submenu"\s*>/)
|
||||||
assert.match(sidebarMenuNodeSource, /<RouterLink[\s\S]*?:aria-current="node\.path === activePath \? 'page' : undefined"[\s\S]*?@click="emit\('navigate', node\.path\)"/)
|
assert.match(sidebarMenuNodeSource, /<RouterLink[\s\S]*?:aria-current="node\.path === activePath \? 'page' : undefined"[\s\S]*?@click="emit\('navigate', node\.path\)"/)
|
||||||
|
|||||||
@@ -96,9 +96,6 @@ async function handleLogout() {
|
|||||||
<template>
|
<template>
|
||||||
<div class="client-shell" :class="{ 'mobile-menu-open': mobileMenuOpen }">
|
<div class="client-shell" :class="{ 'mobile-menu-open': mobileMenuOpen }">
|
||||||
<header class="top-header" :inert="mobileMenuOpen" :aria-hidden="mobileMenuOpen ? 'true' : undefined">
|
<header class="top-header" :inert="mobileMenuOpen" :aria-hidden="mobileMenuOpen ? 'true' : undefined">
|
||||||
<RouterLink class="client-brand" to="/">
|
|
||||||
<img class="client-brand-logo" :src="baiyueLogoDark" alt="柏悦物流" />
|
|
||||||
</RouterLink>
|
|
||||||
<button
|
<button
|
||||||
ref="menuButtonRef"
|
ref="menuButtonRef"
|
||||||
type="button"
|
type="button"
|
||||||
@@ -117,7 +114,6 @@ async function handleLogout() {
|
|||||||
<div class="client-user">
|
<div class="client-user">
|
||||||
<span class="client-avatar">{{ auth.user?.name.slice(0, 1) }}</span>
|
<span class="client-avatar">{{ auth.user?.name.slice(0, 1) }}</span>
|
||||||
<span class="client-user-copy"><strong>{{ auth.user?.name }}</strong><small>{{ auth.user?.roles.join('、') }}</small></span>
|
<span class="client-user-copy"><strong>{{ auth.user?.name }}</strong><small>{{ auth.user?.roles.join('、') }}</small></span>
|
||||||
<el-button text aria-label="退出登录" @click="handleLogout"><LogOut :size="18" /></el-button>
|
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
@@ -136,8 +132,11 @@ async function handleLogout() {
|
|||||||
:inert="!desktopViewport && !mobileMenuOpen"
|
:inert="!desktopViewport && !mobileMenuOpen"
|
||||||
:aria-hidden="!desktopViewport && !mobileMenuOpen ? 'true' : undefined"
|
:aria-hidden="!desktopViewport && !mobileMenuOpen ? 'true' : undefined"
|
||||||
>
|
>
|
||||||
<div class="client-sidebar-header">
|
<div class="client-sidebar-brand">
|
||||||
<strong>功能导航</strong>
|
<RouterLink class="client-sidebar-brand-link" to="/" aria-label="返回业务总览" @click="closeMobileMenu">
|
||||||
|
<span class="client-sidebar-brand-mark"><img :src="baiyueLogoDark" alt="" /></span>
|
||||||
|
<span class="client-sidebar-brand-copy"><strong>柏悦物流</strong><small>客户工作台</small></span>
|
||||||
|
</RouterLink>
|
||||||
<button
|
<button
|
||||||
ref="sidebarCloseButtonRef"
|
ref="sidebarCloseButtonRef"
|
||||||
type="button"
|
type="button"
|
||||||
@@ -152,8 +151,11 @@ async function handleLogout() {
|
|||||||
:active-path="route.path"
|
:active-path="route.path"
|
||||||
@navigate="closeMobileMenu"
|
@navigate="closeMobileMenu"
|
||||||
/>
|
/>
|
||||||
|
<button type="button" class="client-sidebar-logout" @click="handleLogout">
|
||||||
|
<LogOut :size="18" aria-hidden="true" />
|
||||||
|
<span>退出登录</span>
|
||||||
|
</button>
|
||||||
</nav>
|
</nav>
|
||||||
<div class="sidebar-help"><strong>需要帮助?</strong><span>联系您的专属客户经理</span></div>
|
|
||||||
</aside>
|
</aside>
|
||||||
|
|
||||||
<main
|
<main
|
||||||
|
|||||||
@@ -5,15 +5,10 @@ import { fileURLToPath } from 'node:url'
|
|||||||
import { join } from 'node:path'
|
import { join } from 'node:path'
|
||||||
import test from 'node:test'
|
import test from 'node:test'
|
||||||
import {
|
import {
|
||||||
Building2,
|
|
||||||
CircleUserRound,
|
|
||||||
ClipboardList,
|
ClipboardList,
|
||||||
KeyRound,
|
|
||||||
LayoutGrid,
|
LayoutGrid,
|
||||||
Settings,
|
Settings,
|
||||||
ShieldCheck,
|
|
||||||
Truck,
|
Truck,
|
||||||
Users,
|
|
||||||
} from '@lucide/vue'
|
} from '@lucide/vue'
|
||||||
|
|
||||||
import {
|
import {
|
||||||
@@ -32,7 +27,7 @@ function collectNavigationNodes(nodes) {
|
|||||||
])
|
])
|
||||||
}
|
}
|
||||||
|
|
||||||
test('keeps the confirmed personal entries at the top level', () => {
|
test('keeps the confirmed top-level sequence from the client workbench prototype', () => {
|
||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
clientNavigation.filter((node) => node.path).map(({ title, path, permission }) => ({
|
clientNavigation.filter((node) => node.path).map(({ title, path, permission }) => ({
|
||||||
title,
|
title,
|
||||||
@@ -50,101 +45,119 @@ test('keeps the confirmed navigation groups and leaf order', () => {
|
|||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
clientNavigation.map((node) => ({
|
clientNavigation.map((node) => ({
|
||||||
title: node.title,
|
title: node.title,
|
||||||
children: node.children?.map(({ title, path, permission }) => ({
|
children: node.children?.map(({ title }) => title),
|
||||||
title,
|
|
||||||
path,
|
|
||||||
permission,
|
|
||||||
})),
|
|
||||||
})),
|
})),
|
||||||
[
|
[
|
||||||
{ title: '业务总览', children: undefined },
|
{ title: '业务总览', children: undefined },
|
||||||
{ title: '我的信息', children: undefined },
|
|
||||||
{
|
{
|
||||||
title: '头程业务',
|
title: '头程物流',
|
||||||
children: [
|
children: ['头程下单', '一键导入', '快速下单'],
|
||||||
{
|
|
||||||
title: '头程订单',
|
|
||||||
path: '/orders/first-leg',
|
|
||||||
permission: 'order:first-leg:list',
|
|
||||||
},
|
},
|
||||||
],
|
{
|
||||||
|
title: '出海下单',
|
||||||
|
children: ['海外采购', '美国本土卡', '美本土散板'],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '海外仓',
|
||||||
|
children: ['贴标申请', '退货入库', '退货换标', '退货出库'],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '订单管理',
|
||||||
|
children: ['我的订单', '入库订单列表', '派送订单列表'],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '财务结算',
|
||||||
|
children: ['应付账单'],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '企业管理',
|
title: '企业管理',
|
||||||
children: [
|
children: ['企业资料', '企业成员', '角色管理', '菜单权限'],
|
||||||
{
|
|
||||||
title: '企业资料',
|
|
||||||
path: '/company/profile',
|
|
||||||
permission: 'company:profile:view',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '企业成员',
|
|
||||||
path: '/organization/members',
|
|
||||||
permission: 'company:member:list',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '角色管理',
|
|
||||||
path: '/organization/roles',
|
|
||||||
permission: 'company:role:list',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '菜单权限',
|
|
||||||
path: '/organization/permissions',
|
|
||||||
permission: 'company:permission:list',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
},
|
||||||
|
{ title: '我的信息', children: undefined },
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
test('provides confirmed icons and unique keys recursively', () => {
|
test('provides icons and unique keys recursively for every prototype item', () => {
|
||||||
const expectedIcons = new Map([
|
|
||||||
['dashboard', LayoutGrid],
|
|
||||||
['account-profile', CircleUserRound],
|
|
||||||
['first-leg', Truck],
|
|
||||||
['first-leg-orders', ClipboardList],
|
|
||||||
['company', Settings],
|
|
||||||
['company-profile', Building2],
|
|
||||||
['company-members', Users],
|
|
||||||
['company-roles', ShieldCheck],
|
|
||||||
['company-permissions', KeyRound],
|
|
||||||
])
|
|
||||||
const nodes = collectNavigationNodes(clientNavigation)
|
const nodes = collectNavigationNodes(clientNavigation)
|
||||||
|
|
||||||
for (const node of nodes) {
|
for (const node of nodes) {
|
||||||
assert.equal(node.icon, expectedIcons.get(node.key), `${node.key} has the confirmed icon`)
|
assert.ok(node.icon, `${node.key} has an icon`)
|
||||||
}
|
}
|
||||||
assert.equal(new Set(nodes.map((node) => node.key)).size, nodes.length)
|
assert.equal(new Set(nodes.map((node) => node.key)).size, nodes.length)
|
||||||
})
|
})
|
||||||
|
|
||||||
test('flattens leaves with unique paths and non-empty permissions', () => {
|
test('flattens the complete prototype tree with unique paths', () => {
|
||||||
const leaves = getNavigationLeaves(clientNavigation)
|
const leaves = getNavigationLeaves(clientNavigation)
|
||||||
const paths = leaves.map((leaf) => leaf.path)
|
const paths = leaves.map((leaf) => leaf.path)
|
||||||
|
|
||||||
assert.deepEqual(paths, [
|
assert.deepEqual(paths, [
|
||||||
'/',
|
'/',
|
||||||
'/account/profile',
|
|
||||||
'/orders/first-leg',
|
'/orders/first-leg',
|
||||||
|
'/first-leg/import',
|
||||||
|
'/first-leg/quick-order',
|
||||||
|
'/cross-border/procurement',
|
||||||
|
'/cross-border/domestic-trucking',
|
||||||
|
'/cross-border/pallet-shipping',
|
||||||
|
'/overseas-warehouse/labeling',
|
||||||
|
'/overseas-warehouse/return-inbound',
|
||||||
|
'/overseas-warehouse/return-relabel',
|
||||||
|
'/overseas-warehouse/return-outbound',
|
||||||
|
'/orders/my',
|
||||||
|
'/orders/inbound',
|
||||||
|
'/orders/delivery',
|
||||||
|
'/finance/payables',
|
||||||
'/company/profile',
|
'/company/profile',
|
||||||
'/organization/members',
|
'/organization/members',
|
||||||
'/organization/roles',
|
'/organization/roles',
|
||||||
'/organization/permissions',
|
'/organization/permissions',
|
||||||
|
'/account/profile',
|
||||||
])
|
])
|
||||||
assert.equal(new Set(paths).size, paths.length)
|
assert.equal(new Set(paths).size, paths.length)
|
||||||
assert.ok(leaves.every((leaf) => leaf.permission.trim().length > 0))
|
assert.ok(leaves.filter((leaf) => leaf.permission).every((leaf) => leaf.permission?.trim().length > 0))
|
||||||
assert.equal(new Set(leaves.map((leaf) => leaf.permission)).size, leaves.length)
|
|
||||||
})
|
})
|
||||||
|
|
||||||
test('filters inaccessible leaves and empty navigation groups', () => {
|
test('filters inaccessible leaves and empty navigation groups', () => {
|
||||||
const visible = filterNavigationByPermissions(clientNavigation, ['account:profile:view', 'order:first-leg:list'])
|
const visible = filterNavigationByPermissions(clientNavigation, ['account:profile:view', 'order:first-leg:list'])
|
||||||
|
|
||||||
assert.deepEqual(getNavigationLeaves(visible).map((item) => item.path), ['/account/profile', '/orders/first-leg'])
|
assert.deepEqual(getNavigationLeaves(visible).map((item) => item.path), [
|
||||||
assert.deepEqual(visible.map((item) => item.title), ['我的信息', '头程业务'])
|
'/orders/first-leg',
|
||||||
|
'/first-leg/import',
|
||||||
|
'/first-leg/quick-order',
|
||||||
|
'/cross-border/procurement',
|
||||||
|
'/cross-border/domestic-trucking',
|
||||||
|
'/cross-border/pallet-shipping',
|
||||||
|
'/overseas-warehouse/labeling',
|
||||||
|
'/overseas-warehouse/return-inbound',
|
||||||
|
'/overseas-warehouse/return-relabel',
|
||||||
|
'/overseas-warehouse/return-outbound',
|
||||||
|
'/orders/my',
|
||||||
|
'/orders/inbound',
|
||||||
|
'/orders/delivery',
|
||||||
|
'/finance/payables',
|
||||||
|
'/account/profile',
|
||||||
|
])
|
||||||
|
assert.deepEqual(visible.map((item) => item.title), ['头程物流', '出海下单', '海外仓', '订单管理', '财务结算', '我的信息'])
|
||||||
assert.equal(getFirstAccessiblePath(['account:profile:view']), '/account/profile')
|
assert.equal(getFirstAccessiblePath(['account:profile:view']), '/account/profile')
|
||||||
assert.equal(getFirstAccessiblePath([]), '/forbidden')
|
assert.equal(getFirstAccessiblePath([]), '/forbidden')
|
||||||
})
|
})
|
||||||
|
|
||||||
|
test('excludes entries marked for manual hiding without affecting other visible items', () => {
|
||||||
|
const visible = filterNavigationByPermissions([
|
||||||
|
{ key: 'shown', title: '显示入口', icon: LayoutGrid, path: '/shown' },
|
||||||
|
{ key: 'hidden', title: '隐藏入口', icon: LayoutGrid, path: '/hidden', hidden: true },
|
||||||
|
], [])
|
||||||
|
|
||||||
|
assert.deepEqual(getNavigationLeaves(visible).map((item) => item.path), ['/shown'])
|
||||||
|
})
|
||||||
|
|
||||||
|
test('puts enterprise management behind the prototype settings divider', () => {
|
||||||
|
const company = clientNavigation.find((node) => node.key === 'company')
|
||||||
|
|
||||||
|
assert.ok(company)
|
||||||
|
assert.equal(company.dividerBefore, true)
|
||||||
|
})
|
||||||
|
|
||||||
test('flattens a synthetic three-level navigation tree recursively', () => {
|
test('flattens a synthetic three-level navigation tree recursively', () => {
|
||||||
const nestedLeaf = {
|
const nestedLeaf = {
|
||||||
key: 'nested-leaf',
|
key: 'nested-leaf',
|
||||||
@@ -324,3 +337,26 @@ test('keeps the dashboard route permission synchronized with navigation', () =>
|
|||||||
assert.ok(dashboardRoute)
|
assert.ok(dashboardRoute)
|
||||||
assert.match(dashboardRoute, /permission: 'dashboard:view'/)
|
assert.match(dashboardRoute, /permission: 'dashboard:view'/)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
test('registers every prototype-only view through its corresponding business directory', () => {
|
||||||
|
const routerSource = readFileSync(new URL('../router/index.ts', import.meta.url), 'utf8')
|
||||||
|
const routes = [
|
||||||
|
['first-leg/import', 'first-leg/BatchImportView.vue'],
|
||||||
|
['first-leg/quick-order', 'first-leg/QuickOrderView.vue'],
|
||||||
|
['cross-border/procurement', 'cross-border/ProcurementView.vue'],
|
||||||
|
['cross-border/domestic-trucking', 'cross-border/DomesticTruckingView.vue'],
|
||||||
|
['cross-border/pallet-shipping', 'cross-border/PalletShippingView.vue'],
|
||||||
|
['overseas-warehouse/labeling', 'overseas-warehouse/LabelingView.vue'],
|
||||||
|
['overseas-warehouse/return-inbound', 'overseas-warehouse/ReturnInboundView.vue'],
|
||||||
|
['overseas-warehouse/return-relabel', 'overseas-warehouse/ReturnRelabelView.vue'],
|
||||||
|
['overseas-warehouse/return-outbound', 'overseas-warehouse/ReturnOutboundView.vue'],
|
||||||
|
['orders/my', 'order-management/MyOrdersView.vue'],
|
||||||
|
['orders/inbound', 'order-management/InboundOrdersView.vue'],
|
||||||
|
['orders/delivery', 'order-management/DeliveryOrdersView.vue'],
|
||||||
|
['finance/payables', 'finance/PayableBillsView.vue'],
|
||||||
|
]
|
||||||
|
|
||||||
|
for (const [path, view] of routes) {
|
||||||
|
assert.match(routerSource, new RegExp(`path: '${path}'.*?@/views/${view.replace('.', '\\.')}`))
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|||||||
@@ -5,21 +5,30 @@ import {
|
|||||||
ClipboardList,
|
ClipboardList,
|
||||||
KeyRound,
|
KeyRound,
|
||||||
LayoutGrid,
|
LayoutGrid,
|
||||||
|
Package,
|
||||||
|
PlaneTakeoff,
|
||||||
|
ReceiptText,
|
||||||
Settings,
|
Settings,
|
||||||
|
Ship,
|
||||||
ShieldCheck,
|
ShieldCheck,
|
||||||
|
Tags,
|
||||||
Truck,
|
Truck,
|
||||||
Users,
|
Users,
|
||||||
|
Warehouse,
|
||||||
|
Zap,
|
||||||
} from '@lucide/vue'
|
} from '@lucide/vue'
|
||||||
|
|
||||||
export interface ClientNavigationBaseNode {
|
export interface ClientNavigationBaseNode {
|
||||||
key: string
|
key: string
|
||||||
title: string
|
title: string
|
||||||
icon: Component
|
icon: Component
|
||||||
|
dividerBefore?: boolean
|
||||||
|
hidden?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ClientNavigationLeaf extends ClientNavigationBaseNode {
|
export interface ClientNavigationLeaf extends ClientNavigationBaseNode {
|
||||||
path: string
|
path: string
|
||||||
permission: string
|
permission?: string
|
||||||
children?: never
|
children?: never
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -33,19 +42,60 @@ export type ClientNavigationNode = ClientNavigationLeaf | ClientNavigationGroup
|
|||||||
|
|
||||||
export const clientNavigation: ClientNavigationNode[] = [
|
export const clientNavigation: ClientNavigationNode[] = [
|
||||||
{ key: 'dashboard', title: '业务总览', icon: LayoutGrid, path: '/', permission: 'dashboard:view' },
|
{ key: 'dashboard', title: '业务总览', icon: LayoutGrid, path: '/', permission: 'dashboard:view' },
|
||||||
{ key: 'account-profile', title: '我的信息', icon: CircleUserRound, path: '/account/profile', permission: 'account:profile:view' },
|
|
||||||
{
|
{
|
||||||
key: 'first-leg',
|
key: 'first-leg',
|
||||||
title: '头程业务',
|
title: '头程物流',
|
||||||
icon: Truck,
|
icon: Truck,
|
||||||
children: [
|
children: [
|
||||||
{ key: 'first-leg-orders', title: '头程订单', icon: ClipboardList, path: '/orders/first-leg', permission: 'order:first-leg:list' },
|
{ key: 'first-leg-orders', title: '头程下单', icon: ClipboardList, path: '/orders/first-leg', permission: 'order:first-leg:list' },
|
||||||
|
{ key: 'first-leg-import', title: '一键导入', icon: Package, path: '/first-leg/import' },
|
||||||
|
{ key: 'first-leg-quick-order', title: '快速下单', icon: Zap, path: '/first-leg/quick-order' },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'cross-border',
|
||||||
|
title: '出海下单',
|
||||||
|
icon: PlaneTakeoff,
|
||||||
|
children: [
|
||||||
|
{ key: 'cross-border-procurement', title: '海外采购', icon: Package, path: '/cross-border/procurement' },
|
||||||
|
{ key: 'cross-border-domestic-trucking', title: '美国本土卡', icon: Truck, path: '/cross-border/domestic-trucking' },
|
||||||
|
{ key: 'cross-border-pallet-shipping', title: '美本土散板', icon: Ship, path: '/cross-border/pallet-shipping' },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'overseas-warehouse',
|
||||||
|
title: '海外仓',
|
||||||
|
icon: Warehouse,
|
||||||
|
children: [
|
||||||
|
{ key: 'overseas-labeling', title: '贴标申请', icon: Tags, path: '/overseas-warehouse/labeling' },
|
||||||
|
{ key: 'overseas-return-inbound', title: '退货入库', icon: Package, path: '/overseas-warehouse/return-inbound' },
|
||||||
|
{ key: 'overseas-return-relabel', title: '退货换标', icon: Tags, path: '/overseas-warehouse/return-relabel' },
|
||||||
|
{ key: 'overseas-return-outbound', title: '退货出库', icon: Truck, path: '/overseas-warehouse/return-outbound' },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'order-management',
|
||||||
|
title: '订单管理',
|
||||||
|
icon: ClipboardList,
|
||||||
|
children: [
|
||||||
|
{ key: 'orders-my', title: '我的订单', icon: ReceiptText, path: '/orders/my' },
|
||||||
|
{ key: 'orders-inbound', title: '入库订单列表', icon: Package, path: '/orders/inbound' },
|
||||||
|
{ key: 'orders-delivery', title: '派送订单列表', icon: Truck, path: '/orders/delivery' },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'finance',
|
||||||
|
title: '财务结算',
|
||||||
|
icon: ReceiptText,
|
||||||
|
children: [
|
||||||
|
{ key: 'finance-payables', title: '应付账单', icon: ReceiptText, path: '/finance/payables' },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: 'company',
|
key: 'company',
|
||||||
title: '企业管理',
|
title: '企业管理',
|
||||||
icon: Settings,
|
icon: Settings,
|
||||||
|
dividerBefore: true,
|
||||||
children: [
|
children: [
|
||||||
{ key: 'company-profile', title: '企业资料', icon: Building2, path: '/company/profile', permission: 'company:profile:view' },
|
{ key: 'company-profile', title: '企业资料', icon: Building2, path: '/company/profile', permission: 'company:profile:view' },
|
||||||
{ key: 'company-members', title: '企业成员', icon: Users, path: '/organization/members', permission: 'company:member:list' },
|
{ key: 'company-members', title: '企业成员', icon: Users, path: '/organization/members', permission: 'company:member:list' },
|
||||||
@@ -53,6 +103,7 @@ export const clientNavigation: ClientNavigationNode[] = [
|
|||||||
{ key: 'company-permissions', title: '菜单权限', icon: KeyRound, path: '/organization/permissions', permission: 'company:permission:list' },
|
{ key: 'company-permissions', title: '菜单权限', icon: KeyRound, path: '/organization/permissions', permission: 'company:permission:list' },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
{ key: 'account-profile', title: '我的信息', icon: CircleUserRound, path: '/account/profile', permission: 'account:profile:view' },
|
||||||
]
|
]
|
||||||
|
|
||||||
function isNavigationGroup(node: ClientNavigationNode): node is ClientNavigationGroup {
|
function isNavigationGroup(node: ClientNavigationNode): node is ClientNavigationGroup {
|
||||||
@@ -73,8 +124,9 @@ export function filterNavigationByPermissions(
|
|||||||
const allowed = new Set(permissions)
|
const allowed = new Set(permissions)
|
||||||
const result: ClientNavigationNode[] = []
|
const result: ClientNavigationNode[] = []
|
||||||
for (const node of nodes) {
|
for (const node of nodes) {
|
||||||
|
if (node.hidden) continue
|
||||||
if (!isNavigationGroup(node)) {
|
if (!isNavigationGroup(node)) {
|
||||||
if (allowed.has(node.permission)) result.push(node)
|
if (!node.permission || allowed.has(node.permission)) result.push(node)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
const children = filterNavigationByPermissions(node.children, permissions)
|
const children = filterNavigationByPermissions(node.children, permissions)
|
||||||
@@ -84,7 +136,7 @@ export function filterNavigationByPermissions(
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function getFirstAccessiblePath(permissions: readonly string[]) {
|
export function getFirstAccessiblePath(permissions: readonly string[]) {
|
||||||
return getNavigationLeaves(filterNavigationByPermissions(clientNavigation, permissions))[0]?.path ?? '/forbidden'
|
return getNavigationLeaves(filterNavigationByPermissions(clientNavigation, permissions)).find((leaf) => leaf.permission)?.path ?? '/forbidden'
|
||||||
}
|
}
|
||||||
|
|
||||||
function findNavigationParentKeys(
|
function findNavigationParentKeys(
|
||||||
|
|||||||
@@ -20,6 +20,19 @@ const router = createRouter({
|
|||||||
{ path: 'organization/roles', name: 'roles', component: () => import('@/views/RolesView.vue'), meta: { title: '角色管理', description: '建立符合企业分工的成员角色', permission: 'company:role:list' } },
|
{ path: 'organization/roles', name: 'roles', component: () => import('@/views/RolesView.vue'), meta: { title: '角色管理', description: '建立符合企业分工的成员角色', permission: 'company:role:list' } },
|
||||||
{ path: 'organization/permissions', name: 'permissions', component: () => import('@/views/PermissionsView.vue'), meta: { title: '菜单权限', description: '为本企业角色分配菜单及操作权限', permission: 'company:permission:list' } },
|
{ path: 'organization/permissions', name: 'permissions', component: () => import('@/views/PermissionsView.vue'), meta: { title: '菜单权限', description: '为本企业角色分配菜单及操作权限', permission: 'company:permission:list' } },
|
||||||
{ path: 'orders/first-leg', name: 'first-leg-orders', component: () => import('@/views/FirstLegOrdersView.vue'), meta: { title: '头程订单', description: '创建、查询并跟进本企业头程订单', permission: 'order:first-leg:list' } },
|
{ path: 'orders/first-leg', name: 'first-leg-orders', component: () => import('@/views/FirstLegOrdersView.vue'), meta: { title: '头程订单', description: '创建、查询并跟进本企业头程订单', permission: 'order:first-leg:list' } },
|
||||||
|
{ path: 'first-leg/import', name: 'first-leg-import', component: () => import('@/views/first-leg/BatchImportView.vue'), meta: { title: '一键导入', description: '批量导入头程订单' } },
|
||||||
|
{ path: 'first-leg/quick-order', name: 'first-leg-quick-order', component: () => import('@/views/first-leg/QuickOrderView.vue'), meta: { title: '快速下单', description: '快速创建头程订单' } },
|
||||||
|
{ path: 'cross-border/procurement', name: 'cross-border-procurement', component: () => import('@/views/cross-border/ProcurementView.vue'), meta: { title: '海外采购', description: '管理海外采购订单' } },
|
||||||
|
{ path: 'cross-border/domestic-trucking', name: 'cross-border-domestic-trucking', component: () => import('@/views/cross-border/DomesticTruckingView.vue'), meta: { title: '美国本土卡', description: '创建美国本土卡车运输订单' } },
|
||||||
|
{ path: 'cross-border/pallet-shipping', name: 'cross-border-pallet-shipping', component: () => import('@/views/cross-border/PalletShippingView.vue'), meta: { title: '美本土散板', description: '创建美国本土散板运输订单' } },
|
||||||
|
{ path: 'overseas-warehouse/labeling', name: 'overseas-labeling', component: () => import('@/views/overseas-warehouse/LabelingView.vue'), meta: { title: '贴标申请', description: '提交海外仓贴标申请' } },
|
||||||
|
{ path: 'overseas-warehouse/return-inbound', name: 'overseas-return-inbound', component: () => import('@/views/overseas-warehouse/ReturnInboundView.vue'), meta: { title: '退货入库', description: '登记海外仓退货入库' } },
|
||||||
|
{ path: 'overseas-warehouse/return-relabel', name: 'overseas-return-relabel', component: () => import('@/views/overseas-warehouse/ReturnRelabelView.vue'), meta: { title: '退货换标', description: '提交退货换标申请' } },
|
||||||
|
{ path: 'overseas-warehouse/return-outbound', name: 'overseas-return-outbound', component: () => import('@/views/overseas-warehouse/ReturnOutboundView.vue'), meta: { title: '退货出库', description: '创建海外仓退货出库单' } },
|
||||||
|
{ path: 'orders/my', name: 'orders-my', component: () => import('@/views/order-management/MyOrdersView.vue'), meta: { title: '我的订单', description: '统一查询各类业务订单' } },
|
||||||
|
{ path: 'orders/inbound', name: 'orders-inbound', component: () => import('@/views/order-management/InboundOrdersView.vue'), meta: { title: '入库订单列表', description: '查询海外仓入库订单' } },
|
||||||
|
{ path: 'orders/delivery', name: 'orders-delivery', component: () => import('@/views/order-management/DeliveryOrdersView.vue'), meta: { title: '派送订单列表', description: '查询海外仓派送订单' } },
|
||||||
|
{ path: 'finance/payables', name: 'finance-payables', component: () => import('@/views/finance/PayableBillsView.vue'), meta: { title: '应付账单', description: '查询企业应付账单' } },
|
||||||
{ path: 'forbidden', name: 'forbidden', component: () => import('@/views/ForbiddenView.vue'), meta: { title: '无权访问', description: '当前账号没有访问该页面的权限' } },
|
{ path: 'forbidden', name: 'forbidden', component: () => import('@/views/ForbiddenView.vue'), meta: { title: '无权访问', description: '当前账号没有访问该页面的权限' } },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -94,15 +94,12 @@
|
|||||||
.client-content-grid { grid-template-columns: 1fr; }
|
.client-content-grid { grid-template-columns: 1fr; }
|
||||||
}
|
}
|
||||||
@media (max-width: 720px) {
|
@media (max-width: 720px) {
|
||||||
.top-header { padding: 0 14px; }
|
.top-header { inset: 0; width: 100%; max-width: 100vw; padding: 0 14px; }
|
||||||
.client-sidebar { display: flex; width: min(286px, 86vw); padding: 0 14px 18px; visibility: hidden; pointer-events: none; transform: translateX(-100%); transition: transform .2s ease, visibility 0s linear .2s; z-index: 19; }
|
.client-sidebar { display: flex; width: min(286px, 86vw); padding: 20px 14px 18px; visibility: hidden; pointer-events: none; transform: translateX(-100%); transition: transform .2s ease, visibility 0s linear .2s; z-index: 21; }
|
||||||
.mobile-menu-open .client-sidebar { visibility: visible; pointer-events: auto; transform: translateX(0); transition-delay: 0s; }
|
.mobile-menu-open .client-sidebar { visibility: visible; pointer-events: auto; transform: translateX(0); transition-delay: 0s; }
|
||||||
.client-sidebar-scrim { position: fixed; inset: 68px 0 0; z-index: 18; display: block; padding: 0; border: 0; background: rgba(23, 50, 77, .48); }
|
.client-sidebar-scrim { position: fixed; inset: 0; z-index: 20; display: block; padding: 0; border: 0; background: rgba(7, 18, 34, .56); }
|
||||||
.client-sidebar-header { display: flex; height: 52px; flex: 0 0 52px; align-items: center; justify-content: space-between; color: var(--navy); }
|
.client-sidebar-brand button { display: grid; width: 44px; height: 44px; flex: 0 0 44px; padding: 0; border: 0; border-radius: 8px; background: transparent; color: #fff; place-items: center; }
|
||||||
.client-sidebar-header strong { font-size: 13px; }
|
|
||||||
.client-sidebar-header button { display: grid; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 8px; background: transparent; color: var(--navy); place-items: center; }
|
|
||||||
.client-main { width: 100%; max-width: 100%; margin-left: 0; padding: 88px 14px 30px; }
|
.client-main { width: 100%; max-width: 100%; margin-left: 0; padding: 88px 14px 30px; }
|
||||||
.client-brand { display: none; }
|
|
||||||
.client-header-menu-button { display: grid; }
|
.client-header-menu-button { display: grid; }
|
||||||
.client-header-heading p, .client-user-copy { display: none; }
|
.client-header-heading p, .client-user-copy { display: none; }
|
||||||
.client-header-heading h1 { font-size: 16px; }
|
.client-header-heading h1 { font-size: 16px; }
|
||||||
|
|||||||
@@ -10,20 +10,27 @@ const mobileStyles = compact.slice(compact.indexOf('@media (max-width: 720px)'))
|
|||||||
|
|
||||||
test('style source contract: constrains the desktop sidebar and gives the menu its own scroll region', () => {
|
test('style source contract: constrains the desktop sidebar and gives the menu its own scroll region', () => {
|
||||||
assert.match(compact, /\.client-shell\s*\{[^}]*overflow-x:\s*hidden/)
|
assert.match(compact, /\.client-shell\s*\{[^}]*overflow-x:\s*hidden/)
|
||||||
assert.match(compact, /\.client-sidebar\s*\{[^}]*overflow:\s*hidden/)
|
assert.match(compact, /\.client-sidebar\s*\{[^}]*inset:\s*0 auto 0 0[^}]*width:\s*250px[^}]*overflow:\s*hidden[^}]*background:\s*linear-gradient\(180deg, #0b1f3a 0%, #0c2a52 100%\)/)
|
||||||
|
assert.match(compact, /\.top-header\s*\{[^}]*inset:\s*0 0 auto 250px[^}]*max-width:\s*calc\(100vw - 250px\)/)
|
||||||
assert.match(compact, /\.client-sidebar nav\s*\{[^}]*flex:\s*1[^}]*min-height:\s*0[^}]*overflow-y:\s*auto/)
|
assert.match(compact, /\.client-sidebar nav\s*\{[^}]*flex:\s*1[^}]*min-height:\s*0[^}]*overflow-y:\s*auto/)
|
||||||
|
assert.match(compact, /\.client-sidebar nav\s*\{[^}]*scrollbar-color:\s*rgba\(206, 222, 238, \.46\) transparent[^}]*scrollbar-width:\s*thin/)
|
||||||
|
assert.match(compact, /\.client-sidebar nav::\-webkit-scrollbar\s*\{[^}]*width:\s*10px[^}]*background:\s*transparent/)
|
||||||
|
assert.match(compact, /\.client-sidebar nav::\-webkit-scrollbar-track\s*\{[^}]*background:\s*transparent/)
|
||||||
|
assert.match(compact, /\.client-sidebar nav::\-webkit-scrollbar-thumb\s*\{[^}]*border:\s*3px solid transparent[^}]*background:\s*rgba\(206, 222, 238, \.46\)[^}]*background-clip:\s*padding-box/)
|
||||||
|
assert.match(compact, /\.client-sidebar nav::\-webkit-scrollbar-button\s*\{[^}]*display:\s*none[^}]*width:\s*0[^}]*height:\s*0/)
|
||||||
assert.match(compact, /\.client-nav-menu,[^\{]*\.client-nav-submenu\s*\{[^}]*min-width:\s*0/)
|
assert.match(compact, /\.client-nav-menu,[^\{]*\.client-nav-submenu\s*\{[^}]*min-width:\s*0/)
|
||||||
assert.match(compact, /\.client-nav-menu\s*\{[^}]*flex:\s*1[^}]*background:\s*transparent/)
|
assert.match(compact, /\.client-nav-menu\s*\{[^}]*flex:\s*1[^}]*background:\s*transparent/)
|
||||||
assert.match(compact, /\.client-sidebar-header,\s*\.client-sidebar-scrim\s*\{[^}]*display:\s*none/)
|
assert.match(compact, /\.client-sidebar-brand button,\s*\.client-sidebar-scrim\s*\{[^}]*display:\s*none/)
|
||||||
})
|
})
|
||||||
|
|
||||||
test('style source contract: presents native grouped rows with restrained active states and truncation', () => {
|
test('style source contract: presents native grouped rows matching the prototype active and divider states', () => {
|
||||||
assert.doesNotMatch(compact, /\.client-sidebar \.el-menu|\.el-menu-item|\.el-sub-menu/)
|
assert.doesNotMatch(compact, /\.client-sidebar \.el-menu|\.el-menu-item|\.el-sub-menu/)
|
||||||
assert.match(compact, /\.client-nav-menu,[^\{]*\.client-nav-submenu\s*\{[^}]*margin:\s*0[^}]*padding:\s*0[^}]*list-style:\s*none/)
|
assert.match(compact, /\.client-nav-menu,[^\{]*\.client-nav-submenu\s*\{[^}]*margin:\s*0[^}]*padding:\s*0[^}]*list-style:\s*none/)
|
||||||
assert.match(compact, /\.client-sidebar-group-trigger,[^\{]*\.client-sidebar-link\s*\{[^}]*height:\s*44px[^}]*border-radius:\s*8px/)
|
assert.match(compact, /\.client-sidebar-group-trigger,[^\{]*\.client-sidebar-link\s*\{[^}]*height:\s*44px[^}]*border-radius:\s*10px[^}]*color:\s*rgba\(255, 255, 255, \.72\)/)
|
||||||
assert.match(compact, /\.client-sidebar-link\[aria-current="page"\]\s*\{[^}]*background:\s*#e9f4f2[^}]*color:\s*var\(--primary\)/)
|
assert.match(compact, /\.client-sidebar-link\[aria-current="page"\]\s*\{[^}]*background:\s*linear-gradient\(90deg, #1565c0, #1e88e5\)[^}]*color:\s*#fff/)
|
||||||
assert.match(compact, /\.client-nav-node\.is-active-parent > \.client-sidebar-group-trigger\s*\{[^}]*background:\s*#f2f7f6[^}]*color:\s*var\(--primary\)/)
|
assert.match(compact, /\.client-nav-node\.is-active-parent > \.client-sidebar-group-trigger\s*\{[^}]*background:\s*rgba\(255, 255, 255, \.08\)[^}]*color:\s*#fff/)
|
||||||
assert.match(compact, /\.client-nav-submenu\s*\{[^}]*padding-left:\s*3[6-8]px/)
|
assert.match(compact, /\.client-nav-node\.has-divider-before\s*\{[^}]*border-top:\s*1px solid rgba\(255, 255, 255, \.1\)/)
|
||||||
|
assert.match(compact, /\.client-nav-submenu\s*\{[^}]*padding-left:\s*34px/)
|
||||||
assert.match(compact, /\.client-sidebar-group-trigger\s*\{[^}]*border:\s*0[^}]*background:\s*transparent/)
|
assert.match(compact, /\.client-sidebar-group-trigger\s*\{[^}]*border:\s*0[^}]*background:\s*transparent/)
|
||||||
assert.match(compact, /\.client-sidebar-link\s*\{[^}]*text-decoration:\s*none/)
|
assert.match(compact, /\.client-sidebar-link\s*\{[^}]*text-decoration:\s*none/)
|
||||||
assert.match(compact, /\.client-sidebar (?:\.client-sidebar-group-trigger|\.client-sidebar-link) svg[^\{]*\{[^}]*flex:\s*0 0 18px/)
|
assert.match(compact, /\.client-sidebar (?:\.client-sidebar-group-trigger|\.client-sidebar-link) svg[^\{]*\{[^}]*flex:\s*0 0 18px/)
|
||||||
@@ -32,17 +39,18 @@ test('style source contract: presents native grouped rows with restrained active
|
|||||||
|
|
||||||
test('style source contract: makes navigation and drawer controls touch sized with visible keyboard focus', () => {
|
test('style source contract: makes navigation and drawer controls touch sized with visible keyboard focus', () => {
|
||||||
assert.match(compact, /\.client-sidebar-group-trigger,[^\{]*\.client-sidebar-link\s*\{[^}]*height:\s*44px/)
|
assert.match(compact, /\.client-sidebar-group-trigger,[^\{]*\.client-sidebar-link\s*\{[^}]*height:\s*44px/)
|
||||||
assert.match(compact, /\.client-sidebar-group-trigger:focus-visible,[^\{]*\.client-sidebar-link:focus-visible,[^\{]*\.client-page-heading > button:focus-visible,[^\{]*\.client-sidebar-header button:focus-visible\s*\{[^}]*outline:\s*2px solid var\(--primary\)[^}]*outline-offset:\s*2px/)
|
assert.match(compact, /\.client-sidebar-group-trigger:focus-visible,\s*\.client-sidebar-link:focus-visible,[\s\S]*?\.client-sidebar-logout:focus-visible\s*\{[^}]*outline:\s*2px solid #8ed8cf[^}]*outline-offset:\s*2px/)
|
||||||
|
assert.match(compact, /\.client-sidebar-logout\s*\{[^}]*height:\s*44px[^}]*background:\s*rgba\(239, 68, 68, \.12\)/)
|
||||||
})
|
})
|
||||||
|
|
||||||
test('style source contract: turns the sidebar into a layered drawer at 720px and below', () => {
|
test('style source contract: turns the sidebar into a layered drawer at 720px and below', () => {
|
||||||
assert.doesNotMatch(mobileStyles, /\.client-sidebar\s*\{[^}]*display:\s*none/)
|
assert.doesNotMatch(mobileStyles, /\.client-sidebar\s*\{[^}]*display:\s*none/)
|
||||||
assert.match(mobileStyles, /\.client-sidebar\s*\{[^}]*display:\s*flex[^}]*width:\s*min\(286px,\s*86vw\)[^}]*visibility:\s*hidden[^}]*pointer-events:\s*none[^}]*transform:\s*translateX\(-100%\)[^}]*transition:\s*transform \.2s ease, visibility 0s linear \.2s[^}]*z-index:\s*19/)
|
assert.match(mobileStyles, /\.client-sidebar\s*\{[^}]*display:\s*flex[^}]*width:\s*min\(286px,\s*86vw\)[^}]*visibility:\s*hidden[^}]*pointer-events:\s*none[^}]*transform:\s*translateX\(-100%\)[^}]*transition:\s*transform \.2s ease, visibility 0s linear \.2s[^}]*z-index:\s*21/)
|
||||||
assert.match(mobileStyles, /\.mobile-menu-open \.client-sidebar\s*\{[^}]*visibility:\s*visible[^}]*pointer-events:\s*auto[^}]*transform:\s*translateX\(0\)[^}]*transition-delay:\s*0s/)
|
assert.match(mobileStyles, /\.mobile-menu-open \.client-sidebar\s*\{[^}]*visibility:\s*visible[^}]*pointer-events:\s*auto[^}]*transform:\s*translateX\(0\)[^}]*transition-delay:\s*0s/)
|
||||||
assert.match(mobileStyles, /\.client-sidebar-scrim\s*\{[^}]*position:\s*fixed[^}]*inset:\s*68px 0 0[^}]*z-index:\s*18[^}]*background:\s*rgba\(23,\s*50,\s*77,\s*\.48\)/)
|
assert.match(mobileStyles, /\.client-sidebar-scrim\s*\{[^}]*position:\s*fixed[^}]*inset:\s*0[^}]*z-index:\s*20[^}]*background:\s*rgba\(7,\s*18,\s*34,\s*\.56\)/)
|
||||||
assert.match(mobileStyles, /\.client-sidebar-header\s*\{[^}]*display:\s*flex[^}]*height:\s*52px/)
|
assert.match(mobileStyles, /\.client-sidebar-brand button\s*\{[^}]*display:\s*grid[^}]*width:\s*44px[^}]*height:\s*44px/)
|
||||||
assert.match(mobileStyles, /\.client-main\s*\{[^}]*max-width:\s*100%[^}]*margin-left:\s*0/)
|
assert.match(mobileStyles, /\.client-main\s*\{[^}]*max-width:\s*100%[^}]*margin-left:\s*0/)
|
||||||
assert.match(mobileStyles, /\.client-page-heading > button\s*\{[^}]*display:\s*grid[^}]*width:\s*44px[^}]*height:\s*44px/)
|
assert.match(mobileStyles, /\.client-header-menu-button\s*\{[^}]*display:\s*grid/)
|
||||||
assert.match(mobileStyles, /\.client-user\s*\{[^}]*margin-left:\s*auto/)
|
assert.match(mobileStyles, /\.client-user\s*\{[^}]*margin-left:\s*auto/)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
+29
-16
@@ -1,7 +1,5 @@
|
|||||||
.client-shell { min-height: 100vh; overflow-x: hidden; }
|
.client-shell { min-height: 100vh; overflow-x: hidden; }
|
||||||
.top-header { position: fixed; inset: 0 0 auto 0; z-index: 20; display: flex; width: 100%; max-width: 100vw; height: 68px; align-items: center; gap: 16px; padding: 0 20px; border-bottom: 1px solid var(--border); background: #fff; }
|
.top-header { position: fixed; inset: 0 0 auto 250px; z-index: 20; display: flex; width: auto; max-width: calc(100vw - 250px); height: 68px; align-items: center; gap: 16px; padding: 0 24px; border-bottom: 1px solid var(--border); background: rgba(255, 255, 255, .94); backdrop-filter: blur(12px); }
|
||||||
.client-brand { display: flex; width: 232px; min-width: 0; align-items: center; color: var(--navy); text-decoration: none; }
|
|
||||||
.client-brand-logo { display: block; width: 150px; height: 54px; object-fit: contain; object-position: left center; }
|
|
||||||
.client-header-menu-button { display: none; width: 44px; height: 44px; flex: 0 0 44px; padding: 0; border: 0; border-radius: 8px; background: transparent; color: var(--navy); place-items: center; }
|
.client-header-menu-button { display: none; width: 44px; height: 44px; flex: 0 0 44px; padding: 0; border: 0; border-radius: 8px; background: transparent; color: var(--navy); place-items: center; }
|
||||||
.client-header-heading { min-width: 0; flex: 1; }
|
.client-header-heading { min-width: 0; flex: 1; }
|
||||||
.client-header-heading h1 { overflow: hidden; margin: 0; color: var(--navy); font-size: 18px; line-height: 1.35; text-overflow: ellipsis; white-space: nowrap; }
|
.client-header-heading h1 { overflow: hidden; margin: 0; color: var(--navy); font-size: 18px; line-height: 1.35; text-overflow: ellipsis; white-space: nowrap; }
|
||||||
@@ -11,21 +9,35 @@
|
|||||||
.client-user-copy { display: flex; flex-direction: column; }
|
.client-user-copy { display: flex; flex-direction: column; }
|
||||||
.client-user-copy strong { font-size: 12px; }
|
.client-user-copy strong { font-size: 12px; }
|
||||||
.client-user-copy small { color: var(--muted); font-size: 10px; }
|
.client-user-copy small { color: var(--muted); font-size: 10px; }
|
||||||
.client-sidebar { position: fixed; inset: 68px auto 0 0; display: flex; width: 232px; flex-direction: column; overflow: hidden; padding: 20px 14px; border-right: 1px solid var(--border); background: #fff; }
|
.client-sidebar { position: fixed; inset: 0 auto 0 0; z-index: 21; display: flex; width: 250px; flex-direction: column; overflow: hidden; padding: 20px 14px; background: linear-gradient(180deg, #0b1f3a 0%, #0c2a52 100%); color: #fff; }
|
||||||
.client-sidebar nav { display: flex; flex: 1; min-width: 0; min-height: 0; flex-direction: column; overflow-x: hidden; overflow-y: auto; }
|
.client-sidebar-brand { display: flex; flex: 0 0 auto; min-height: 68px; align-items: center; justify-content: space-between; gap: 10px; margin: -2px 0 14px; padding: 0 8px 14px; border-bottom: 1px solid rgba(255, 255, 255, .1); }
|
||||||
|
.client-sidebar-brand-link { display: flex; min-width: 0; align-items: center; gap: 10px; color: #fff; text-decoration: none; }
|
||||||
|
.client-sidebar-brand-mark { display: grid; width: 36px; height: 36px; flex: 0 0 36px; place-items: center; border-radius: 9px; background: #fff; box-shadow: 0 5px 14px rgba(0, 0, 0, .18); }
|
||||||
|
.client-sidebar-brand-mark img { display: block; width: 28px; height: 28px; object-fit: contain; }
|
||||||
|
.client-sidebar-brand-copy { display: flex; min-width: 0; flex-direction: column; gap: 2px; }
|
||||||
|
.client-sidebar-brand-copy strong { font-size: 15px; letter-spacing: .02em; line-height: 1.2; }
|
||||||
|
.client-sidebar-brand-copy small { color: rgba(255, 255, 255, .56); font-size: 10px; letter-spacing: .12em; }
|
||||||
|
.client-sidebar nav { display: flex; flex: 1; min-width: 0; min-height: 0; flex-direction: column; overflow-x: hidden; overflow-y: auto; scrollbar-color: rgba(206, 222, 238, .46) transparent; scrollbar-width: thin; }
|
||||||
|
.client-sidebar nav::-webkit-scrollbar { width: 10px; background: transparent; }
|
||||||
|
.client-sidebar nav::-webkit-scrollbar-track { background: transparent; }
|
||||||
|
.client-sidebar nav::-webkit-scrollbar-thumb { min-height: 40px; border: 3px solid transparent; border-radius: 999px; background: rgba(206, 222, 238, .46); background-clip: padding-box; }
|
||||||
|
.client-sidebar nav::-webkit-scrollbar-thumb:hover { background-color: rgba(235, 244, 252, .72); }
|
||||||
|
.client-sidebar nav::-webkit-scrollbar-button { display: none; width: 0; height: 0; }
|
||||||
|
.client-sidebar nav::-webkit-scrollbar-corner { background: transparent; }
|
||||||
.client-nav-menu,
|
.client-nav-menu,
|
||||||
.client-nav-submenu { min-width: 0; margin: 0; padding: 0; list-style: none; }
|
.client-nav-submenu { min-width: 0; margin: 0; padding: 0; list-style: none; }
|
||||||
.client-nav-menu { flex: 1; background: transparent; }
|
.client-nav-menu { flex: 1; background: transparent; }
|
||||||
.client-nav-submenu { padding-left: 37px; }
|
.client-nav-submenu { padding-left: 34px; }
|
||||||
.client-nav-node { min-width: 0; }
|
.client-nav-node { min-width: 0; }
|
||||||
|
.client-nav-node.has-divider-before { margin-top: 14px; padding-top: 14px; border-top: 1px solid rgba(255, 255, 255, .1); }
|
||||||
.client-sidebar-group-trigger,
|
.client-sidebar-group-trigger,
|
||||||
.client-sidebar-link { display: flex; width: 100%; height: 44px; min-width: 0; align-items: center; gap: 11px; margin: 2px 0; padding: 0 10px; border-radius: 8px; color: #52616b; }
|
.client-sidebar-link { display: flex; width: 100%; height: 44px; min-width: 0; align-items: center; gap: 11px; margin: 2px 0; padding: 0 10px; border-radius: 10px; color: rgba(255, 255, 255, .72); }
|
||||||
.client-sidebar-group-trigger { border: 0; background: transparent; cursor: pointer; text-align: left; }
|
.client-sidebar-group-trigger { border: 0; background: transparent; cursor: pointer; text-align: left; }
|
||||||
.client-sidebar-link { text-decoration: none; }
|
.client-sidebar-link { text-decoration: none; }
|
||||||
.client-sidebar-group-trigger:hover,
|
.client-sidebar-group-trigger:hover,
|
||||||
.client-sidebar-link:hover { background: #f2f7f6; color: var(--primary); }
|
.client-sidebar-link:hover { background: rgba(255, 255, 255, .08); color: #fff; }
|
||||||
.client-sidebar-link[aria-current="page"] { background: #e9f4f2; color: var(--primary); font-weight: 650; }
|
.client-sidebar-link[aria-current="page"] { background: linear-gradient(90deg, #1565c0, #1e88e5); box-shadow: 0 6px 18px rgba(21, 101, 192, .4); color: #fff; font-weight: 650; }
|
||||||
.client-nav-node.is-active-parent > .client-sidebar-group-trigger { background: #f2f7f6; color: var(--primary); font-weight: 600; }
|
.client-nav-node.is-active-parent > .client-sidebar-group-trigger { background: rgba(255, 255, 255, .08); color: #fff; font-weight: 600; }
|
||||||
.client-sidebar .client-sidebar-group-trigger svg,
|
.client-sidebar .client-sidebar-group-trigger svg,
|
||||||
.client-sidebar .client-sidebar-link svg { flex: 0 0 18px; }
|
.client-sidebar .client-sidebar-link svg { flex: 0 0 18px; }
|
||||||
.client-sidebar .client-sidebar-group-chevron { width: 16px; height: 16px; flex: 0 0 16px; margin-left: auto; transition: transform .2s ease; }
|
.client-sidebar .client-sidebar-group-chevron { width: 16px; height: 16px; flex: 0 0 16px; margin-left: auto; transition: transform .2s ease; }
|
||||||
@@ -35,10 +47,11 @@
|
|||||||
.client-sidebar-group-trigger:focus-visible,
|
.client-sidebar-group-trigger:focus-visible,
|
||||||
.client-sidebar-link:focus-visible,
|
.client-sidebar-link:focus-visible,
|
||||||
.client-header-menu-button:focus-visible,
|
.client-header-menu-button:focus-visible,
|
||||||
.client-sidebar-header button:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
|
.client-sidebar-brand button:focus-visible,
|
||||||
.client-sidebar-header,
|
.client-sidebar-logout:focus-visible { outline: 2px solid #8ed8cf; outline-offset: 2px; }
|
||||||
|
.client-sidebar-brand button,
|
||||||
.client-sidebar-scrim { display: none; }
|
.client-sidebar-scrim { display: none; }
|
||||||
.sidebar-help { display: flex; flex: 0 0 auto; flex-direction: column; gap: 4px; margin-top: 16px; padding: 14px; border-left: 3px solid var(--primary); background: #f2f7f6; }
|
.client-sidebar-logout { display: flex; width: 100%; height: 44px; align-items: center; justify-content: flex-start; gap: 11px; margin: 2px 0 0; padding: 0 10px; border: 0; border-radius: 10px; background: rgba(239, 68, 68, .12); color: #fca5a5; cursor: pointer; font-weight: 600; text-align: left; }
|
||||||
.sidebar-help strong { font-size: 12px; }
|
.client-sidebar-logout:hover { background: rgba(239, 68, 68, .22); color: #fff; }
|
||||||
.sidebar-help span { color: var(--muted); font-size: 11px; }
|
.client-sidebar-logout svg { flex: 0 0 18px; }
|
||||||
.client-main { width: calc(100% - 232px); max-width: 100%; min-height: 100vh; margin-left: 232px; padding: 88px 20px 40px; }
|
.client-main { width: calc(100% - 250px); max-width: 100%; min-height: 100vh; margin-left: 250px; padding: 88px 20px 40px; }
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import PrototypeFeatureView from '@/views/prototype/PrototypeFeatureView.vue'
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template><PrototypeFeatureView title="美国本土卡" description="创建美国本土卡车运输订单" /></template>
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import PrototypeFeatureView from '@/views/prototype/PrototypeFeatureView.vue'
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template><PrototypeFeatureView title="美本土散板" description="创建美国本土散板运输订单" /></template>
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import PrototypeFeatureView from '@/views/prototype/PrototypeFeatureView.vue'
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template><PrototypeFeatureView title="海外采购" description="管理海外采购订单" /></template>
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import PrototypeFeatureView from '@/views/prototype/PrototypeFeatureView.vue'
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template><PrototypeFeatureView title="应付账单" description="查询企业应付账单" /></template>
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import PrototypeFeatureView from '@/views/prototype/PrototypeFeatureView.vue'
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template><PrototypeFeatureView title="一键导入" description="批量导入头程订单" /></template>
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import PrototypeFeatureView from '@/views/prototype/PrototypeFeatureView.vue'
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template><PrototypeFeatureView title="快速下单" description="快速创建头程订单" /></template>
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import PrototypeFeatureView from '@/views/prototype/PrototypeFeatureView.vue'
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template><PrototypeFeatureView title="派送订单列表" description="查询海外仓派送订单" /></template>
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import PrototypeFeatureView from '@/views/prototype/PrototypeFeatureView.vue'
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template><PrototypeFeatureView title="入库订单列表" description="查询海外仓入库订单" /></template>
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import PrototypeFeatureView from '@/views/prototype/PrototypeFeatureView.vue'
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template><PrototypeFeatureView title="我的订单" description="统一查询各类业务订单" /></template>
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import PrototypeFeatureView from '@/views/prototype/PrototypeFeatureView.vue'
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template><PrototypeFeatureView title="贴标申请" description="提交海外仓贴标申请" /></template>
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import PrototypeFeatureView from '@/views/prototype/PrototypeFeatureView.vue'
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template><PrototypeFeatureView title="退货入库" description="登记海外仓退货入库" /></template>
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import PrototypeFeatureView from '@/views/prototype/PrototypeFeatureView.vue'
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template><PrototypeFeatureView title="退货出库" description="创建海外仓退货出库单" /></template>
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import PrototypeFeatureView from '@/views/prototype/PrototypeFeatureView.vue'
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template><PrototypeFeatureView title="退货换标" description="提交退货换标申请" /></template>
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
defineProps<{
|
||||||
|
title: string
|
||||||
|
description: string
|
||||||
|
}>()
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<section class="prototype-feature">
|
||||||
|
<div class="prototype-feature-empty">
|
||||||
|
<span>待接入</span>
|
||||||
|
<h2>{{ title }}</h2>
|
||||||
|
<p>{{ description }}的业务页面已建立,后续接入对应接口和操作流程。</p>
|
||||||
|
<RouterLink to="/">返回业务总览</RouterLink>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.prototype-feature { display: grid; min-height: calc(100vh - 128px); place-items: center; }
|
||||||
|
.prototype-feature-empty { display: flex; width: min(520px, 100%); flex-direction: column; align-items: center; padding: 40px 28px; border: 1px solid var(--border); background: #fff; text-align: center; }
|
||||||
|
.prototype-feature-empty span { color: var(--primary); font-size: 12px; font-weight: 700; }
|
||||||
|
.prototype-feature-empty h2 { margin: 12px 0 8px; color: var(--navy); font-size: 22px; }
|
||||||
|
.prototype-feature-empty p { max-width: 34ch; margin: 0; color: var(--muted); font-size: 13px; line-height: 1.7; }
|
||||||
|
.prototype-feature-empty a { margin-top: 22px; color: var(--primary); font-size: 13px; font-weight: 650; text-decoration: none; }
|
||||||
|
.prototype-feature-empty a:hover { text-decoration: underline; }
|
||||||
|
.prototype-feature-empty a:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; }
|
||||||
|
</style>
|
||||||
Reference in New Issue
Block a user