Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
jinfa-platform
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
shenshaokai
jinfa-platform
Commits
f41ea1d2
Commit
f41ea1d2
authored
Aug 03, 2021
by
前端-许佳敏
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 可自由组合pass平台菜单
parent
f0962dda
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
16 additions
and
8 deletions
+16
-8
package.json
package.json
+1
-1
BasicLayout.tsx
src/layouts/BasicLayout.tsx
+2
-1
MenuSlider.tsx
src/layouts/components/MenuSlider.tsx
+1
-0
OuterSide.tsx
src/layouts/components/OuterSide.tsx
+12
-6
No files found.
package.json
View file @
f41ea1d2
...
...
@@ -12,7 +12,7 @@
"api"
:
"god-ytt"
,
"scripts:build"
:
"node scripts/run"
,
"scripts:build-yxc"
:
"node scripts/run http://yxc-web-demo.shushangyun.com/api"
,
"start:dev"
:
"
umi dev
"
,
"start:dev"
:
"
cross-env NODE_OPTIONS=--max_old_space_size=4096 umi dev
"
,
"start:analyze"
:
"ANALYZE=1 umi dev"
,
"clean"
:
"rimraf node_modules"
,
"start"
:
"yarn api && yarn scripts:build && cross-env NODE_OPTIONS=--max_old_space_size=4096 umi dev"
,
...
...
src/layouts/BasicLayout.tsx
View file @
f41ea1d2
...
...
@@ -152,7 +152,7 @@ const BasicLayout: React.FC<BasicLayoutProps> = (props) => {
minWidth
:
'1280px'
}
:
{}
console
.
log
(
currentRouter
)
return
currentRouter
.
noLayout
?
props
.
children
:
(
<
ProLayout
pageTitleRender=
{
()
=>
currentRouter
?
currentRouter
.
name
:
window
.
location
.
href
}
...
...
@@ -179,6 +179,7 @@ const BasicLayout: React.FC<BasicLayoutProps> = (props) => {
menuData=
{
menuData
}
pathname=
{
location
.
pathname
}
collapseState=
{
collapsed
}
currentRouter=
{
currentRouter
}
changeOpenKeys=
{
(
keys
:
string
[])
=>
setOpenKeys
(
keys
)
}
/>
}
footerRender=
{
()
=>
defaultFooterDom
}
...
...
src/layouts/components/MenuSlider.tsx
View file @
f41ea1d2
...
...
@@ -20,6 +20,7 @@ export interface MenuSliderProps {
currentSelectKey
:
string
[];
openKeys
:
string
[];
changeOpenKeys
:
Function
;
currentRouter
:
any
;
}
const
MenuSlider
:
React
.
FC
<
MenuSliderProps
>
=
(
props
)
=>
{
...
...
src/layouts/components/OuterSide.tsx
View file @
f41ea1d2
...
...
@@ -13,12 +13,13 @@ const { Sider } = Layout
export
interface
OuterSiderProps
{
menuData
:
Array
<
any
>
;
pathname
:
string
|
undefined
;
UserStore
?:
any
currentRouter
:
any
,
UserStore
?:
any
,
}
const
OuterSider
:
React
.
FC
<
OuterSiderProps
>
=
observer
((
props
)
=>
{
const
{
menuData
,
pathname
=
"/"
}
=
props
const
{
menuData
,
pathname
=
"/"
,
currentRouter
}
=
props
const
authRouters
=
getRouters
()
let
defaultSelectedKeys
=
""
...
...
@@ -33,14 +34,19 @@ const OuterSider: React.FC<OuterSiderProps> = observer((props) => {
const
getSubMenu
=
()
=>
{
const
subHeadMenus
:
Array
<
any
>
=
[]
menuData
.
forEach
(
item
=>
{
if
(
pathname
.
indexOf
(
item
.
key
)
>
-
1
)
{
defaultSelectedKeys
=
item
.
key
// 为适配pass菜单自由组合变更, 使用code进行高亮显示
const
code
=
currentRouter
.
relationParentCode
console
.
log
(
code
,
item
.
relationParentCode
)
if
(
code
&&
code
===
item
.
relationParentCode
)
{
defaultSelectedKeys
=
item
.
relationParentCode
}
!
item
.
hideInMenu
&&
isAuthPath
(
item
.
path
)
&&
subHeadMenus
.
push
({
path
:
item
.
path
,
title
:
item
.
name
,
icon
:
item
.
icon
,
key
:
item
.
key
key
:
item
.
key
,
// 新增code属性 用于辨别子菜单是否属于该菜单下的属性
relationParentCode
:
item
.
relationParentCode
,
})
})
return
subHeadMenus
...
...
@@ -60,7 +66,7 @@ const OuterSider: React.FC<OuterSiderProps> = observer((props) => {
<
ul
className=
{
styles
.
menuBox
}
>
{
siderMenu
.
map
(
item
=>
(
!
item
.
hideInMenu
&&
<
li
key=
{
item
.
key
}
className=
{
defaultSelectedKeys
===
item
.
key
?
styles
.
currentItem
:
''
}
>
!
item
.
hideInMenu
&&
<
li
key=
{
item
.
key
}
className=
{
defaultSelectedKeys
===
item
.
relationParentCode
?
styles
.
currentItem
:
''
}
>
<
Link
to=
{
item
.
path
}
>
<
CustomIcon
type=
{
item
.
icon
}
style=
{
{
width
:
20
,
height
:
20
}
}
/>
<
label
>
{
item
.
title
}
</
label
>
...
...
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