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
87346e98
Commit
87346e98
authored
Jun 23, 2021
by
maolipeng
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/maolipeng/youhua' into feature/maolipeng/20210610/zuhuyouhua
# Conflicts: # src/modules/root/Menu.tsx
parents
0a89e877
51f06b6a
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
50 additions
and
54 deletions
+50
-54
src/modules/root/App.tsx
+12
-1
src/modules/root/Menu.less
+8
-11
src/modules/root/Menu.tsx
+30
-42
No files found.
src/modules/root/App.tsx
View file @
87346e98
...
@@ -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'
...
@@ -20,6 +20,8 @@ import Service from "@/common/js/service";
...
@@ -20,6 +20,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
)
=>
{
...
@@ -122,6 +124,15 @@ const App: React.FC = (props: any) => {
...
@@ -122,6 +124,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.less
View file @
87346e98
...
@@ -12,31 +12,28 @@
...
@@ -12,31 +12,28 @@
width: @xm-left-width;
width: @xm-left-width;
background: @menu-bakg;
background: @menu-bakg;
color: #333;
color: #333;
.top-ctrl {
display: flex;
align-items: center;
.topLogo {
.topLogo {
height: 62
px;
height: 60
px;
background: rgba(255, 255, 255, 0.5);
background: rgba(255, 255, 255, 0.5);
.img1 {
.img1 {
width: 138px;
width: 138px;
height: 35px;
height: 35px;
margin-left: 19px;
margin: 15px 0 15px 8px;
margin-top: 13px;
}
.img0 {
display: none;
width: 35px;
height: 35px;
margin-left: 10px;
margin-top: 13px;
}
}
}
}
.menu-type-icon{
.menu-type-icon{
margin:4px 0 0px 150
px;
margin: 8px 14px 0px 4
px;
cursor: pointer;
cursor: pointer;
.icon{
.icon{
font-size:14px;
font-size:14px;
color:#5E606A;
color:#5E606A;
}
}
}
}
}
.ant-menu {
.ant-menu {
padding-left: 0 !important;
padding-left: 0 !important;
color: #333;
color: #333;
...
...
src/modules/root/Menu.tsx
View file @
87346e98
...
@@ -130,8 +130,7 @@ function Aside(props: any) {
...
@@ -130,8 +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
logoImg0Ref
=
useRef
<
any
>
()
const
[
collapsed
,
setCollapsed
]
=
useState
(
false
)
const
logoImg1Ref
=
useRef
<
any
>
()
const
rootSubmenuKeys
=
_
.
pluck
(
menuList
,
'groupCode'
);
const
rootSubmenuKeys
=
_
.
pluck
(
menuList
,
'groupCode'
);
useEffect
(()
=>
{
useEffect
(()
=>
{
const
link
=
props
.
location
.
pathname
;
const
link
=
props
.
location
.
pathname
;
...
@@ -151,7 +150,7 @@ function Aside(props: any) {
...
@@ -151,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
()})
...
@@ -167,6 +166,9 @@ function Aside(props: any) {
...
@@ -167,6 +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) {
// setOpenKeys([])
// }
}
}
function
onOpenChange
(
key
:
any
)
{
function
onOpenChange
(
key
:
any
)
{
if
(
openKeys
.
includes
(
key
))
{
if
(
openKeys
.
includes
(
key
))
{
...
@@ -175,26 +177,20 @@ function Aside(props: any) {
...
@@ -175,26 +177,20 @@ function Aside(props: any) {
setOpenKeys
([
key
]);
setOpenKeys
([
key
]);
}
}
}
}
function
handleMenu
()
{
function
onOpenChangeForHover
(
key
:
any
)
{
handleMenuType
();
if
(
menuType
)
{
}
useEffect
(()
=>
{
if
(
!
logoImg0Ref
.
current
||
!
logoImg1Ref
.
current
)
{
return
return
}
}
if
(
!
menuType
)
{
if
(
openKeys
.
includes
(
key
))
{
if
(
topLogoUrl
.
indexOf
(
"xiaomaiketang.com"
)
<
0
)
{
setOpenKeys
([]);
logoImg0Ref
.
current
.
style
.
display
=
"none"
logoImg1Ref
.
current
.
style
.
display
=
"none"
}
else
{
}
else
{
logoImg0Ref
.
current
.
style
.
display
=
"inline"
setOpenKeys
([
key
]);
logoImg1Ref
.
current
.
style
.
display
=
"none"
}
}
}
else
{
logoImg0Ref
.
current
.
style
.
display
=
"none"
logoImg1Ref
.
current
.
style
.
display
=
"inline"
}
}
},[
menuType
])
function
handleMenu
()
{
handleMenuType
();
setCollapsed
(
!
collapsed
)
}
return
(
return
(
<
div
<
div
...
@@ -205,9 +201,9 @@ function Aside(props: any) {
...
@@ -205,9 +201,9 @@ function Aside(props: any) {
:
"left-container left-container-vertical"
:
"left-container left-container-vertical"
}
}
>
>
<
div
className=
"top-ctrl"
>
<
div
className=
"topLogo"
>
<
div
className=
"topLogo"
>
<
img
ref=
{
logoImg0Ref
}
src=
"https://image.xiaomaiketang.com/xm/c4KiP2epBP.png"
alt=
""
className=
"img0"
></
img
>
{
menuType
&&
<
img
src=
{
topLogoUrl
}
alt=
""
className=
"img1"
></
img
>
}
<
img
ref=
{
logoImg1Ref
}
src=
{
topLogoUrl
}
alt=
""
className=
"img1"
></
img
>
</
div
>
</
div
>
<
div
className=
"menu-type-icon"
onClick=
{
handleMenu
}
>
<
div
className=
"menu-type-icon"
onClick=
{
handleMenu
}
>
{
menuType
?
(
{
menuType
?
(
...
@@ -224,14 +220,14 @@ function Aside(props: any) {
...
@@ -224,14 +220,14 @@ function Aside(props: any) {
</
span
>
</
span
>
)
}
)
}
</
div
>
</
div
>
</
div
>
<
div
className=
"left"
>
<
div
className=
"left"
>
<
div
className=
"nav"
>
<
div
className=
"nav"
>
<
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"
}
>
>
{
{
...
@@ -240,13 +236,11 @@ function Aside(props: any) {
...
@@ -240,13 +236,11 @@ 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: 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
)
{
...
@@ -260,18 +254,12 @@ function Aside(props: any) {
...
@@ -260,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=
{
<
img
src=
{
selectKey
===
item
.
groupCode
?
item
.
selectImg
:
item
.
img
}
className=
"icon-img"
></
img
>
}
:
>
<
img
src=
{
item
.
img
}
className=
"icon-img"
></
img
>
{
menuType
?
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