Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
jinfa-admin
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
project
jinfa-admin
Commits
d0a92eae
Commit
d0a92eae
authored
Sep 13, 2021
by
alwayOnlie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
多级菜单修改
parent
e27b5bd6
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
31 additions
and
39 deletions
+31
-39
index.ts
config/routes/index.ts
+24
-24
CustomIcon.tsx
src/layouts/components/CustomIcon.tsx
+1
-7
MenuSlider.tsx
src/layouts/components/MenuSlider.tsx
+2
-4
OuterSide.tsx
src/layouts/components/OuterSide.tsx
+4
-4
No files found.
config/routes/index.ts
View file @
d0a92eae
...
...
@@ -41,30 +41,30 @@ import platformCouponManageRoute from './platformCouponManageRoute'; // 平台
import
asyncRoutes
from
'../router.config.json'
;
const
routeList
=
[
// pageCustomized,
// calssPropertyRoute,
// trademarkRoute,
// commodity,
// rfqRoute,
// rfqOfferRoute,
// logisticsRoutes,
// memberAbility,
// ruleSettingRoutes,
// authConfig,
// commentRoutes,
// contentRoute,
// balancedRoute,
// demandRoute,
// procurementRoute,
// demandQuoteOrderRoute,
// capitalAccount,
// messageRoute,
// systemManageRoute,
// orderSystemRoutes,
// productionNoticeRoutes,
// exchangeManageRoutes,
// returnManageRoute,
// repairManageRoute,
// pageCustomized,
// calssPropertyRoute,
// trademarkRoute,
// commodity,
// rfqRoute,
// rfqOfferRoute,
// logisticsRoutes,
// memberAbility,
// ruleSettingRoutes,
// authConfig,
// commentRoutes,
// contentRoute,
// balancedRoute,
// demandRoute,
// procurementRoute,
// demandQuoteOrderRoute,
// capitalAccount,
// messageRoute,
// systemManageRoute,
// orderSystemRoutes,
// productionNoticeRoutes,
// exchangeManageRoutes,
// returnManageRoute,
// repairManageRoute,
];
const
router
=
[
...
...
src/layouts/components/CustomIcon.tsx
View file @
d0a92eae
...
...
@@ -16,7 +16,6 @@ import { ReactComponent as transcation } from '../../asserts/menuIcon/transcatio
import
{
ReactComponent
as
home
}
from
'../../asserts/menuIcon/home.svg'
import
{
ReactComponent
as
commodity
}
from
'../../asserts/menuIcon/commodity.svg'
import
Icon
from
'@ant-design/icons'
import
{
IconComponentProps
}
from
'@ant-design/icons/lib/components/Icon'
const
iconMap
=
{
afterSale
,
...
...
@@ -38,17 +37,12 @@ const iconMap = {
function
RenderComponent
({
type
,
...
props
}:
{
type
:
keyof
typeof
iconMap
})
{
const
Component
=
iconMap
[
type
]
// console.log(Component, 'Component')
return
<
Component
{
...
props
}
/>
}
const
CustomIcon
:
FC
<
any
>
=
({
type
,
...
props
}:
{
type
:
keyof
typeof
iconMap
})
=>
{
// console.log(type, props)
// return <Icon component={() => <RenderComponent type={type} {...props}/>}/>
// @处理未配置icon报错
return
<
Icon
component=
{
channel
}
/>
// return <><span>66</span></>
// return type ? <Icon component={() => <RenderComponent type={type} {...props} />} /> : null
return
type
?
<
Icon
component=
{
()
=>
<
RenderComponent
type=
{
type
}
{
...
props
}
/>
}
/>
:
null
}
export
default
CustomIcon
src/layouts/components/MenuSlider.tsx
View file @
d0a92eae
...
...
@@ -6,11 +6,9 @@ import {
BorderOutlined
,
}
from
'@ant-design/icons'
import
OuterSider
from
'./OuterSide'
import
{
GlobalConfig
}
from
'@/global/config'
import
styles
from
'../styles/MenuSlider.less'
import
{
getRouters
}
from
'@/utils/auth'
;
import
{
isDev
}
from
'@/constants'
;
const
{
Sider
}
=
Layout
const
{
SubMenu
}
=
Menu
;
...
...
@@ -26,7 +24,6 @@ export interface MenuSliderProps {
const
MenuSlider
:
React
.
FC
<
MenuSliderProps
>
=
(
props
)
=>
{
const
{
menuData
,
pathname
,
currentSelectKey
=
[],
openKeys
=
[],
changeOpenKeys
}
=
props
console
.
log
(
menuData
)
const
[
innerCollapsed
,
setInnerCollapsed
]
=
useState
(
false
)
let
menuItemsCache
=
null
...
...
@@ -86,7 +83,8 @@ const MenuSlider: React.FC<MenuSliderProps> = (props) => {
}
const
clearHeightSearchParams
=
()
=>
{
const
currentState
=
JSON
.
parse
(
sessionStorage
.
getItem
(
"currentState"
))
let
current
:
any
=
sessionStorage
.
getItem
(
"currentState"
)
const
currentState
=
JSON
.
parse
(
current
)
const
result
=
{
...
currentState
,
queryParams
:
{},
current
:
1
}
sessionStorage
.
setItem
(
"currentState"
,
JSON
.
stringify
(
result
))
}
...
...
src/layouts/components/OuterSide.tsx
View file @
d0a92eae
...
...
@@ -20,7 +20,7 @@ export interface OuterSiderProps {
const
OuterSider
:
React
.
FC
<
OuterSiderProps
>
=
observer
((
props
)
=>
{
const
{
menuData
,
pathname
=
"/"
,
currentRouter
}
=
props
console
.
log
(
menuData
,
currentRouter
)
console
.
log
(
props
,
'props'
)
const
authRouters
=
getRouters
()
let
defaultSelectedKeys
=
""
...
...
@@ -54,17 +54,17 @@ const OuterSider: React.FC<OuterSiderProps> = observer((props) => {
return
subHeadMenus
}
const
siderMenu
=
getSubMenu
()
console
.
log
(
siderMenu
,
'siderMenu'
)
//
console.log(siderMenu, 'siderMenu')
return
<>
<
Sider
collapsed=
{
true
}
collapsedWidth=
{
64
}
className=
{
styles
.
wrapperSilder
}
>
<
div
className=
{
styles
.
userPic
}
>
{
/* <Link to="/memberCenter
/home">
<
Link
to=
"
/home"
>
{
props
.
UserStore
.
avatar
?
<
img
src=
{
props
.
UserStore
.
avatar
}
className=
{
styles
.
avatar
}
/>
:
<
Icon
component=
{
()
=>
<
DefaultAvatar
className=
{
styles
.
logo
}
/>
}
/>
}
</Link>
*/
}
</
Link
>
</
div
>
<
ul
className=
{
styles
.
menuBox
}
>
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment