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
e23cd123
Commit
e23cd123
authored
Jun 22, 2021
by
maolipeng
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/maolipeng/youhua' into dev
parents
11ae3474
23e7fe66
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
27 deletions
+30
-27
src/modules/root/App.tsx
+12
-1
src/modules/root/Menu.tsx
+18
-26
No files found.
src/modules/root/App.tsx
View file @
e23cd123
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
*/
*/
import
React
,
{
useContext
,
useEffect
,
useState
}
from
'react'
;
import
React
,
{
useContext
,
useEffect
,
useState
}
from
'react'
;
import
{
withRouter
}
from
'react-router-dom'
;
import
{
withRouter
}
from
'react-router-dom'
;
import
{
ConfigProvider
,
message
}
from
'antd'
;
import
{
ConfigProvider
,
message
,
Layout
}
from
'antd'
;
import
Header
from
'./Header'
import
Header
from
'./Header'
import
Menu
from
'./Menu'
import
Menu
from
'./Menu'
import
Main
from
'./Main'
import
Main
from
'./Main'
...
@@ -21,6 +21,8 @@ import Service from "@/common/js/service";
...
@@ -21,6 +21,8 @@ import Service from "@/common/js/service";
import
Bus
from
'@/core/tbus'
;
import
Bus
from
'@/core/tbus'
;
import
{
func
}
from
'prop-types'
;
import
{
func
}
from
'prop-types'
;
const
{
Footer
,
Sider
,
Content
}
=
Layout
;
declare
var
window
:
any
;
declare
var
window
:
any
;
const
App
:
React
.
FC
=
(
props
:
any
)
=>
{
const
App
:
React
.
FC
=
(
props
:
any
)
=>
{
...
@@ -124,6 +126,15 @@ const App: React.FC = (props: any) => {
...
@@ -124,6 +126,15 @@ const App: React.FC = (props: any) => {
return
(
return
(
<
div
id=
"home"
>
<
div
id=
"home"
>
{
/* <Layout>
<Sider><Menu menuType={menuType} handleMenuType={handleMenuType} /></Sider>
<Layout>
<Header id="app" handleMenuType={handleMenuType} menuType={menuType} />
<ConfigProvider locale={zhCN} autoInsertSpaceInButton={false}>
<Main menuType={menuType} />
</ConfigProvider>
</Layout>
</Layout> */
}
<
Header
id=
"app"
handleMenuType=
{
handleMenuType
}
menuType=
{
menuType
}
/>
<
Header
id=
"app"
handleMenuType=
{
handleMenuType
}
menuType=
{
menuType
}
/>
<
ConfigProvider
locale=
{
zhCN
}
autoInsertSpaceInButton=
{
false
}
>
<
ConfigProvider
locale=
{
zhCN
}
autoInsertSpaceInButton=
{
false
}
>
<
Main
menuType=
{
menuType
}
/>
<
Main
menuType=
{
menuType
}
/>
...
...
src/modules/root/Menu.tsx
View file @
e23cd123
...
@@ -130,6 +130,7 @@ function Aside(props: any) {
...
@@ -130,6 +130,7 @@ function Aside(props: any) {
const
[
selectKey
,
setSelectKey
]
=
useState
();
const
[
selectKey
,
setSelectKey
]
=
useState
();
const
[
openKeys
,
setOpenKeys
]
=
useState
([
''
]);
const
[
openKeys
,
setOpenKeys
]
=
useState
([
''
]);
const
[
topLogoUrl
,
setTopLogoUrl
]
=
useState
(
""
)
const
[
topLogoUrl
,
setTopLogoUrl
]
=
useState
(
""
)
const
[
collapsed
,
setCollapsed
]
=
useState
(
false
)
const
rootSubmenuKeys
=
_
.
pluck
(
menuList
,
'groupCode'
);
const
rootSubmenuKeys
=
_
.
pluck
(
menuList
,
'groupCode'
);
useEffect
(()
=>
{
useEffect
(()
=>
{
const
link
=
props
.
location
.
pathname
;
const
link
=
props
.
location
.
pathname
;
...
@@ -149,7 +150,7 @@ function Aside(props: any) {
...
@@ -149,7 +150,7 @@ function Aside(props: any) {
},
[
props
.
location
.
pathname
])
},
[
props
.
location
.
pathname
])
useEffect
(()
=>
{
useEffect
(()
=>
{
getTopLeftLogo
()
getTopLeftLogo
()
})
}
,[]
)
function
getTopLeftLogo
()
{
function
getTopLeftLogo
()
{
if
(
User
.
getToken
())
{
if
(
User
.
getToken
())
{
StoreService
.
getStoreDetail
({
storeId
:
User
.
getStoreId
()})
StoreService
.
getStoreDetail
({
storeId
:
User
.
getStoreId
()})
...
@@ -165,9 +166,9 @@ function Aside(props: any) {
...
@@ -165,9 +166,9 @@ function Aside(props: any) {
}
}
function
toggleMenu
(
item
:
any
)
{
function
toggleMenu
(
item
:
any
)
{
window
.
RCHistory
.
push
(
item
.
link
)
window
.
RCHistory
.
push
(
item
.
link
)
if
(
!
menuType
)
{
//
if (!menuType) {
setOpenKeys
([])
//
setOpenKeys([])
}
//
}
}
}
function
onOpenChange
(
key
:
any
)
{
function
onOpenChange
(
key
:
any
)
{
if
(
openKeys
.
includes
(
key
))
{
if
(
openKeys
.
includes
(
key
))
{
...
@@ -188,6 +189,7 @@ function Aside(props: any) {
...
@@ -188,6 +189,7 @@ function Aside(props: any) {
}
}
function
handleMenu
()
{
function
handleMenu
()
{
handleMenuType
();
handleMenuType
();
setCollapsed
(
!
collapsed
)
}
}
return
(
return
(
...
@@ -225,9 +227,7 @@ function Aside(props: any) {
...
@@ -225,9 +227,7 @@ function Aside(props: any) {
<
Menu
<
Menu
style=
{
{
minHeight
:
"100%"
,
background
:
'#0E1935'
}
}
style=
{
{
minHeight
:
"100%"
,
background
:
'#0E1935'
}
}
selectedKeys=
{
selectKey
}
inlineCollapsed=
{
collapsed
}
openKeys=
{
openKeys
}
inlineCollapsed=
{
false
}
mode=
{
menuType
?
"inline"
:
"vertical"
}
mode=
{
menuType
?
"inline"
:
"vertical"
}
>
>
{
{
...
@@ -236,13 +236,11 @@ function Aside(props: any) {
...
@@ -236,13 +236,11 @@ function Aside(props: any) {
return
null
;
return
null
;
}
}
if
(
item
.
children
)
{
if
(
item
.
children
)
{
return
<
SubMenu
onTitleMouseEnter=
{
()
=>
onOpenChangeForHover
(
item
.
groupCode
)
}
key=
{
item
.
groupCode
}
style=
{
{
marginTop
:
0
}
}
className=
"first-menu-item"
title=
{
<
div
>
return
<
SubMenu
{
/* <span style={{ marginRight: 16 }} className="iconfont icon" dangerouslySetInnerHTML={{ __html:item.icon}}></span> */
}
key=
{
item
.
groupCode
}
<
img
src=
{
item
.
img
}
className=
"icon-img"
></
img
>
style=
{
{
marginTop
:
0
}
}
{
menuType
&&
title=
{
<
div
><
img
src=
{
item
.
img
}
className=
"icon-img"
></
img
><
span
>
{
item
.
groupName
}
</
span
></
div
>
}
<
span
>
{
item
.
groupName
}
</
span
>
onTitleClick=
{
()
=>
onOpenChange
(
item
.
groupCode
)
}
>
}
</
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
)
{
...
@@ -256,18 +254,12 @@ function Aside(props: any) {
...
@@ -256,18 +254,12 @@ function Aside(props: any) {
}
}
</
SubMenu
>
</
SubMenu
>
}
else
{
}
else
{
return
<
Menu
.
Item
onClick=
{
()
=>
{
toggleMenu
(
item
)
}
}
key=
{
item
.
groupCode
}
className=
"first-menu-item"
>
return
<
Menu
.
Item
{
/* <span style={{ marginRight: 16 }} className="iconfont icon" dangerouslySetInnerHTML={{ __html:item.icon}}></span> */
}
onClick=
{
()
=>
{
toggleMenu
(
item
)
}
}
{
selectKey
===
item
.
groupCode
?
key=
{
item
.
groupCode
}
<
img
src=
{
item
.
selectImg
}
className=
"icon-img"
></
img
>
icon=
{
selectKey
===
item
.
groupCode
?
<
img
src=
{
item
.
selectImg
}
className=
"icon-img"
></
img
>:<
img
src=
{
item
.
img
}
className=
"icon-img"
></
img
>
}
:
>
<
img
src=
{
item
.
img
}
className=
"icon-img"
></
img
>
{
item
.
groupName
}
}
{
menuType
&&
<
span
>
{
item
.
groupName
}
</
span
>
}
</
Menu
.
Item
>
</
Menu
.
Item
>
}
}
})
})
...
...
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