简化平台配置侧栏入口
This commit is contained in:
@@ -1,16 +1,11 @@
|
||||
import {
|
||||
ApiOutlined,
|
||||
AuditOutlined,
|
||||
BellOutlined,
|
||||
CloudServerOutlined,
|
||||
DashboardOutlined,
|
||||
FileSearchOutlined,
|
||||
LinkOutlined,
|
||||
LogoutOutlined,
|
||||
MenuFoldOutlined,
|
||||
MenuUnfoldOutlined,
|
||||
OrderedListOutlined,
|
||||
SafetyCertificateOutlined,
|
||||
SettingOutlined,
|
||||
ShopOutlined,
|
||||
TeamOutlined,
|
||||
@@ -69,38 +64,7 @@ export default function AdminLayout() {
|
||||
label: '配置',
|
||||
children: [
|
||||
{ key: '/admin/users', icon: <TeamOutlined />, label: '后台用户' },
|
||||
{
|
||||
key: '/admin/platform-shops',
|
||||
icon: <SettingOutlined />,
|
||||
label: '平台配置',
|
||||
children: [
|
||||
{
|
||||
key: '/admin/platform-shops?tab=ninetyone',
|
||||
icon: <LinkOutlined />,
|
||||
label: '91卡券',
|
||||
},
|
||||
{
|
||||
key: '/admin/platform-shops?tab=notifications',
|
||||
icon: <BellOutlined />,
|
||||
label: '内部通知',
|
||||
},
|
||||
{
|
||||
key: '/admin/platform-shops?tab=kuaishouEticket',
|
||||
icon: <SafetyCertificateOutlined />,
|
||||
label: '快手核销',
|
||||
},
|
||||
{
|
||||
key: '/admin/platform-shops?tab=kuaishouFeifei',
|
||||
icon: <ApiOutlined />,
|
||||
label: 'feifei',
|
||||
},
|
||||
{
|
||||
key: '/admin/platform-shops?tab=cloudtentacles',
|
||||
icon: <CloudServerOutlined />,
|
||||
label: 'cloudtentacles',
|
||||
},
|
||||
],
|
||||
},
|
||||
{ key: '/admin/platform-shops', icon: <SettingOutlined />, label: '平台配置' },
|
||||
{ key: '/admin/platform-fulfillment', icon: <ShopOutlined />, label: '履约配置' },
|
||||
],
|
||||
},
|
||||
@@ -134,8 +98,7 @@ export default function AdminLayout() {
|
||||
window.localStorage.setItem(SIDEBAR_COLLAPSED_KEY, next ? '1' : '0')
|
||||
}
|
||||
|
||||
const selectedKey = resolveSelectedKey(location.pathname, location.search)
|
||||
const defaultOpenKeys = collapsed ? [] : resolveDefaultOpenKeys(selectedKey)
|
||||
const selectedKey = resolveSelectedKey(location.pathname)
|
||||
|
||||
return (
|
||||
<Layout className="admin-shell">
|
||||
@@ -176,7 +139,6 @@ export default function AdminLayout() {
|
||||
mode="inline"
|
||||
inlineIndent={16}
|
||||
selectedKeys={[selectedKey]}
|
||||
defaultOpenKeys={defaultOpenKeys}
|
||||
items={menuItems}
|
||||
className="admin-menu"
|
||||
onClick={({ key }) => navigate(String(key))}
|
||||
@@ -216,24 +178,13 @@ export default function AdminLayout() {
|
||||
)
|
||||
}
|
||||
|
||||
function resolveSelectedKey(pathname: string, search = '') {
|
||||
function resolveSelectedKey(pathname: string) {
|
||||
if (pathname.startsWith('/admin/orders')) return '/admin/orders'
|
||||
if (pathname.startsWith('/admin/tasks')) return '/admin/tasks'
|
||||
if (pathname === '/admin/platform-shops') {
|
||||
const tab = new URLSearchParams(search).get('tab') || 'ninetyone'
|
||||
return `/admin/platform-shops?tab=${tab}`
|
||||
}
|
||||
if (pathname === '/admin/platform-shops') return '/admin/platform-shops'
|
||||
return pathname
|
||||
}
|
||||
|
||||
function resolveDefaultOpenKeys(selectedKey: string) {
|
||||
if (selectedKey.startsWith('/admin/platform-shops')) {
|
||||
return ['/admin/platform-shops']
|
||||
}
|
||||
|
||||
return []
|
||||
}
|
||||
|
||||
function roleLabel(role: string) {
|
||||
if (role === 'admin') return '管理员'
|
||||
if (role === 'operator') return '普通运营'
|
||||
|
||||
Reference in New Issue
Block a user