All checks were successful
Build and Deploy Front / deploy (push) Successful in 17m20s
同步支付宝支付前端能力与支付相关页面体验;登录/顶栏/官网进入时重新核对品牌资源。 Co-authored-by: Cursor <cursoragent@cursor.com>
1024 lines
25 KiB
Vue
1024 lines
25 KiB
Vue
<template>
|
||
<aside
|
||
class="customer-side-rail"
|
||
:class="{
|
||
'is-collapsed': collapsed,
|
||
'is-compact': compactLayout,
|
||
'is-animating': animating,
|
||
'is-resizing': resizing,
|
||
}"
|
||
:style="{
|
||
width: `${railWidth}px`,
|
||
'--csr-shell-width': `${expandedWidth}px`,
|
||
}"
|
||
aria-label="客户门户导航"
|
||
@transitionend="onRailTransitionEnd"
|
||
>
|
||
<!-- Linear/Notion:内层固定展开宽,外层只动画 width + overflow 裁切,避免内容重排跳动 -->
|
||
<div class="customer-side-rail__shell">
|
||
<a
|
||
class="customer-side-rail__brand"
|
||
href="/"
|
||
:title="brandCopy.navFullName"
|
||
@click.prevent="goOfficialSite"
|
||
>
|
||
<span class="customer-side-rail__brand-badge">
|
||
<img
|
||
v-if="navLogoSrc"
|
||
:src="navLogoSrc"
|
||
:alt="brandCopy.navName"
|
||
class="customer-side-rail__brand-logo"
|
||
/>
|
||
<span v-else class="customer-side-rail__brand-mark" aria-hidden="true">{{
|
||
BRAND_TEXT_LOGO
|
||
}}</span>
|
||
</span>
|
||
</a>
|
||
|
||
<div class="customer-side-rail__scroll">
|
||
<section
|
||
v-for="(group, groupIndex) in menuGroups"
|
||
:key="group.id"
|
||
class="customer-side-rail__group"
|
||
:class="{ 'is-first': groupIndex === 0 }"
|
||
>
|
||
<div
|
||
v-if="menuGroups.length > 1"
|
||
class="customer-side-rail__label customer-side-rail__fade"
|
||
>
|
||
{{ groupLabel(group) }}
|
||
</div>
|
||
<div
|
||
v-show="compactLayout && groupIndex > 0"
|
||
class="customer-side-rail__divider"
|
||
aria-hidden="true"
|
||
/>
|
||
|
||
<a-tooltip
|
||
v-for="item in group.items"
|
||
:key="navKey(item)"
|
||
:content="formatTitle(item)"
|
||
position="right"
|
||
>
|
||
<div class="customer-side-rail__item-wrap">
|
||
<button
|
||
type="button"
|
||
class="customer-side-rail__item"
|
||
:class="{ active: isActive(item) }"
|
||
:aria-current="isActive(item) ? 'page' : undefined"
|
||
:data-nav-path="getCustomerNavPath(item)"
|
||
@pointerenter="prefetch(item)"
|
||
@click="onNavigate(item)"
|
||
>
|
||
<span class="customer-side-rail__icon">
|
||
<component :is="getSubMenuIcon(item, undefined, MENU_NAME_TO_LOCALE_KEY)" />
|
||
</span>
|
||
<span class="customer-side-rail__text customer-side-rail__fade">
|
||
{{ formatTitle(item) }}
|
||
</span>
|
||
</button>
|
||
<button
|
||
v-if="!compactLayout && isActive(item)"
|
||
type="button"
|
||
class="customer-side-rail__refresh"
|
||
:class="{ 'is-spinning': refreshingPath === navKey(item) }"
|
||
:disabled="refreshingPath === navKey(item)"
|
||
:title="t('nav.sideRail.refresh')"
|
||
:aria-label="t('nav.sideRail.refresh')"
|
||
@click.stop="onRefresh(item)"
|
||
>
|
||
<icon-refresh class="customer-side-rail__refresh-ico" />
|
||
</button>
|
||
</div>
|
||
</a-tooltip>
|
||
</section>
|
||
</div>
|
||
|
||
<!-- 底栏:头像 + 收起(消息/打印/仓库已移至主区右上角) -->
|
||
<div class="customer-side-rail__dock">
|
||
<div
|
||
class="customer-side-rail__toolbar"
|
||
:class="{ 'is-account-active': isAccountRouteActive || isBalanceRouteActive }"
|
||
>
|
||
<div class="customer-side-rail__user">
|
||
<RightTopUser
|
||
variant="sider"
|
||
:compact="compactLayout"
|
||
dropdown-position="tl"
|
||
:account-menus="accountMenus"
|
||
/>
|
||
</div>
|
||
<button
|
||
type="button"
|
||
class="customer-side-rail__toggle"
|
||
:aria-label="collapsed ? t('nav.sideRail.expand') : t('nav.sideRail.collapse')"
|
||
:title="collapsed ? t('nav.sideRail.expand') : t('nav.sideRail.collapse')"
|
||
@click="toggleCollapsed"
|
||
>
|
||
<icon-right v-if="collapsed" class="customer-side-rail__toggle-icon" />
|
||
<icon-left v-else class="customer-side-rail__toggle-icon" />
|
||
</button>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- Linear/Notion:右侧拖拽调宽,便于英文等长文案 -->
|
||
<div
|
||
v-show="!collapsed"
|
||
class="customer-side-rail__resize"
|
||
role="separator"
|
||
aria-orientation="vertical"
|
||
:aria-valuenow="expandedWidth"
|
||
:aria-valuemin="CUSTOMER_SIDE_RAIL_MIN_WIDTH"
|
||
:aria-valuemax="CUSTOMER_SIDE_RAIL_MAX_WIDTH"
|
||
:title="t('nav.sideRail.resize')"
|
||
@pointerdown="onResizePointerDown"
|
||
/>
|
||
</aside>
|
||
</template>
|
||
|
||
<script lang="ts" setup>
|
||
import { computed, nextTick, onUnmounted, ref, watch } from 'vue'
|
||
import { useRoute, useRouter } from 'vue-router'
|
||
import { useI18n } from 'vue-i18n'
|
||
import {
|
||
IconLeft,
|
||
IconRefresh,
|
||
IconRight,
|
||
} from '@arco-design/web-vue/es/icon'
|
||
import { useTabBarStore } from '@/store'
|
||
import type { TagProps } from '@/store/modules/tab-bar/types'
|
||
import { pub } from '@/utils/pub'
|
||
import { useRbacUserStore } from '@/store/modules/rbac-user'
|
||
import { getSubMenuIcon } from '@/utils/menu-icon'
|
||
import { MENU_NAME_TO_LOCALE_KEY, translateMenuTitle } from '@/utils/menu-i18n'
|
||
import { openWindow, regexUrl } from '@/utils'
|
||
import { BRAND_TEXT_LOGO, brandLogoImages, ensureBrandAssetsFresh } from '@/utils/brandLogo'
|
||
import { brandCopy } from '@/utils/brandCopy'
|
||
import {
|
||
buildCustomerFlatNavMenus,
|
||
CUSTOMER_SIDE_RAIL_COLLAPSED_WIDTH,
|
||
CUSTOMER_SIDE_RAIL_EXPANDED_WIDTH,
|
||
CUSTOMER_SIDE_RAIL_MAX_WIDTH,
|
||
CUSTOMER_SIDE_RAIL_MIN_WIDTH,
|
||
getCustomerNavPath,
|
||
groupCustomerNavMenus,
|
||
isCustomerBalanceMenuPath,
|
||
matchCustomerActiveNavPath,
|
||
partitionCustomerNavMenus,
|
||
isCustomerAccountNavPath,
|
||
readCustomerSideRailCollapsed,
|
||
readCustomerSideRailExpandedWidth,
|
||
writeCustomerSideRailCollapsed,
|
||
writeCustomerSideRailExpandedWidth,
|
||
type CustomerNavGroup,
|
||
type CustomerNavItem,
|
||
} from '@/utils/customer-portal-nav'
|
||
import { resolvePortalDrawerPanel } from '@/views/user/portal-drawer/types'
|
||
import { openPortalSideDrawer } from '@/views/user/portal-drawer/usePortalSideDrawer'
|
||
import RightTopUser from '@/components/top-nav/RightTopUser.vue'
|
||
|
||
const { t, te, locale } = useI18n()
|
||
const route = useRoute()
|
||
const router = useRouter()
|
||
const rbacUserStore = useRbacUserStore()
|
||
const tabBarStore = useTabBarStore()
|
||
|
||
/** 与 CSS transition 时长一致(Linear 风格约 300ms) */
|
||
const RAIL_ANIM_MS = 300
|
||
|
||
const navLogoSrc = computed(() => brandLogoImages.portal)
|
||
ensureBrandAssetsFresh()
|
||
|
||
const collapsed = ref(readCustomerSideRailCollapsed(false))
|
||
/** 布局紧凑态:动画结束后再切,避免收起中途图标跳动 */
|
||
const compactLayout = ref(collapsed.value)
|
||
const animating = ref(false)
|
||
const resizing = ref(false)
|
||
const expandedWidth = ref(readCustomerSideRailExpandedWidth(CUSTOMER_SIDE_RAIL_EXPANDED_WIDTH))
|
||
/** 正在刷新的菜单 path,用于转圈与防连点 */
|
||
const refreshingPath = ref('')
|
||
let compactTimer = 0
|
||
let resizeStartX = 0
|
||
let resizeStartW = 0
|
||
|
||
const railWidth = computed(() =>
|
||
collapsed.value ? CUSTOMER_SIDE_RAIL_COLLAPSED_WIDTH : expandedWidth.value,
|
||
)
|
||
|
||
function clampExpandedWidth(width: number) {
|
||
return Math.min(
|
||
CUSTOMER_SIDE_RAIL_MAX_WIDTH,
|
||
Math.max(CUSTOMER_SIDE_RAIL_MIN_WIDTH, Math.round(width)),
|
||
)
|
||
}
|
||
|
||
function onResizePointerDown(e: PointerEvent) {
|
||
if (collapsed.value || e.button !== 0) return
|
||
e.preventDefault()
|
||
resizing.value = true
|
||
animating.value = false
|
||
resizeStartX = e.clientX
|
||
resizeStartW = expandedWidth.value
|
||
document.body.style.cursor = 'col-resize'
|
||
document.body.style.userSelect = 'none'
|
||
window.addEventListener('pointermove', onResizePointerMove)
|
||
window.addEventListener('pointerup', onResizePointerUp)
|
||
window.addEventListener('pointercancel', onResizePointerUp)
|
||
}
|
||
|
||
function onResizePointerMove(e: PointerEvent) {
|
||
if (!resizing.value) return
|
||
expandedWidth.value = clampExpandedWidth(resizeStartW + (e.clientX - resizeStartX))
|
||
}
|
||
|
||
function onResizePointerUp() {
|
||
window.removeEventListener('pointermove', onResizePointerMove)
|
||
window.removeEventListener('pointerup', onResizePointerUp)
|
||
window.removeEventListener('pointercancel', onResizePointerUp)
|
||
document.body.style.cursor = ''
|
||
document.body.style.userSelect = ''
|
||
if (!resizing.value) return
|
||
resizing.value = false
|
||
writeCustomerSideRailExpandedWidth(expandedWidth.value)
|
||
}
|
||
|
||
const flatMenus = computed(() => {
|
||
if (!rbacUserStore.isCustomerPortal()) return [] as CustomerNavItem[]
|
||
return buildCustomerFlatNavMenus(
|
||
rbacUserStore.menus || [],
|
||
rbacUserStore.loginPortalType,
|
||
)
|
||
})
|
||
|
||
/** 侧栏只留「办事」;资产与账户收进用户下拉 */
|
||
const menuGroups = computed(() =>
|
||
groupCustomerNavMenus(flatMenus.value, { foldAccountIntoUserMenu: true }),
|
||
)
|
||
|
||
/** 用户下拉:账户类入口,但去掉余额下拉已有的充值/流水等 */
|
||
const accountMenus = computed(() =>
|
||
partitionCustomerNavMenus(flatMenus.value).account.filter(
|
||
(item) => !isCustomerBalanceMenuPath(getCustomerNavPath(item)),
|
||
),
|
||
)
|
||
|
||
const activePath = computed(() =>
|
||
matchCustomerActiveNavPath(route.path, flatMenus.value),
|
||
)
|
||
|
||
const balanceOwnedPath = computed(() => {
|
||
const path = activePath.value || route.path
|
||
return isCustomerBalanceMenuPath(path) ? path : ''
|
||
})
|
||
|
||
/** 非资金类账户路由高亮用户区;资金类由余额入口承接 */
|
||
const isAccountRouteActive = computed(() => {
|
||
if (balanceOwnedPath.value) return false
|
||
return isCustomerAccountNavPath(activePath.value || route.path)
|
||
})
|
||
|
||
const isBalanceRouteActive = computed(() => !!balanceOwnedPath.value)
|
||
|
||
function groupLabel(group: CustomerNavGroup) {
|
||
if (te(group.labelKey)) return t(group.labelKey)
|
||
return group.labelFallback
|
||
}
|
||
|
||
function navKey(item: CustomerNavItem) {
|
||
return getCustomerNavPath(item) || String(item.id || item.name)
|
||
}
|
||
|
||
function formatTitle(item: CustomerNavItem) {
|
||
void locale.value
|
||
return translateMenuTitle(t, {
|
||
name: item.name,
|
||
route: item.route || item.path,
|
||
path: item.path || item.route,
|
||
meta: item.meta,
|
||
})
|
||
}
|
||
|
||
function isActive(item: CustomerNavItem) {
|
||
const path = getCustomerNavPath(item)
|
||
return !!path && path === activePath.value
|
||
}
|
||
|
||
function scrollActiveNavIntoView() {
|
||
if (!activePath.value || isAccountRouteActive.value) return
|
||
void nextTick(() => {
|
||
const el = document.querySelector(
|
||
`.customer-side-rail__item[data-nav-path="${CSS.escape(activePath.value)}"]`,
|
||
) as HTMLElement | null
|
||
el?.scrollIntoView({ block: 'nearest', behavior: 'smooth' })
|
||
})
|
||
}
|
||
|
||
function toggleCollapsed() {
|
||
const next = !collapsed.value
|
||
collapsed.value = next
|
||
writeCustomerSideRailCollapsed(next)
|
||
animating.value = true
|
||
|
||
if (compactTimer) {
|
||
window.clearTimeout(compactTimer)
|
||
compactTimer = 0
|
||
}
|
||
|
||
if (next) {
|
||
// 收起:先变窄 + 文案淡出,接近结束再切 compact
|
||
compactTimer = window.setTimeout(() => {
|
||
compactLayout.value = true
|
||
compactTimer = 0
|
||
}, Math.max(0, RAIL_ANIM_MS - 48))
|
||
} else {
|
||
// 展开:立刻退出 compact,让文案有空间淡入
|
||
compactLayout.value = false
|
||
}
|
||
}
|
||
|
||
function onRailTransitionEnd(e: TransitionEvent) {
|
||
if (e.target !== e.currentTarget) return
|
||
if (e.propertyName !== 'width') return
|
||
animating.value = false
|
||
compactLayout.value = collapsed.value
|
||
}
|
||
|
||
function goOfficialSite() {
|
||
window.location.href = '/'
|
||
}
|
||
|
||
function prefetch(item: CustomerNavItem) {
|
||
const rawPath = getCustomerNavPath(item)
|
||
if (!rawPath || regexUrl.test(rawPath)) return
|
||
const targetPath = rawPath.startsWith('/') ? rawPath : `/${rawPath}`
|
||
try {
|
||
const resolved = router.resolve(targetPath)
|
||
const rec = resolved.matched[resolved.matched.length - 1]
|
||
const loader = rec?.components?.default as unknown
|
||
if (typeof loader === 'function') {
|
||
const result = (loader as () => unknown)()
|
||
if (result && typeof (result as Promise<unknown>).then === 'function') {
|
||
;(result as Promise<unknown>).catch(() => undefined)
|
||
}
|
||
}
|
||
} catch {
|
||
// ignore
|
||
}
|
||
}
|
||
|
||
function onNavigate(item: CustomerNavItem) {
|
||
let targetPath = getCustomerNavPath(item)
|
||
if (!targetPath) return
|
||
if (!targetPath.startsWith('/') && !regexUrl.test(targetPath)) {
|
||
targetPath = `/${targetPath}`
|
||
}
|
||
if (regexUrl.test(targetPath)) {
|
||
openWindow(targetPath)
|
||
return
|
||
}
|
||
const portalPanel = resolvePortalDrawerPanel(targetPath)
|
||
if (portalPanel) {
|
||
openPortalSideDrawer(portalPanel)
|
||
return
|
||
}
|
||
if (router.currentRoute.value.path === targetPath) return
|
||
router.push(targetPath).catch(() => undefined)
|
||
}
|
||
|
||
function resolveRefreshCacheKey(targetPath: string) {
|
||
const resolved = router.resolve(targetPath)
|
||
const matchedName = resolved.matched.at(-1)?.name ?? resolved.name
|
||
if (matchedName) return String(matchedName)
|
||
return (resolved.path || '/').split('?')[0]
|
||
}
|
||
|
||
/** 侧栏菜单刷新:与顶栏页签同一套剔缓存 → bump key → 回填缓存 */
|
||
async function onRefresh(item: CustomerNavItem) {
|
||
let targetPath = getCustomerNavPath(item)
|
||
if (!targetPath || regexUrl.test(targetPath)) return
|
||
if (!targetPath.startsWith('/')) targetPath = `/${targetPath}`
|
||
if (refreshingPath.value === targetPath) return
|
||
|
||
refreshingPath.value = targetPath
|
||
try {
|
||
const portalPanel = resolvePortalDrawerPanel(targetPath)
|
||
if (portalPanel) {
|
||
openPortalSideDrawer(portalPanel)
|
||
return
|
||
}
|
||
|
||
if (router.currentRoute.value.path !== targetPath) {
|
||
await router.push(targetPath).catch(() => undefined)
|
||
}
|
||
|
||
const cacheKey = resolveRefreshCacheKey(targetPath)
|
||
if (!cacheKey) return
|
||
|
||
await nextTick()
|
||
tabBarStore.deleteCache({ name: cacheKey } as TagProps)
|
||
await nextTick()
|
||
tabBarStore.bumpRouteRefresh(cacheKey)
|
||
await nextTick()
|
||
|
||
const ignoreCache = !!router.currentRoute.value.meta?.ignoreCache
|
||
if (!ignoreCache) {
|
||
tabBarStore.addCache(cacheKey)
|
||
}
|
||
|
||
pub('page:refresh', {
|
||
routeName: cacheKey,
|
||
fullPath: router.currentRoute.value.fullPath,
|
||
})
|
||
} finally {
|
||
window.setTimeout(() => {
|
||
if (refreshingPath.value === targetPath) refreshingPath.value = ''
|
||
}, 420)
|
||
}
|
||
}
|
||
|
||
watch(
|
||
() => rbacUserStore.isCustomerPortal(),
|
||
(ok) => {
|
||
if (!ok) return
|
||
collapsed.value = readCustomerSideRailCollapsed(false)
|
||
compactLayout.value = collapsed.value
|
||
},
|
||
)
|
||
|
||
watch(activePath, () => {
|
||
scrollActiveNavIntoView()
|
||
}, { immediate: true })
|
||
|
||
onUnmounted(() => {
|
||
if (compactTimer) {
|
||
window.clearTimeout(compactTimer)
|
||
compactTimer = 0
|
||
}
|
||
onResizePointerUp()
|
||
})
|
||
</script>
|
||
|
||
<style lang="less" scoped>
|
||
.customer-side-rail {
|
||
--csr-pad-x: 8px;
|
||
--csr-item-h: 44px;
|
||
/* 菜单项圆角;外壳不再做白底卡片 */
|
||
--csr-radius: 10px;
|
||
--csr-panel-inset: 16px;
|
||
--csr-panel-inset-left: 8px;
|
||
--csr-shell-width: 156px;
|
||
--csr-ease: cubic-bezier(0.32, 0.72, 0, 1);
|
||
--csr-dur: 0.3s;
|
||
|
||
flex-shrink: 0;
|
||
align-self: stretch;
|
||
box-sizing: border-box;
|
||
height: calc(100% - var(--csr-panel-inset) * 2);
|
||
margin: var(--csr-panel-inset) 0 var(--csr-panel-inset) var(--csr-panel-inset-left);
|
||
min-height: 0;
|
||
overflow: hidden;
|
||
background: transparent;
|
||
border-radius: 0;
|
||
box-shadow: none;
|
||
position: relative;
|
||
/* 外层只动画宽度;内容在 shell 内固定宽,不随变窄重排(Linear / Notion) */
|
||
transition: width var(--csr-dur) var(--csr-ease);
|
||
will-change: width;
|
||
z-index: 10;
|
||
|
||
&.is-resizing {
|
||
transition: none;
|
||
will-change: width;
|
||
}
|
||
|
||
@media (prefers-reduced-motion: reduce) {
|
||
--csr-dur: 0.01ms;
|
||
}
|
||
|
||
&__resize {
|
||
position: absolute;
|
||
top: 10px;
|
||
right: -3px;
|
||
bottom: 10px;
|
||
width: 6px;
|
||
z-index: 3;
|
||
cursor: col-resize;
|
||
touch-action: none;
|
||
border-radius: 999px;
|
||
|
||
&::after {
|
||
content: '';
|
||
position: absolute;
|
||
top: 50%;
|
||
left: 2px;
|
||
width: 2px;
|
||
height: 28px;
|
||
margin-top: -14px;
|
||
border-radius: 1px;
|
||
background: transparent;
|
||
transition: background-color 0.15s ease;
|
||
}
|
||
|
||
&:hover::after,
|
||
.customer-side-rail.is-resizing &::after {
|
||
background: color-mix(in srgb, var(--app-primary-color, #1d7281) 55%, transparent);
|
||
}
|
||
}
|
||
|
||
&__shell {
|
||
width: var(--csr-shell-width);
|
||
height: 100%;
|
||
min-height: 0;
|
||
display: flex;
|
||
flex-direction: column;
|
||
box-sizing: border-box;
|
||
}
|
||
|
||
/* 文案:收起先淡出,展开略延迟淡入 */
|
||
&__fade {
|
||
opacity: 1;
|
||
transform: translateX(0);
|
||
transition:
|
||
opacity 0.18s ease,
|
||
transform 0.18s var(--csr-ease);
|
||
}
|
||
|
||
&.is-collapsed &__fade {
|
||
opacity: 0;
|
||
transform: translateX(-6px);
|
||
pointer-events: none;
|
||
transition-duration: 0.12s;
|
||
transition-timing-function: ease-in;
|
||
}
|
||
|
||
&:not(.is-collapsed) &__fade {
|
||
transition-delay: 0.1s;
|
||
}
|
||
|
||
&__brand {
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
gap: 0;
|
||
flex-shrink: 0;
|
||
box-sizing: border-box;
|
||
height: 48px;
|
||
min-height: 48px;
|
||
padding: 0 8px;
|
||
color: inherit;
|
||
text-decoration: none;
|
||
border: none;
|
||
}
|
||
|
||
&__brand-badge {
|
||
display: inline-flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
width: 72px;
|
||
height: 42px;
|
||
flex-shrink: 0;
|
||
border-radius: 999px;
|
||
background: rgba(26, 46, 56, 0.05);
|
||
overflow: hidden;
|
||
line-height: 0;
|
||
}
|
||
|
||
&__brand-logo {
|
||
display: block;
|
||
width: 36px;
|
||
height: 36px;
|
||
flex-shrink: 0;
|
||
object-fit: contain;
|
||
border: none;
|
||
border-radius: 0;
|
||
image-rendering: -webkit-optimize-contrast;
|
||
}
|
||
|
||
&__brand-mark {
|
||
font-size: 14px;
|
||
font-weight: 700;
|
||
letter-spacing: 0.08em;
|
||
line-height: 1;
|
||
color: var(--color-text-3, #86909c);
|
||
user-select: none;
|
||
}
|
||
|
||
&__scroll {
|
||
flex: 1;
|
||
min-height: 0;
|
||
overflow-x: hidden;
|
||
overflow-y: auto;
|
||
padding: 14px var(--csr-pad-x) 12px;
|
||
display: flex;
|
||
flex-direction: column;
|
||
gap: 2px;
|
||
scrollbar-width: thin;
|
||
}
|
||
|
||
&__group {
|
||
display: flex;
|
||
flex-direction: column;
|
||
gap: 4px;
|
||
|
||
&:not(.is-first) {
|
||
margin-top: 4px;
|
||
padding-top: 8px;
|
||
border-top: 1px solid var(--color-border-2, rgba(0, 0, 0, 0.06));
|
||
}
|
||
}
|
||
|
||
&__label {
|
||
padding: 0 8px 4px;
|
||
font-size: 11px;
|
||
font-weight: 600;
|
||
letter-spacing: 0.04em;
|
||
color: var(--color-text-3);
|
||
line-height: 1.2;
|
||
user-select: none;
|
||
}
|
||
|
||
&__divider {
|
||
width: 22px;
|
||
height: 1px;
|
||
margin: 8px auto 10px;
|
||
background: var(--color-border-2, rgba(0, 0, 0, 0.08));
|
||
}
|
||
|
||
&__item-wrap {
|
||
position: relative;
|
||
width: 100%;
|
||
}
|
||
|
||
&__refresh {
|
||
position: absolute;
|
||
right: 4px;
|
||
top: 50%;
|
||
z-index: 1;
|
||
display: inline-flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
width: 24px;
|
||
height: 24px;
|
||
margin: 0;
|
||
padding: 0;
|
||
border: none;
|
||
border-radius: 999px;
|
||
background: rgba(26, 46, 56, 0.05);
|
||
color: var(--color-text-3);
|
||
line-height: 0;
|
||
cursor: pointer;
|
||
opacity: 0;
|
||
pointer-events: none;
|
||
transform: translateY(-50%) scale(0.92);
|
||
transition:
|
||
opacity 0.16s ease,
|
||
color 0.14s ease,
|
||
background-color 0.14s ease,
|
||
transform 0.16s ease;
|
||
|
||
&:hover:not(:disabled) {
|
||
color: var(--color-text-1);
|
||
background: rgba(26, 46, 56, 0.1);
|
||
}
|
||
|
||
&:disabled,
|
||
&.is-spinning {
|
||
opacity: 1;
|
||
pointer-events: none;
|
||
color: #f56668;
|
||
background: color-mix(in srgb, #f56668 12%, #fff);
|
||
transform: translateY(-50%) scale(1);
|
||
}
|
||
}
|
||
|
||
&__refresh-ico {
|
||
display: block;
|
||
width: 14px;
|
||
height: 14px;
|
||
font-size: 14px;
|
||
}
|
||
|
||
&__refresh.is-spinning &__refresh-ico {
|
||
animation: csr-refresh-spin 0.7s linear infinite;
|
||
}
|
||
|
||
/* 仅当前页:悬停行时露出刷新圆钮 */
|
||
&__item-wrap:hover &__refresh:not(:disabled) {
|
||
opacity: 1;
|
||
pointer-events: auto;
|
||
transform: translateY(-50%) scale(1);
|
||
}
|
||
|
||
@keyframes csr-refresh-spin {
|
||
to {
|
||
transform: rotate(360deg);
|
||
}
|
||
}
|
||
|
||
@media (prefers-reduced-motion: reduce) {
|
||
&__refresh.is-spinning &__refresh-ico {
|
||
animation: none;
|
||
}
|
||
}
|
||
|
||
&__item {
|
||
position: relative;
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 8px;
|
||
width: 100%;
|
||
min-height: var(--csr-item-h);
|
||
padding: 0 8px 0 4px;
|
||
border: none;
|
||
border-radius: 10px;
|
||
background: transparent;
|
||
color: var(--color-text-2);
|
||
cursor: pointer;
|
||
text-align: left;
|
||
box-shadow: none;
|
||
transition:
|
||
background-color 0.16s ease,
|
||
color 0.16s ease;
|
||
|
||
&:hover {
|
||
color: var(--color-text-1);
|
||
background: rgba(15, 23, 42, 0.04);
|
||
}
|
||
|
||
/* 选中:珊瑚红圆底包图标;右侧给刷新钮留位 */
|
||
&.active {
|
||
color: var(--color-text-1);
|
||
background: transparent;
|
||
font-weight: 600;
|
||
box-shadow: none;
|
||
padding-right: 30px;
|
||
|
||
.customer-side-rail__icon {
|
||
color: #fff;
|
||
background: #f56668;
|
||
}
|
||
|
||
.customer-side-rail__text {
|
||
color: var(--color-text-1);
|
||
}
|
||
|
||
&:hover {
|
||
background: rgba(15, 23, 42, 0.04);
|
||
}
|
||
}
|
||
}
|
||
|
||
&__icon {
|
||
display: inline-flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
width: 28px;
|
||
height: 28px;
|
||
flex-shrink: 0;
|
||
border-radius: 999px;
|
||
font-size: 16px;
|
||
line-height: 0;
|
||
color: var(--color-text-3);
|
||
background: rgba(26, 46, 56, 0.05);
|
||
transition:
|
||
color 0.16s ease,
|
||
background-color 0.16s ease;
|
||
|
||
:deep(.arco-icon) {
|
||
display: block;
|
||
width: 16px;
|
||
height: 16px;
|
||
}
|
||
}
|
||
|
||
&__item:hover:not(.active) &__icon {
|
||
color: var(--color-text-1);
|
||
background: rgba(26, 46, 56, 0.09);
|
||
}
|
||
|
||
&__text {
|
||
flex: 1;
|
||
min-width: 0;
|
||
overflow: hidden;
|
||
text-overflow: ellipsis;
|
||
white-space: nowrap;
|
||
font-size: 14px;
|
||
line-height: 1.35;
|
||
}
|
||
|
||
&__dock {
|
||
flex-shrink: 0;
|
||
display: flex;
|
||
flex-direction: column;
|
||
gap: 0;
|
||
padding: 8px var(--csr-pad-x) 12px;
|
||
border-top: 1px solid var(--color-border-2, rgba(0, 0, 0, 0.06));
|
||
}
|
||
|
||
/* 底栏:头像 + 收起 */
|
||
&__toolbar {
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: space-between;
|
||
gap: 4px;
|
||
min-width: 0;
|
||
width: 100%;
|
||
padding: 2px 4px;
|
||
border-radius: 8px;
|
||
background: transparent;
|
||
|
||
&.is-account-active {
|
||
:deep(.user-dropdown-trigger) {
|
||
color: var(--app-primary-color, rgb(var(--primary-6)));
|
||
}
|
||
}
|
||
}
|
||
|
||
&__user {
|
||
display: flex;
|
||
align-items: center;
|
||
flex: 1;
|
||
min-width: 0;
|
||
|
||
:deep(.user-dropdown-trigger) {
|
||
width: 100%;
|
||
max-width: none;
|
||
height: 40px;
|
||
padding: 0 8px 0 4px;
|
||
margin: 0;
|
||
gap: 10px;
|
||
justify-content: flex-start;
|
||
color: var(--color-text-1);
|
||
border-radius: 10px;
|
||
}
|
||
|
||
:deep(.user-avatar) {
|
||
width: 32px;
|
||
height: 32px;
|
||
}
|
||
|
||
:deep(.user-avatar--fallback) {
|
||
font-size: 14px;
|
||
}
|
||
|
||
:deep(.user-name) {
|
||
max-width: none;
|
||
flex: 1;
|
||
min-width: 0;
|
||
font-size: 14px;
|
||
font-weight: 600;
|
||
color: var(--color-text-1);
|
||
}
|
||
|
||
:deep(.user-dropdown-trigger:hover) {
|
||
background: rgba(15, 23, 42, 0.04);
|
||
}
|
||
}
|
||
|
||
&__toggle {
|
||
display: inline-flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
flex-shrink: 0;
|
||
width: 28px;
|
||
height: 28px;
|
||
padding: 0;
|
||
border: none;
|
||
border-radius: 999px;
|
||
background: rgba(26, 46, 56, 0.05);
|
||
color: var(--color-text-3);
|
||
cursor: pointer;
|
||
line-height: 0;
|
||
transition: color 0.14s ease, background-color 0.14s ease;
|
||
|
||
&:hover {
|
||
color: var(--color-text-1);
|
||
background: rgba(26, 46, 56, 0.09);
|
||
}
|
||
}
|
||
|
||
&__toggle-icon {
|
||
display: block;
|
||
width: 14px;
|
||
height: 14px;
|
||
font-size: 14px;
|
||
}
|
||
|
||
/*
|
||
* compact:动画结束后切真窄轨。
|
||
* shell 跟随外层宽度,图标/选中态水平居中(不再靠 200px 裁切)。
|
||
*/
|
||
&.is-compact {
|
||
.customer-side-rail__shell {
|
||
width: 100%;
|
||
}
|
||
|
||
.customer-side-rail__brand {
|
||
justify-content: center;
|
||
gap: 0;
|
||
padding: 0;
|
||
height: 48px;
|
||
min-height: 48px;
|
||
width: 100%;
|
||
}
|
||
|
||
.customer-side-rail__brand-badge {
|
||
width: 72px;
|
||
height: 42px;
|
||
}
|
||
|
||
.customer-side-rail__scroll {
|
||
padding: 10px 0 8px;
|
||
align-items: center;
|
||
gap: 4px;
|
||
}
|
||
|
||
.customer-side-rail__group {
|
||
width: 100%;
|
||
align-items: center;
|
||
gap: 4px;
|
||
|
||
&:not(.is-first) {
|
||
margin-top: 4px;
|
||
padding-top: 0;
|
||
border-top: none;
|
||
}
|
||
}
|
||
|
||
.customer-side-rail__label {
|
||
display: none;
|
||
}
|
||
|
||
.customer-side-rail__divider {
|
||
margin: 4px auto 6px;
|
||
}
|
||
|
||
.customer-side-rail__item-wrap {
|
||
width: 40px;
|
||
}
|
||
|
||
.customer-side-rail__item {
|
||
width: 40px;
|
||
min-height: 40px;
|
||
padding: 0;
|
||
gap: 0;
|
||
justify-content: center;
|
||
border-radius: var(--csr-radius);
|
||
|
||
&:hover {
|
||
background: rgba(15, 23, 42, 0.04);
|
||
}
|
||
|
||
&.active {
|
||
background: transparent;
|
||
box-shadow: none;
|
||
}
|
||
}
|
||
|
||
.customer-side-rail__text {
|
||
display: none;
|
||
}
|
||
|
||
.customer-side-rail__dock {
|
||
align-items: center;
|
||
padding: 8px 0 10px;
|
||
}
|
||
|
||
.customer-side-rail__toolbar {
|
||
width: 40px;
|
||
flex-direction: column;
|
||
align-items: center;
|
||
gap: 2px;
|
||
padding: 2px;
|
||
}
|
||
|
||
.customer-side-rail__user {
|
||
width: 36px;
|
||
flex: 0 0 auto;
|
||
justify-content: center;
|
||
|
||
:deep(.user-dropdown-trigger),
|
||
:deep(.user-dropdown-trigger.is-compact) {
|
||
width: 36px;
|
||
height: 36px;
|
||
padding: 0;
|
||
justify-content: center;
|
||
}
|
||
|
||
:deep(.user-avatar) {
|
||
width: 28px;
|
||
height: 28px;
|
||
}
|
||
}
|
||
|
||
.customer-side-rail__toggle {
|
||
width: 28px;
|
||
height: 28px;
|
||
padding: 0;
|
||
}
|
||
}
|
||
}
|
||
|
||
</style>
|