Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
B
biz.qingxiao.com
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
wangxuelai
biz.qingxiao.com
Commits
2a46d761
Commit
2a46d761
authored
Aug 15, 2019
by
wangxuelai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
''
parent
29851f34
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
70 additions
and
23 deletions
+70
-23
menuconfig.js
src/common/menuconfig.js
+15
-2
SjdMenu.js
src/components/SjdMenu.js
+31
-10
SjdMenu.less
src/components/SjdMenu.less
+7
-0
webapp.js
src/models/webapp.js
+17
-11
No files found.
src/common/menuconfig.js
View file @
2a46d761
...
...
@@ -81,8 +81,21 @@ export default {
},
activeurl
:
`
${
__IMGCDN__
}
menu/minappactive.png`
,
notactiveurl
:
`
${
__IMGCDN__
}
menu/minapp.png`
,
// path: '/sjd/officialweb',
// relativePath: ['/sjd/officialweb', '/sjd/officialwebeditor'],
isFather
:
true
,
subMenues
:
[
{
id
:
'8'
,
fatherId
:
'2'
,
name
:
'微官网管理'
,
style
:
{
width
:
'20px'
,
height
:
'20px'
,
},
noIcon
:
true
,
path
:
'/sjd/officialweb'
,
relativePath
:
[
'/sjd/officialweb'
,
'/sjd/officialwebeditor'
],
},
],
},
],
};
src/components/SjdMenu.js
View file @
2a46d761
...
...
@@ -2,6 +2,7 @@ import React from 'react';
import
{
connect
}
from
'dva'
;
import
{
Menu
,
Icon
,
Layout
}
from
'antd'
;
import
SjdMenuStyle
from
'./SjdMenu.less'
;
const
{
SubMenu
}
=
Menu
;
const
{
Sider
}
=
Layout
;
class
SjdMenu
extends
React
.
Component
{
constructor
(
props
)
{
...
...
@@ -21,11 +22,14 @@ class SjdMenu extends React.Component {
}
componentWillUnmount
()
{
}
selectedMenu
=
(
key
)
=>
{
selectedMenu
=
(
id
,
fatherId
)
=>
{
const
{
dispatch
}
=
this
.
props
;
dispatch
({
type
:
'webapp/menuselected'
,
payload
:
key
,
payload
:
{
id
,
fatherId
,
},
});
}
render
()
{
...
...
@@ -34,7 +38,6 @@ class SjdMenu extends React.Component {
const
menuItemStyle
=
{
fontSize
:
'13px'
,
height
:
'40px'
,
paddingLeft
:
'35px'
,
display
:
'flex'
,
alignItems
:
'center'
,
};
...
...
@@ -51,7 +54,7 @@ class SjdMenu extends React.Component {
left
:
0
,
zIndex
:
100
,
}}
className
=
{
SjdMenuStyle
.
menusider
}
className
=
{
`
${
SjdMenuStyle
.
menusider
}
menusider`
}
>
<
div
>
<
div
className
=
{
collapsed
?
SjdMenuStyle
.
collapsedlogo
:
SjdMenuStyle
.
uncollapsedlogo
}
/
>
...
...
@@ -60,15 +63,33 @@ class SjdMenu extends React.Component {
mode
=
"inline"
defaultSelectedKeys
=
{[
defaultMenu
]}
className
=
{
SjdMenuStyle
.
menu
}
onClick
=
{
this
.
selectedMenu
}
>
{
menus
.
map
(
ele
=>
(
<
Menu
.
Item
key
=
{
ele
.
id
}
style
=
{
menuItemStyle
}
>
<
div
className
=
{
SjdMenuStyle
.
menuicon
}
style
=
{
defaultMenu
===
ele
.
id
?
{
width
:
ele
.
style
.
width
,
height
:
ele
.
style
.
height
,
backgroundImage
:
`url(
${
ele
.
activeurl
}
)`
}
:
{
width
:
ele
.
style
.
width
,
height
:
ele
.
style
.
height
,
backgroundImage
:
`url(
${
ele
.
notactiveurl
}
)`
}}
/
>
<
Icon
style
=
{{
width
:
0
,
minWidth
:
'initial'
}}
/
>
<
span
>
{
ele
.
name
}
<
/span
>
<
/Menu.Item
>
!
ele
.
isFather
?
<
Menu
.
Item
key
=
{
ele
.
id
}
style
=
{
menuItemStyle
}
onClick
=
{()
=>
this
.
selectedMenu
(
ele
.
id
,
null
)}
>
<
div
className
=
{
SjdMenuStyle
.
menuicon
}
style
=
{
defaultMenu
===
ele
.
id
?
{
width
:
ele
.
style
.
width
,
height
:
ele
.
style
.
height
,
backgroundImage
:
`url(
${
ele
.
activeurl
}
)`
}
:
{
width
:
ele
.
style
.
width
,
height
:
ele
.
style
.
height
,
backgroundImage
:
`url(
${
ele
.
notactiveurl
}
)`
}}
/
>
<
Icon
style
=
{{
width
:
0
,
minWidth
:
'initial'
}}
/
>
<
span
>
{
ele
.
name
}
<
/span
>
<
/Menu.Item>
:
<
SubMenu
key
=
"sub1"
title
=
{
<
span
>
<
div
className
=
{
SjdMenuStyle
.
menuicon
}
style
=
{
defaultMenu
===
ele
.
id
?
{
width
:
ele
.
style
.
width
,
height
:
ele
.
style
.
height
,
backgroundImage
:
`url(
${
ele
.
activeurl
}
)`
}
:
{
width
:
ele
.
style
.
width
,
height
:
ele
.
style
.
height
,
backgroundImage
:
`url(
${
ele
.
notactiveurl
}
)`
}}
/
>
<
Icon
style
=
{{
width
:
0
,
minWidth
:
'initial'
}}
/
>
<
span
>
{
ele
.
name
}
<
/span
>
<
/span
>
}
>
{
ele
.
subMenues
.
map
(
submenu
=>
(
<
Menu
.
Item
key
=
{
submenu
.
id
}
style
=
{
menuItemStyle
}
onClick
=
{()
=>
this
.
selectedMenu
(
submenu
.
id
,
submenu
.
fatherId
)}
>
<
div
className
=
{
SjdMenuStyle
.
menuicon
}
style
=
{
defaultMenu
===
submenu
.
id
?
{
width
:
submenu
.
style
.
width
,
height
:
submenu
.
style
.
height
,
backgroundImage
:
`url(
${
submenu
.
activeurl
}
)`
}
:
{
width
:
submenu
.
style
.
width
,
height
:
submenu
.
style
.
height
,
backgroundImage
:
`url(
${
submenu
.
notactiveurl
}
)`
}}
/
>
<
Icon
style
=
{{
width
:
0
,
minWidth
:
'initial'
}}
/
>
<
span
>
{
submenu
.
name
}
<
/span
>
<
/Menu.Item
>
))}
<
/SubMenu
>
))
}
<
/Menu
>
...
...
src/components/SjdMenu.less
View file @
2a46d761
@import '../less/variables.less';
@images: '@{imagesroot}';
:global {
.menusider {
.ant-menu-inline-collapsed > .ant-menu-item, .ant-menu-inline-collapsed > .ant-menu-item-group > .ant-menu-item-group-list > .ant-menu-item, .ant-menu-inline-collapsed > .ant-menu-item-group > .ant-menu-item-group-list > .ant-menu-submenu > .ant-menu-submenu-title, .ant-menu-inline-collapsed > .ant-menu-submenu > .ant-menu-submenu-title {
padding: 0 26px !important;
}
}
}
.uncollapsedlogo {
height: 45px;
width: 58px;
...
...
src/models/webapp.js
View file @
2a46d761
...
...
@@ -329,18 +329,24 @@ export default {
},
effects
:
{
*
menuselected
({
payload
},
{
put
,
select
})
{
const
defaultMenu
=
payload
.
key
;
const
{
id
,
fatherId
,
}
=
payload
;
const
defaultMenu
=
id
;
const
webapp
=
yield
select
(
state
=>
state
.
webapp
);
const
currentMenu
=
webapp
.
menus
.
find
(
ele
=>
ele
.
id
===
payload
.
key
)
||
{};
yield
put
({
type
:
'updateState'
,
payload
:
{
defaultMenu
,
},
});
yield
put
(
routerRedux
.
replace
({
pathname
:
currentMenu
.
path
,
}));
const
currentMenu
=
webapp
.
menus
.
find
(
ele
=>
ele
.
id
===
id
)
||
{};
if
(
!
currentMenu
.
isFather
)
{
yield
put
({
type
:
'updateState'
,
payload
:
{
defaultMenu
,
},
});
yield
put
(
routerRedux
.
replace
({
pathname
:
currentMenu
.
path
,
}));
}
},
*
judgeexpire
({
payload
},
{
put
,
call
,
select
})
{
const
webapp
=
yield
select
(
state
=>
state
.
webapp
);
...
...
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