Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
CivWeb
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
ReactWeb5
CivWeb
Commits
28a2affc
Commit
28a2affc
authored
3 years ago
by
崔佳豪
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 菜单报错修改
parent
7eed81cf
master
dev
devNew
feat/layout-flat
feat/zhilian
patch-1
soundai
test
zhongyi
No related merge requests found
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
65 additions
and
54 deletions
+65
-54
index.js
src/pages/commonMenu/index.js
+65
-54
No files found.
src/pages/commonMenu/index.js
View file @
28a2affc
...
...
@@ -135,20 +135,21 @@ const CommonMenu = props => {
* @param {*} menu
*/
const
linkToMenu
=
menu
=>
{
console
.
log
(
"props"
,
props
)
const
{
path
,
topGroup
}
=
menu
;
const
{
name
,
path
,
topGroup
}
=
menu
;
const
currentIndex
=
props
.
menus
.
findIndex
(
item
=>
item
.
name
===
topGroup
);
history
.
push
(
path
);
props
.
updateCurrentIndex
(
currentIndex
);
let
currentRoutes
=
props
.
menus
[
currentIndex
]
&&
props
.
menus
[
currentIndex
].
routes
;
currentRoutes
=
currentRoutes
.
find
(
item
=>
item
.
path
===
path
);
window
.
share
&&
window
.
share
.
event
.
emit
(
'trigger:updateMenuIndex'
,
currentIndex
);
window
.
share
&&
window
.
share
.
event
&&
window
.
share
.
event
.
emit
(
'event:updateCurrentChildrenRoutes'
,
{
currentPath
:
path
,
currentRoute
:
currentRoutes
,
selectedIndex
:
currentIndex
});
let
currentRoutes
=
props
.
flatMenu
.
find
(
item
=>
item
.
path
===
path
&&
item
.
name
===
name
);
// let currentRoutes = props.menus[currentIndex] && props.menus[currentIndex].routes;
// currentRoutes = currentRoutes.find(item => item.path === path);
if
(
currentRoutes
)
{
history
.
push
(
path
);
props
.
updateCurrentIndex
(
currentIndex
);
window
.
share
&&
window
.
share
.
event
.
emit
(
'trigger:updateMenuIndex'
,
currentIndex
);
window
.
share
&&
window
.
share
.
event
&&
window
.
share
.
event
.
emit
(
'event:updateCurrentChildrenRoutes'
,
{
currentPath
:
path
,
currentRoute
:
currentRoutes
,
selectedIndex
:
currentIndex
});
}
};
const
mdOk
=
submitData
=>
{
...
...
@@ -433,47 +434,56 @@ const MenuAddModal = props => {
<
div
className
=
{
styles
.
menuWrapper
}
key
=
{
item
.
key
}
>
<
p
className
=
{
styles
.
menuGroupTitle
}
>
{
item
.
name
}
<
/p
>
<
div
className
=
{
styles
.
menuList
}
>
{
item
.
childMenus
.
map
(
child
=>
{
const
{
match
,
name
}
=
child
;
const
[
before
,
after
]
=
match
;
const
{
isAdded
}
=
child
.
extData
;
const
bname
=
after
>
-
1
?
name
.
slice
(
0
,
before
)
:
''
;
const
cname
=
after
>
-
1
?
(
<
em
style
=
{{
color
:
'orange'
,
fontStyle
:
'normal'
}}
>
{
name
.
slice
(
before
,
after
+
1
)}
<
/em
>
)
:
(
''
);
const
aname
=
after
>
-
1
?
name
.
slice
(
after
+
1
,
name
.
length
)
:
name
;
return
(
<
div
key
=
{
child
.
key
}
className
=
{
classnames
(
styles
.
menuItem
,
isAdded
?
styles
.
menuItem_added
:
''
,
)}
onClick
=
{()
=>
{
toggleMenu
(
child
);
}}
>
<
div
>
<
span
>
{
bname
}
{
cname
}
{
aname
}
<
/span
>
{
isAdded
?
(
<
p
className
=
{
styles
.
addedFlag
}
>
<
CheckOutlined
/>
<
/p
>
)
:
null
}
{
Array
.
isArray
(
item
.
childMenus
)
&&
item
.
childMenus
.
map
(
child
=>
{
const
{
match
,
name
}
=
child
;
const
{
isAdded
}
=
child
.
extData
;
let
bname
=
''
,
cname
=
''
,
aname
=
name
;
if
(
match
)
{
const
[
before
,
after
]
=
match
;
bname
=
after
>
-
1
?
name
.
slice
(
0
,
before
)
:
''
;
cname
=
after
>
-
1
?
(
<
em
style
=
{{
color
:
'orange'
,
fontStyle
:
'normal'
}}
>
{
name
.
slice
(
before
,
after
+
1
)}
<
/em
>
)
:
(
''
);
aname
=
after
>
-
1
?
name
.
slice
(
after
+
1
,
name
.
length
)
:
name
;
}
return
(
<
div
key
=
{
child
.
key
}
className
=
{
classnames
(
styles
.
menuItem
,
isAdded
?
styles
.
menuItem_added
:
''
,
)}
onClick
=
{()
=>
{
toggleMenu
(
child
);
}}
>
<
div
>
<
span
>
{
bname
}
{
cname
}
{
aname
}
<
/span
>
{
isAdded
?
(
<
p
className
=
{
styles
.
addedFlag
}
>
<
CheckOutlined
/>
<
/p
>
)
:
null
}
<
/div
>
<
/div
>
<
/div
>
);
})}
);
})}
<
/div
>
<
/div
>
))
...
...
@@ -487,11 +497,12 @@ const MenuAddModal = props => {
const
mapStateToProps
=
state
=>
({
menus
:
state
.
getIn
([
'global'
,
'menu'
]),
flatMenu
:
state
.
getIn
([
'global'
,
'flatMenu'
]),
});
const
mapDispatchToProps
=
dispatch
=>
({
updateCurrentIndex
(
index
)
{
dispatch
(
actionCreators
.
updateCurrentIndex
(
index
));
}
}
,
});
export
default
connect
(
mapStateToProps
,
...
...
This diff is collapsed.
Click to expand it.
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