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