Files
JayuCloud/FD-Frontend/src/views/admin/AdminLayout.vue
T

1197 lines
32 KiB
Vue
Raw Normal View History

<template>
<div
class="admin-layout"
:class="{
'admin-layout--mobile': isMobile,
'admin-layout--collapsed': collapsed && !isMobile
}"
>
<template v-if="!isMobile">
<a-layout>
<a-layout-sider
v-model:collapsed="collapsed"
:trigger="null"
collapsible
class="sider"
:width="240"
:collapsed-width="80"
>
<div class="logo">
2026-06-24 22:13:00 +08:00
<h1 v-if="!collapsed">{{ BRAND_CONFIG.adminAppName }}</h1>
<h1 v-else>{{ BRAND_CONFIG.appShortName }}</h1>
</div>
<a-menu
:selectedKeys="selectedKeys"
mode="inline"
theme="dark"
@click="handleMenuClick"
>
<a-menu-item
v-for="item in filteredMenuItems"
:key="item.key"
>
<template #icon>
<component :is="item.icon" />
</template>
<span>{{ item.label }}</span>
</a-menu-item>
</a-menu>
</a-layout-sider>
<a-layout>
<a-layout-header class="header">
<div class="header-shell">
<div class="header-left">
<MenuUnfoldOutlined v-if="collapsed" class="trigger" @click="toggleCollapsed" />
<MenuFoldOutlined v-else class="trigger" @click="toggleCollapsed" />
<div v-if="isBootstrapAdmin" class="shop-hint">
<span>平台总览模式:用户、店铺、权限、消息、公告和参数可管理,其它店铺业务仅查看</span>
<a-button type="link" @click="router.push('/admin/shops')">店铺管理</a-button>
</div>
<div v-else-if="shopOptions.length > 1" class="shop-switcher">
<span class="shop-switcher-label">当前门店</span>
<a-select
v-model:value="selectedShopId"
class="shop-select"
:options="shopSelectOptions"
:loading="shopSwitchLoading"
@change="handleShopChange"
/>
</div>
<div v-else class="shop-pill">
<ShopOutlined />
<span>{{ currentShopName }}</span>
</div>
</div>
<div class="header-right">
<a-dropdown>
<a class="user-dropdown" @click.prevent>
<a-avatar :size="32" :src="userInfo?.avatar || DEFAULT_AVATAR" />
<span class="username">{{ userInfo?.nickname || '管理员' }}</span>
<DownOutlined />
</a>
<template #overlay>
<a-menu>
<a-menu-item key="home" @click="router.push('/admin')">
<template #icon>
<UserOutlined />
</template>
工作台
</a-menu-item>
<a-menu-item key="profile" @click="router.push('/admin/profile')">
<template #icon>
<IdcardOutlined />
</template>
我的
</a-menu-item>
<a-menu-divider />
<a-menu-item key="logout" @click="handleLogout">
<template #icon>
<LogoutOutlined />
</template>
退出登录
</a-menu-item>
</a-menu>
</template>
</a-dropdown>
</div>
</div>
</a-layout-header>
<a-layout-content class="content">
<div class="content-shell">
<router-view />
</div>
</a-layout-content>
</a-layout>
</a-layout>
</template>
<template v-else>
2026-05-29 13:30:56 +08:00
<div class="mobile-shell mobile-shell--no-tabbar">
<header class="mobile-topbar">
2026-05-29 13:30:56 +08:00
<button class="mobile-icon-btn" type="button" aria-label="打开后台导航" @click="mobileDrawerOpen = true">
<MenuOutlined />
</button>
<div class="mobile-title-block">
<span class="mobile-eyebrow">{{ currentMobileSectionLabel }}</span>
<strong class="mobile-title">{{ currentMobileTitle }}</strong>
</div>
2026-05-29 13:30:56 +08:00
<div class="mobile-topbar__actions">
<span class="mobile-role-pill">{{ roleLabel }}</span>
<button class="mobile-avatar-btn" type="button" aria-label="打开账号信息" @click="router.push('/admin/profile')">
<a-avatar :size="32" :src="userInfo?.avatar || DEFAULT_AVATAR" />
</button>
</div>
</header>
<main class="mobile-content">
<router-view />
</main>
<a-drawer
v-model:open="mobileDrawerOpen"
placement="left"
:width="320"
class="mobile-drawer"
:closable="false"
root-class-name="admin-mobile-drawer"
>
<div class="drawer-account">
<a-avatar :size="46" :src="userInfo?.avatar || DEFAULT_AVATAR" />
<div class="drawer-account__body">
<div class="drawer-account__title">{{ userInfo?.nickname || userInfo?.account || '后台账号' }}</div>
<div class="drawer-account__meta">{{ roleLabel }}</div>
</div>
</div>
<div class="drawer-shop-card">
<span class="drawer-shop-card__label">当前门店</span>
<strong class="drawer-shop-card__value">{{ currentShopName }}</strong>
<p class="drawer-shop-card__desc">{{ shopScopeText }}</p>
<a-button type="default" block @click="openProfileFromDrawer">
{{ shopOptions.length > 1 ? '切换门店' : '查看账号信息' }}
</a-button>
</div>
<div class="drawer-section">
<div class="drawer-section__title">二级模块</div>
<button
v-for="item in filteredMenuItems"
:key="item.key"
class="drawer-link"
type="button"
@click="openPathFromDrawer(item.key)"
>
<div class="drawer-link__icon">
<component :is="item.icon" />
</div>
<div class="drawer-link__body">
<div class="drawer-link__title">{{ item.label }}</div>
</div>
<RightOutlined class="drawer-link__arrow" />
</button>
</div>
<div class="drawer-section">
<div class="drawer-section__title">会话操作</div>
<a-space direction="vertical" style="width: 100%">
<a-button block @click="openPathFromDrawer('/admin/profile')">打开我的</a-button>
<a-button block danger @click="handleLogout">退出当前账号</a-button>
</a-space>
</div>
</a-drawer>
</div>
</template>
</div>
</template>
<script setup lang="ts">
/**
* AdminLayout page script.
* Call guide: the template binds the reactive state below, and the methods are triggered by button clicks, lifecycle hooks, or router events.
*/
import { computed, onMounted, ref, watch } from 'vue'
import { useRoute, useRouter } from 'vue-router'
import {
DashboardOutlined,
DownOutlined,
GiftOutlined,
HomeOutlined,
CalendarOutlined,
IdcardOutlined,
LogoutOutlined,
MessageOutlined,
MenuFoldOutlined,
MenuOutlined,
MenuUnfoldOutlined,
RightOutlined,
SafetyCertificateOutlined,
ShopOutlined,
ShoppingOutlined,
ToolOutlined,
TagOutlined,
TeamOutlined,
UserOutlined
} from '@ant-design/icons-vue'
import { message, Modal } from 'ant-design-vue'
import type { Component } from 'vue'
2026-05-23 18:44:57 +08:00
/**
* Purpose: UserVO supports AdminLayout.vue by holding or executing the user vo page or API role.
* Usage: import, call, read, or update this type from the owning page/module while preserving the surrounding loading and permission flow.
*/
import { adminAuthApi, type UserVO } from '@/api/admin'
import { DEFAULT_AVATAR } from '@/constants'
import { usePermission } from '@/utils/permission'
import { isAllowedForShoplessPlatformAdmin } from '@/utils/platform-admin-permissions'
import { runWithGlobalLoading } from '@/utils/action-loading'
2026-05-29 13:30:56 +08:00
import { notifyShopThemeChanged } from '@/utils/shop-theme'
import { useAdminViewport } from '@/composables/useAdminViewport'
import { adminNavigationItems, findAdminNavigationItemByPath, type AdminNavIconKey } from '@/config/admin-navigation'
2026-06-24 22:13:00 +08:00
import { BRAND_CONFIG } from '@/config/brand'
import {
getAdminCurrentShopName,
getAdminRoleLabel,
getAdminShopOptions,
isBootstrapAdminUser
} from './admin-helpers'
2026-05-23 18:44:57 +08:00
/**
* Purpose: router supports AdminLayout.vue by holding or executing the router page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const router = useRouter()
2026-05-23 18:44:57 +08:00
/**
* Purpose: route supports AdminLayout.vue by holding or executing the route page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const route = useRoute()
const { isMobile } = useAdminViewport()
/** collapsed is a reactive state variable used by the template and event handlers. */
const collapsed = ref(false)
/** mobileDrawerOpen is a reactive state variable used by the template and event handlers. */
const mobileDrawerOpen = ref(false)
2026-05-23 18:44:57 +08:00
/**
* Purpose: userInfo supports AdminLayout.vue by holding or executing the user info page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const userInfo = ref<UserVO | null>(null)
2026-05-23 18:44:57 +08:00
/**
* Purpose: selectedKeys supports AdminLayout.vue by holding or executing the selected keys page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const selectedKeys = ref<string[]>([route.path])
2026-05-23 18:44:57 +08:00
/**
* Purpose: selectedShopId supports AdminLayout.vue by holding or executing the selected shop id page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const selectedShopId = ref<string>()
/** shopSwitchLoading is a reactive state variable used by the template and event handlers. */
const shopSwitchLoading = ref(false)
const { loadUserPermissions, hasPermission, clearPermissions, userPermissions } = usePermission()
const adminMenuIconMap: Record<AdminNavIconKey, Component> = {
home: HomeOutlined,
dashboard: DashboardOutlined,
user: UserOutlined,
shop: ShopOutlined,
gift: GiftOutlined,
message: MessageOutlined,
security: SafetyCertificateOutlined,
tag: TagOutlined,
shopping: ShoppingOutlined,
calendar: CalendarOutlined,
tool: ToolOutlined,
team: TeamOutlined
}
const menuItems = adminNavigationItems.map(item => ({
key: item.path,
icon: adminMenuIconMap[item.iconKey],
label: item.label,
permissionCode: item.permissionCode
}))
/** isBootstrapAdmin is a reactive state variable used by the template and event handlers. */
const isBootstrapAdmin = computed(() => isBootstrapAdminUser(userInfo.value))
/** isShopAuthorizationExpired is a reactive state variable used by the template and event handlers. */
const isShopAuthorizationExpired = computed(() => Boolean(userInfo.value?.shopAuthorizationExpired))
/** shopOptions is a reactive state variable used by the template and event handlers. */
const shopOptions = computed(() => getAdminShopOptions(userInfo.value))
/** shopSelectOptions is a reactive state variable used by the template and event handlers. */
const shopSelectOptions = computed(() => {
const options = shopOptions.value.map(shop => ({ label: shop.name, value: shop.id }))
return options
})
/** currentShopName is a reactive state variable used by the template and event handlers. */
const currentShopName = computed(() => getAdminCurrentShopName(userInfo.value))
/** roleLabel is a reactive state variable used by the template and event handlers. */
const roleLabel = computed(() => getAdminRoleLabel(userInfo.value?.type))
/** shopScopeText is a reactive state variable used by the template and event handlers. */
const shopScopeText = computed(() => {
if (!shopOptions.value.length) {
return isBootstrapAdmin.value ? '平台总览模式' : '游客模式'
}
return `可登录门店:${shopOptions.value.map(shop => shop.name).join(' / ')}`
})
/** filteredMenuItems is a reactive state variable used by the template and event handlers. */
const filteredMenuItems = computed(() => {
userPermissions.value
let visibleItems = menuItems.filter(item => {
if (!item.permissionCode) {
return true
}
if (isBootstrapAdmin.value) {
return isAllowedForShoplessPlatformAdmin(item.permissionCode)
}
return hasPermission(item.permissionCode)
})
if (isShopAuthorizationExpired.value && userInfo.value?.type !== 4) {
visibleItems = visibleItems.filter(item => item.key === '/admin')
}
return visibleItems
})
/** currentMobileSectionLabel is a reactive state variable used by the template and event handlers. */
const currentMobileSectionLabel = computed(() => {
2026-05-29 13:30:56 +08:00
if (route.path.startsWith('/admin/orders')) {
return '订单'
}
2026-05-29 13:30:56 +08:00
if (route.path.startsWith('/admin/profile')) {
return '我的'
}
if (route.path !== '/admin') {
return '经营'
}
return '工作台'
})
/** currentMobileTitle is a reactive state variable used by the template and event handlers. */
const currentMobileTitle = computed(() => {
const currentMenu = findAdminNavigationItemByPath(route.path)
if (currentMenu) {
return currentMenu.label
}
if (route.path === '/admin/manage') {
return '经营模块'
}
if (route.path === '/admin/profile') {
return '账号与门店'
}
return '后台管理'
})
/** persistAdminSession is a local helper used by this page script. */
const persistAdminSession = (payload: any) => {
localStorage.setItem('adminAccessToken', payload.accessToken)
localStorage.setItem('adminRefreshToken', payload.refreshToken)
localStorage.setItem('adminUserInfo', JSON.stringify(payload.userInfo))
sessionStorage.setItem('adminAccessToken', payload.accessToken)
}
/** toggleCollapsed is a local helper used by this page script. */
const toggleCollapsed = () => {
collapsed.value = !collapsed.value
}
/** handleMenuClick is a local helper used by this page script. */
const handleMenuClick = (info: any) => {
if (isShopAuthorizationExpired.value && userInfo.value?.type !== 4 && info.key !== '/admin') {
message.warning('授权已到期,请联系管理员')
return
}
router.push(info.key)
}
/** openPathFromDrawer is a local helper used by this page script. */
const openPathFromDrawer = (path: string) => {
if (isShopAuthorizationExpired.value && userInfo.value?.type !== 4 && path !== '/admin' && path !== '/admin/profile') {
message.warning('授权已到期,请联系管理员')
return
}
mobileDrawerOpen.value = false
router.push(path)
}
/** openProfileFromDrawer is a local helper used by this page script. */
const openProfileFromDrawer = () => {
openPathFromDrawer('/admin/profile')
}
/** handleLogout is a local helper used by this page script. */
const handleLogout = () => {
Modal.confirm({
title: '确认退出登录',
content: '退出后需要重新登录后台。',
okText: '确认',
cancelText: '取消',
onOk: async () => {
await runWithGlobalLoading(async () => {
try {
await adminAuthApi.logout()
} catch (error) {
console.error('退出失败:', error)
} finally {
localStorage.removeItem('adminAccessToken')
localStorage.removeItem('adminRefreshToken')
localStorage.removeItem('adminUserInfo')
localStorage.removeItem('accessToken')
localStorage.removeItem('refreshToken')
localStorage.removeItem('userInfo')
sessionStorage.removeItem('adminAccessToken')
sessionStorage.removeItem('accessToken')
clearPermissions()
message.success('已退出登录')
window.location.href = '/admin/login'
}
})
}
})
}
/** fetchUserInfo is an async page action. Trigger it from the template or lifecycle hook, then await the result. */
const fetchUserInfo = async () => {
try {
const cache = localStorage.getItem('adminUserInfo')
if (cache) {
userInfo.value = JSON.parse(cache)
}
if (!userInfo.value) {
return
}
selectedShopId.value = userInfo.value.shopId ? String(userInfo.value.shopId) : undefined
} catch (error) {
console.error('获取后台用户信息失败:', error)
}
}
/** handleShopChange is an async page action. Trigger it from the template or lifecycle hook, then await the result. */
const handleShopChange = async (shopId: unknown) => {
if (typeof shopId !== 'string' && typeof shopId !== 'number') {
return
}
const normalizedShopId = String(shopId)
if (!normalizedShopId || normalizedShopId === String(userInfo.value?.shopId || '')) {
return
}
shopSwitchLoading.value = true
try {
await runWithGlobalLoading(async () => {
const response = await adminAuthApi.switchShop(normalizedShopId)
persistAdminSession(response as any)
await fetchUserInfo()
await loadUserPermissions()
2026-05-29 13:30:56 +08:00
notifyShopThemeChanged()
})
message.success('门店上下文已切换')
window.location.reload()
} catch (error: any) {
console.error('切换门店失败:', error)
selectedShopId.value = userInfo.value?.shopId ? String(userInfo.value.shopId) : undefined
message.error(error?.message || '切换门店失败')
} finally {
shopSwitchLoading.value = false
}
}
watch(
() => route.path,
newPath => {
selectedKeys.value = menuItems.some(item => item.key === newPath) ? [newPath] : []
mobileDrawerOpen.value = false
},
{ immediate: true }
)
onMounted(async () => {
await fetchUserInfo()
if (isBootstrapAdmin.value) {
clearPermissions()
}
await loadUserPermissions()
})
</script>
<style scoped>
.admin-layout {
min-height: 100vh;
--admin-sider-width: 240px;
}
2026-05-29 13:30:56 +08:00
.admin-layout--mobile {
width: 100%;
max-width: 100vw;
overflow-x: hidden;
}
.admin-layout--collapsed {
--admin-sider-width: 80px;
}
.sider {
background:
linear-gradient(
180deg,
var(--admin-mobile-shell-start) 0%,
var(--admin-mobile-shell-mid) 48%,
var(--admin-mobile-shell-end) 100%
);
overflow: auto;
height: 100vh;
position: fixed;
left: 0;
top: 0;
bottom: 0;
z-index: 1000;
transition: width 0.2s ease;
}
.logo {
height: 64px;
display: flex;
align-items: center;
justify-content: center;
background: rgba(255, 248, 240, 0.14);
}
.logo h1 {
margin: 0;
color: white;
font-size: 18px;
font-weight: 700;
white-space: nowrap;
}
.header {
position: sticky;
top: 0;
z-index: 100;
margin-left: var(--admin-sider-width);
height: auto;
min-height: 64px;
padding: 0 24px;
background: rgba(255, 249, 242, 0.96);
box-shadow: 0 10px 24px rgba(145, 102, 82, 0.08);
backdrop-filter: blur(14px);
line-height: normal;
transition: margin-left 0.2s ease;
}
.header-shell {
width: 100%;
max-width: var(--admin-content-max-width);
margin: 0 auto;
min-height: 64px;
display: flex;
justify-content: space-between;
align-items: center;
gap: 16px;
}
.header-left {
display: flex;
align-items: center;
gap: 16px;
flex: 1 1 auto;
min-width: 0;
}
.trigger {
flex: 0 0 auto;
font-size: 18px;
cursor: pointer;
color: var(--admin-mobile-ink);
}
.shop-hint,
.shop-switcher,
.shop-pill {
display: inline-flex;
align-items: center;
gap: 10px;
min-height: 40px;
padding: 0 14px;
border-radius: 999px;
background: var(--admin-mobile-surface-alt);
color: var(--admin-mobile-ink);
min-width: 0;
max-width: 100%;
}
.shop-hint {
flex-wrap: wrap;
border-radius: 14px;
line-height: 1.4;
}
.shop-switcher-label {
font-size: 13px;
color: var(--admin-mobile-muted);
}
.shop-select {
min-width: 180px;
width: min(260px, 28vw);
}
.shop-pill {
flex: 0 1 auto;
font-weight: 600;
line-height: 1.2;
}
.shop-pill :deep(.anticon) {
flex: 0 0 auto;
}
.shop-pill span {
display: inline-block;
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.header-right {
display: flex;
align-items: center;
flex: 0 0 auto;
min-width: 0;
}
@media (max-width: 560px) {
.header {
padding: 0 10px;
}
.header-shell {
gap: 10px;
min-height: 58px;
}
.header-left {
flex: 1 1 0;
gap: 10px;
overflow: hidden;
}
.header-right {
flex: 0 0 auto;
margin-left: auto;
}
.shop-pill {
flex: 1 1 0;
max-width: none;
min-height: 36px;
padding: 0 12px;
gap: 8px;
overflow: hidden;
}
.shop-pill span {
max-width: 100%;
}
}
@media (max-width: 420px) {
.header-shell {
gap: 8px;
}
.header-left {
gap: 8px;
}
}
.user-dropdown {
display: flex;
align-items: center;
gap: 12px;
min-height: 48px;
padding: 8px 12px;
border-radius: 10px;
line-height: 1.2;
transition: background 0.2s ease;
}
.user-dropdown:hover {
2026-05-29 13:30:56 +08:00
background: var(--theme-primary-soft);
}
.username {
color: var(--admin-mobile-ink);
max-width: 120px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.content {
margin-left: var(--admin-sider-width);
min-height: calc(100vh - 64px);
padding: 24px;
background:
2026-05-29 13:30:56 +08:00
linear-gradient(180deg, var(--theme-page-bg) 0%, var(--theme-primary-soft) 100%);
transition: margin-left 0.2s;
}
.content-shell {
width: 100%;
max-width: var(--admin-content-max-width);
margin: 0 auto;
}
@media (max-width: 960px) {
.admin-layout,
.admin-layout--collapsed {
--admin-sider-width: 0px;
}
.sider {
display: none;
}
.header,
.content {
margin-left: 0;
}
}
.mobile-shell {
2026-05-29 13:30:56 +08:00
width: 100%;
max-width: 100vw;
min-height: 100vh;
2026-05-29 13:30:56 +08:00
--admin-mobile-content-bottom: calc(82px + env(safe-area-inset-bottom));
--admin-mobile-fab-bottom: calc(92px + env(safe-area-inset-bottom));
background:
2026-05-29 13:30:56 +08:00
linear-gradient(180deg, var(--admin-mobile-shell-mid) 0 86px, var(--admin-mobile-surface) 86px 100%);
overflow-x: hidden;
}
.mobile-shell--no-tabbar {
--admin-mobile-content-bottom: calc(24px + env(safe-area-inset-bottom));
--admin-mobile-fab-bottom: calc(24px + env(safe-area-inset-bottom));
}
.mobile-topbar {
position: sticky;
top: 0;
z-index: 120;
display: flex;
align-items: center;
2026-05-29 13:30:56 +08:00
justify-content: space-between;
gap: 10px;
padding: calc(10px + env(safe-area-inset-top)) 14px 8px;
background: var(--admin-mobile-shell-glass);
backdrop-filter: blur(16px);
}
.mobile-icon-btn,
.mobile-avatar-btn {
display: inline-flex;
align-items: center;
justify-content: center;
2026-05-29 13:30:56 +08:00
width: 36px;
height: 36px;
padding: 0;
border: 0;
2026-05-29 13:30:56 +08:00
border-radius: 12px;
background: var(--admin-mobile-shell-soft);
2026-05-29 13:30:56 +08:00
color: var(--theme-card-bg);
}
2026-05-31 18:36:52 +08:00
.mobile-icon-btn :deep(.anticon),
.mobile-avatar-btn :deep(.anticon) {
font-size: 21px;
line-height: 1;
}
2026-05-29 13:30:56 +08:00
.mobile-topbar__actions {
display: inline-flex;
align-items: center;
gap: 8px;
flex-shrink: 0;
}
.mobile-role-pill {
max-width: 84px;
min-height: 28px;
display: inline-flex;
align-items: center;
padding: 0 9px;
border-radius: 999px;
background: color-mix(in srgb, var(--theme-card-bg) 14%, transparent);
color: color-mix(in srgb, var(--theme-card-bg) 90%, transparent);
font-size: 11px;
font-weight: 600;
line-height: 1;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.mobile-title-block {
flex: 1;
min-width: 0;
2026-05-29 13:30:56 +08:00
display: none;
gap: 2px;
}
.mobile-eyebrow {
2026-05-29 13:30:56 +08:00
font-size: 10px;
letter-spacing: 0.1em;
text-transform: uppercase;
2026-05-29 13:30:56 +08:00
color: color-mix(in srgb, var(--theme-card-bg) 68%, transparent);
}
.mobile-title {
2026-05-29 13:30:56 +08:00
color: var(--theme-card-bg);
font-size: 16px;
line-height: 1.2;
}
.mobile-content {
2026-05-29 13:30:56 +08:00
box-sizing: border-box;
width: 100%;
max-width: 100vw;
padding: 12px 14px var(--admin-mobile-content-bottom);
overflow-x: hidden;
}
.mobile-content :deep(*) {
box-sizing: border-box;
}
.admin-layout--mobile :deep(.admin-page-intro),
.admin-layout--mobile :deep(.message-page-head),
.admin-layout--mobile :deep(.page-head > div:first-child),
.admin-layout--mobile :deep(.page-header > div:first-child) {
display: none !important;
}
.admin-layout--mobile :deep(.page-head),
.admin-layout--mobile :deep(.page-header) {
width: 100%;
max-width: 100%;
align-items: stretch;
justify-content: flex-end;
gap: 10px;
margin-bottom: 12px;
}
.admin-layout--mobile :deep(.page-head .search) {
flex: 1 1 auto;
min-width: 0;
width: 100% !important;
}
.mobile-content :deep(.ant-card),
.mobile-content :deep(.ant-alert),
.mobile-content :deep(.ant-form),
.mobile-content :deep(.ant-row),
.mobile-content :deep(.ant-col),
.mobile-content :deep(.ant-table-wrapper) {
max-width: 100%;
min-width: 0;
}
.mobile-content :deep(.ant-card-head-wrapper),
.mobile-content :deep(.ant-card-body),
.mobile-content :deep(.ant-card-extra) {
max-width: 100%;
min-width: 0;
}
.mobile-content :deep(.ant-card-head-wrapper) {
align-items: flex-start;
gap: 8px;
}
.mobile-content :deep(.ant-card-extra) {
overflow: hidden;
}
.mobile-content :deep(.ant-input),
.mobile-content :deep(.ant-input-affix-wrapper),
.mobile-content :deep(.ant-input-number),
.mobile-content :deep(.ant-picker),
.mobile-content :deep(.ant-select),
.mobile-content :deep(.ant-btn) {
max-width: 100%;
}
.mobile-content :deep(.ant-space) {
display: flex;
max-width: 100%;
flex-wrap: wrap;
}
.mobile-content :deep(.ant-space-item) {
max-width: 100%;
}
.mobile-content :deep(.admin-filter-bar) {
width: 100%;
max-width: 100%;
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 8px;
overflow: hidden;
}
.mobile-content :deep(.admin-filter-bar .ant-input),
.mobile-content :deep(.admin-filter-bar .ant-input-affix-wrapper),
.mobile-content :deep(.admin-filter-bar .ant-input-number),
.mobile-content :deep(.admin-filter-bar .ant-picker),
.mobile-content :deep(.admin-filter-bar .ant-select),
.mobile-content :deep(.admin-filter-bar .ant-btn) {
width: 100% !important;
}
.mobile-content :deep(.admin-filter-bar .ant-picker) {
grid-column: 1 / -1;
}
.mobile-content :deep(.ant-table-wrapper) {
overflow: hidden;
}
.admin-layout :deep(.ant-table-content),
.admin-layout :deep(.ant-table-body) {
width: 100%;
max-width: 100%;
overflow-x: auto;
}
.admin-layout :deep(.ant-table table) {
min-width: 100%;
width: max-content;
table-layout: auto;
}
.admin-layout :deep(.ant-table-cell) {
white-space: nowrap;
word-break: keep-all;
overflow-wrap: normal;
}
.mobile-content :deep(.ant-radio-group) {
max-width: 100%;
display: flex;
flex-wrap: wrap;
}
.mobile-content :deep(.ant-radio-button-wrapper) {
flex: 1 1 auto;
min-width: 0;
padding-inline: 8px;
text-align: center;
overflow: hidden;
text-overflow: ellipsis;
}
.mobile-tabbar {
position: fixed;
2026-05-29 13:30:56 +08:00
left: 10px;
right: 10px;
bottom: 8px;
z-index: 130;
display: grid;
grid-template-columns: repeat(4, minmax(0, 1fr));
2026-05-29 13:30:56 +08:00
gap: 4px;
padding: 6px;
background: var(--admin-mobile-shell-glass);
border: 1px solid color-mix(in srgb, var(--theme-card-bg) 16%, transparent);
border-radius: 20px;
box-shadow: var(--theme-button-shadow);
backdrop-filter: blur(18px);
}
.mobile-tabbar__item {
display: grid;
justify-items: center;
2026-05-29 13:30:56 +08:00
gap: 3px;
padding: 7px 4px;
border: 0;
2026-05-29 13:30:56 +08:00
border-radius: 16px;
background: transparent;
2026-05-29 13:30:56 +08:00
color: color-mix(in srgb, var(--theme-card-bg) 68%, transparent);
font-size: 11px;
}
.mobile-tabbar__item.is-active {
2026-05-29 13:30:56 +08:00
background: color-mix(in srgb, var(--theme-card-bg) 16%, transparent);
color: var(--theme-card-bg);
}
.mobile-tabbar__item :deep(.anticon) {
2026-05-31 18:36:52 +08:00
font-size: 21px;
line-height: 1;
}
.drawer-account {
display: flex;
align-items: center;
gap: 14px;
padding: 18px;
border-radius: 24px;
2026-05-29 13:30:56 +08:00
color: var(--theme-card-bg);
background:
2026-05-29 13:30:56 +08:00
radial-gradient(circle at top right, color-mix(in srgb, var(--theme-card-bg) 20%, transparent), transparent 42%),
radial-gradient(circle at left top, color-mix(in srgb, var(--theme-secondary) 22%, transparent), transparent 44%),
linear-gradient(
160deg,
var(--admin-mobile-shell-start) 0%,
var(--admin-mobile-shell-mid) 58%,
var(--admin-mobile-shell-end) 100%
);
}
.drawer-account__body {
flex: 1;
min-width: 0;
}
.drawer-account__title {
font-size: 18px;
font-weight: 700;
}
.drawer-account__meta {
margin-top: 4px;
font-size: 13px;
2026-05-29 13:30:56 +08:00
color: color-mix(in srgb, var(--theme-card-bg) 80%, transparent);
}
.drawer-shop-card {
margin-top: 18px;
padding: 18px;
border-radius: 22px;
background: var(--admin-mobile-card);
border: 1px solid var(--admin-mobile-border);
box-shadow: 0 12px 24px rgba(144, 103, 84, 0.08);
}
.drawer-shop-card__label {
font-size: 12px;
color: var(--admin-mobile-muted);
}
.drawer-shop-card__value {
display: block;
margin-top: 6px;
color: var(--admin-mobile-ink);
font-size: 18px;
}
.drawer-shop-card__desc {
margin: 8px 0 14px;
color: var(--admin-mobile-muted);
line-height: 1.6;
}
.drawer-section {
margin-top: 20px;
}
.drawer-section__title {
margin-bottom: 12px;
font-size: 13px;
font-weight: 700;
2026-05-29 13:30:56 +08:00
color: var(--text-primary);
}
.drawer-link {
width: 100%;
display: flex;
align-items: center;
gap: 12px;
padding: 14px 0;
border: 0;
border-bottom: 1px solid var(--admin-mobile-border);
background: transparent;
text-align: left;
}
.drawer-link:last-child {
border-bottom: 0;
}
.drawer-link__icon {
display: inline-flex;
align-items: center;
justify-content: center;
width: 42px;
height: 42px;
border-radius: 14px;
background: var(--admin-mobile-accent-soft);
2026-05-29 13:30:56 +08:00
color: var(--theme-primary);
}
.drawer-link__body {
flex: 1;
min-width: 0;
}
.drawer-link__title {
font-size: 15px;
font-weight: 600;
color: var(--admin-mobile-ink);
}
.drawer-link__meta {
margin-top: 4px;
color: var(--admin-mobile-muted);
font-size: 12px;
line-height: 1.5;
}
.drawer-link__arrow {
2026-05-29 13:30:56 +08:00
color: var(--text-secondary);
}
.mobile-drawer :deep(.ant-drawer-body) {
padding: calc(18px + env(safe-area-inset-top)) 18px calc(24px + env(safe-area-inset-bottom));
background: var(--admin-mobile-surface);
}
.sider :deep(.ant-menu),
.sider :deep(.ant-menu-dark) {
background: transparent;
}
.sider :deep(.ant-menu-item) {
width: calc(100% - 24px);
margin: 6px 12px;
border-radius: 16px;
}
.sider :deep(.ant-menu-dark .ant-menu-item),
.sider :deep(.ant-menu-dark .ant-menu-submenu-title) {
2026-05-29 13:30:56 +08:00
color: color-mix(in srgb, var(--theme-card-bg) 80%, transparent);
}
.sider :deep(.ant-menu-dark .ant-menu-item:hover),
.sider :deep(.ant-menu-dark .ant-menu-submenu-title:hover) {
2026-05-29 13:30:56 +08:00
color: var(--theme-card-bg);
background: color-mix(in srgb, var(--theme-card-bg) 12%, transparent);
}
.sider :deep(.ant-menu-dark .ant-menu-item-selected) {
2026-05-29 13:30:56 +08:00
color: var(--theme-card-bg);
background: color-mix(in srgb, var(--theme-card-bg) 18%, transparent);
}
.admin-layout :deep(.ant-btn-primary) {
border-color: transparent;
2026-05-29 13:30:56 +08:00
background: var(--theme-gradient);
box-shadow: var(--theme-button-shadow);
}
.admin-layout :deep(.ant-btn-primary:hover),
.admin-layout :deep(.ant-btn-primary:focus) {
border-color: transparent;
2026-05-29 13:30:56 +08:00
background: linear-gradient(135deg, var(--theme-accent) 0%, var(--theme-secondary) 100%);
}
.admin-layout :deep(.ant-select:not(.ant-select-disabled):hover .ant-select-selector),
.admin-layout :deep(.ant-input:hover),
.admin-layout :deep(.ant-input-affix-wrapper:hover) {
2026-05-29 13:30:56 +08:00
border-color: var(--theme-primary);
}
.admin-layout :deep(.ant-select-focused .ant-select-selector),
.admin-layout :deep(.ant-input:focus),
.admin-layout :deep(.ant-input-affix-wrapper-focused) {
2026-05-29 13:30:56 +08:00
border-color: var(--theme-primary);
box-shadow: var(--theme-focus-shadow);
}
</style>