Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
X
xiaomai-cloud-class-web
Overview
Overview
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
xiaomai-cloud-class
xiaomai-cloud-class-web
Commits
782b159e
Commit
782b159e
authored
May 26, 2021
by
chenshu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:修复
parent
60358021
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
12 deletions
+26
-12
src/modules/root/Menu.tsx
+26
-12
No files found.
src/modules/root/Menu.tsx
View file @
782b159e
...
@@ -14,13 +14,12 @@ function Aside(props: any) {
...
@@ -14,13 +14,12 @@ function Aside(props: any) {
const
ctx
:
any
=
useContext
(
XMContext
);
const
ctx
:
any
=
useContext
(
XMContext
);
const
[
selectKey
,
setSelectKey
]
=
useState
();
const
[
selectKey
,
setSelectKey
]
=
useState
();
const
[
openKeys
,
setOpenKeys
]
=
useState
([
''
]);
const
[
openKeys
,
setOpenKeys
]
=
useState
([
''
]);
const
rootSubmenuKeys
=
_
.
pluck
(
menuList
,
'groupCode'
);
useEffect
(()
=>
{
useEffect
(()
=>
{
const
link
=
props
.
location
.
pathname
;
const
link
=
props
.
location
.
pathname
;
console
.
log
(
'link'
,
link
);
menuList
.
map
((
item
:
any
,
index
:
any
)
=>
{
menuList
.
map
((
item
:
any
,
index
:
any
)
=>
{
if
(
link
.
indexOf
(
item
.
link
)
!==
-
1
)
{
if
(
link
.
indexOf
(
item
.
link
)
!==
-
1
)
{
setSelectKey
(
item
.
groupCode
);
setSelectKey
(
item
.
groupCode
);
console
.
log
(
'selectKey'
,
selectKey
);
setOpenKeys
([])
setOpenKeys
([])
}
else
if
(
item
.
children
)
{
}
else
if
(
item
.
children
)
{
item
.
children
.
map
((
_item
:
any
,
_index
:
any
)
=>
{
item
.
children
.
map
((
_item
:
any
,
_index
:
any
)
=>
{
...
@@ -35,9 +34,14 @@ function Aside(props: any) {
...
@@ -35,9 +34,14 @@ function Aside(props: any) {
function
toggleMenu
(
item
:
any
)
{
function
toggleMenu
(
item
:
any
)
{
window
.
RCHistory
.
push
(
item
.
link
)
window
.
RCHistory
.
push
(
item
.
link
)
}
}
function
onOpenChange
(
openKeys
:
any
){
function
onOpenChange
(
key
:
any
)
{
setOpenKeys
(
_
.
last
(
openKeys
,
1
))
if
(
openKeys
.
includes
(
key
))
{
setOpenKeys
([]);
}
else
{
setOpenKeys
([
key
]);
}
}
}
return
(
return
(
<
div
<
div
id=
"left-container"
id=
"left-container"
...
@@ -52,10 +56,8 @@ function Aside(props: any) {
...
@@ -52,10 +56,8 @@ function Aside(props: any) {
<
Menu
<
Menu
style=
{
{
minHeight
:
"100%"
,
background
:
'#0E1935'
}
}
style=
{
{
minHeight
:
"100%"
,
background
:
'#0E1935'
}
}
defaultSelectedKeys=
{
selectKey
}
selectedKeys=
{
selectKey
}
selectedKeys=
{
selectKey
}
openKeys=
{
openKeys
}
openKeys=
{
openKeys
}
onOpenChange=
{
onOpenChange
}
theme=
"dark"
theme=
"dark"
inlineCollapsed=
{
false
}
inlineCollapsed=
{
false
}
mode=
{
menuType
?
"inline"
:
"vertical"
}
mode=
{
menuType
?
"inline"
:
"vertical"
}
...
@@ -66,12 +68,24 @@ function Aside(props: any) {
...
@@ -66,12 +68,24 @@ function Aside(props: any) {
return
null
;
return
null
;
}
}
if
(
item
.
children
)
{
if
(
item
.
children
)
{
return
<
SubMenu
key=
{
item
.
groupCode
}
style=
{
{
marginTop
:
0
}
}
className=
"first-menu-item"
title=
{
<
div
>
return
<
SubMenu
<
span
style=
{
{
marginRight
:
6
}
}
className=
"iconfont icon"
dangerouslySetInnerHTML=
{
{
__html
:
item
.
icon
}
}
></
span
>
key=
{
item
.
groupCode
}
{
menuType
&&
style=
{
{
marginTop
:
0
}
}
<
span
>
{
item
.
groupName
}
</
span
>
className=
"first-menu-item"
}
</
div
>
title=
{
}
>
<
div
>
<
span
style=
{
{
marginRight
:
6
}
}
className=
"iconfont icon"
dangerouslySetInnerHTML=
{
{
__html
:
item
.
icon
}
}
></
span
>
{
menuType
&&
<
span
>
{
item
.
groupName
}
</
span
>
}
</
div
>
}
onTitleClick=
{
()
=>
onOpenChange
(
item
.
groupCode
)
}
>
{
{
item
.
children
.
map
((
_item
:
any
,
_index
:
any
)
=>
{
item
.
children
.
map
((
_item
:
any
,
_index
:
any
)
=>
{
if
(
ctx
.
xmState
.
storeUserPermissionList
.
indexOf
(
_item
.
groupCode
)
===
-
1
)
{
if
(
ctx
.
xmState
.
storeUserPermissionList
.
indexOf
(
_item
.
groupCode
)
===
-
1
)
{
...
...
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