Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
jinfa-platform
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
黄庭坚
jinfa-platform
Commits
1b23a0d7
Commit
1b23a0d7
authored
Jul 10, 2020
by
GuanHua
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:修改左侧菜单,根据路由配置生成
parent
74f76cf5
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
474 additions
and
322 deletions
+474
-322
config.ts
config/config.ts
+1
-1
router.ts
config/router.ts
+9
-155
commodityRoute.ts
config/routes/commodityRoute.ts
+184
-0
index.ts
config/routes/index.ts
+7
-0
memberRoute.ts
config/routes/memberRoute.ts
+26
-0
BasicLayout.tsx
src/layouts/BasicLayout.tsx
+36
-19
MenuSlider.tsx
src/layouts/components/MenuSlider.tsx
+70
-56
OuterSide.tsx
src/layouts/components/OuterSide.tsx
+37
-39
MenuSlider.less
src/layouts/styles/MenuSlider.less
+52
-14
zh-CN.ts
src/locales/zh-CN.ts
+6
-38
menu.ts
src/locales/zh-CN/menu.ts
+46
-0
No files found.
config/config.ts
View file @
1b23a0d7
...
...
@@ -21,7 +21,7 @@ export default defineConfig({
[
'import'
,
{
libraryName
:
'god'
,
libraryDirectory
:
'es'
,
style
:
true
},
'god'
]
],
history
:
{
type
:
'
hash
'
,
// 'brower' | 'hash'
type
:
'
browser
'
,
// 'brower' | 'hash'
},
// 用于
analyze
:
{
...
...
config/router.ts
View file @
1b23a0d7
import
{
default
as
routes
}
from
'./routes'
/**
* @description 路由配置页, 更多配置可查看 https://umijs.org/zh-CN/docs/routing#routes
*/
...
...
@@ -31,165 +33,17 @@ const router = [
routes
:
[
{
path
:
'/'
,
name
:
'index'
,
icon
:
'smile'
,
component
:
'@/pages/index'
,
},
{
path
:
'/classAndProperty'
,
name
:
'classAndProperty'
,
icon
:
'smile'
,
routes
:
[
{
path
:
'/classAndProperty/class'
,
name
:
'class'
,
icon
:
'smile'
,
component
:
'@/pages/classAndProperty/class'
,
},
{
path
:
'/classAndProperty/attribute'
,
name
:
'attribute'
,
icon
:
'smile'
,
component
:
'@/pages/classAndProperty/attribute'
,
},
{
path
:
'/classAndProperty/attribute/addAttribute'
,
name
:
'addAttribute'
,
icon
:
'smile'
,
component
:
'@/pages/classAndProperty/attribute/addAttribute'
,
hideInMenu
:
true
,
},
{
path
:
'/classAndProperty/propertyValue'
,
name
:
'propertyValue'
,
icon
:
'smile'
,
component
:
'@/pages/classAndProperty/propertyValue'
,
},
{
path
:
'/classAndProperty/propertyValue/addPropertyValue'
,
name
:
'addPropertyValue'
,
icon
:
'smile'
,
component
:
'@/pages/classAndProperty/propertyValue/addPropertyValue'
,
hideInMenu
:
true
,
},
{
path
:
'/classAndProperty/categoryAttributes'
,
name
:
'categoryAttributes'
,
icon
:
'smile'
,
component
:
'@/pages/classAndProperty/categoryAttributes'
,
},
{
path
:
'/classAndProperty/categoryAttributes/viewAttributes'
,
name
:
'viewAttributes'
,
icon
:
'smile'
,
component
:
'@/pages/classAndProperty/categoryAttributes/viewAttributes'
,
},
]
},
{
path
:
'/trademark'
,
name
:
'trademark'
,
icon
:
'smile'
,
component
:
'@/pages/trademark'
,
},
{
path
:
'/trademark/addBrand'
,
name
:
'addBrand'
,
icon
:
'smile'
,
component
:
'@/pages/trademark/addBrand'
,
},
{
path
:
'/trademark/viewBrand'
,
name
:
'viewBrand'
,
icon
:
'smile'
,
component
:
'@/pages/trademark/viewBrand'
,
},
{
path
:
'/commodity'
,
name
:
'commodity'
,
icon
:
'smile'
,
routes
:
[
{
path
:
'/commodity/goods'
,
name
:
'goods'
,
icon
:
'smile'
,
component
:
'@/pages/commodity/goods'
,
},
{
path
:
'/commodity/goods/addGoods'
,
name
:
'addGoods'
,
icon
:
'smile'
,
component
:
'@/pages/commodity/goods/addGoods'
,
},
{
path
:
'/commodity/products'
,
name
:
'products'
,
icon
:
'smile'
,
component
:
'@/pages/commodity/products'
,
},
{
path
:
'/commodity/products/addProducts'
,
name
:
'addProducts'
,
icon
:
'smile'
,
component
:
'@/pages/commodity/products/addProducts'
,
},
{
path
:
'/commodity/products/viewProducts'
,
name
:
'viewProducts'
,
icon
:
'smile'
,
component
:
'@/pages/commodity/products/viewProducts'
,
},
{
path
:
'/commodity/products/fastModifyPrice'
,
name
:
'fastModifyPrice'
,
icon
:
'smile'
,
component
:
'@/pages/commodity/products/fastModifyPrice'
,
},
{
path
:
'/commodity/products/directChannel'
,
name
:
'directChannel'
,
icon
:
'smile'
,
component
:
'@/pages/commodity/products/directChannel'
,
},
{
path
:
'/commodity/products/addDirectChannel'
,
name
:
'addDirectChannel'
,
icon
:
'smile'
,
component
:
'@/pages/commodity/products/addDirectChannel'
,
},
{
path
:
'/commodity/products/viewDirectChannel'
,
name
:
'viewDirectChannel'
,
icon
:
'smile'
,
component
:
'@/pages/commodity/products/viewDirectChannel'
,
},
]
},
{
path
:
'/repositories'
,
name
:
'repositories'
,
icon
:
'smile'
,
component
:
'./repositories'
,
redirect
:
'/home'
},
{
path
:
'/repositories/addRepository'
,
name
:
'addRepository'
,
// 首页
path
:
'/home'
,
name
:
'home'
,
icon
:
'smile'
,
component
:
'./repositories/addRepository'
,
},
{
path
:
'/repositories/adjustRepository'
,
name
:
'adjustRepository'
,
icon
:
'smile'
,
component
:
'./repositories/adjustRepository'
,
},
{
path
:
'/repositories/viewRepository'
,
name
:
'viewRepository'
,
icon
:
'smile'
,
component
:
'./repositories/viewRepository'
,
key
:
'home'
,
component
:
'@/pages/index'
,
},
...
routes
,
{
component
:
'@/pages/404'
,
},
...
...
config/routes/commodityRoute.ts
0 → 100644
View file @
1b23a0d7
/*
* 商品能力路由
* @Author: ghua
* @Date: 2020-07-10 11:36:32
* @Last Modified by: ghua
* @Last Modified time: 2020-07-10 15:37:39
*/
const
CommodityRoute
=
{
// 商品能力
path
:
'/commodityAbility'
,
name
:
'commodityAbility'
,
key
:
'commodityAbility'
,
routes
:
[
{
path
:
'/commodityAbility/classAndProperty'
,
name
:
'classAndProperty'
,
key
:
'classAndProperty'
,
routes
:
[
{
path
:
'/commodityAbility/classAndProperty/class'
,
name
:
'class'
,
icon
:
'smile'
,
component
:
'@/pages/classAndProperty/class'
,
},
{
path
:
'/commodityAbility/classAndProperty/attribute'
,
name
:
'attribute'
,
icon
:
'smile'
,
component
:
'@/pages/classAndProperty/attribute'
,
},
{
path
:
'/commodityAbility/classAndProperty/attribute/addAttribute'
,
name
:
'addAttribute'
,
icon
:
'smile'
,
component
:
'@/pages/classAndProperty/attribute/addAttribute'
,
hideInMenu
:
true
,
},
{
path
:
'/commodityAbility/classAndProperty/propertyValue'
,
name
:
'propertyValue'
,
icon
:
'smile'
,
component
:
'@/pages/classAndProperty/propertyValue'
,
},
{
path
:
'/commodityAbility/classAndProperty/propertyValue/addPropertyValue'
,
name
:
'addPropertyValue'
,
icon
:
'smile'
,
component
:
'@/pages/classAndProperty/propertyValue/addPropertyValue'
,
hideInMenu
:
true
,
},
{
path
:
'/commodityAbility/classAndProperty/categoryAttributes'
,
name
:
'categoryAttributes'
,
icon
:
'smile'
,
component
:
'@/pages/classAndProperty/categoryAttributes'
,
},
{
path
:
'/commodityAbility/classAndProperty/categoryAttributes/viewAttributes'
,
name
:
'viewAttributes'
,
hideInMenu
:
true
,
icon
:
'smile'
,
component
:
'@/pages/classAndProperty/categoryAttributes/viewAttributes'
,
},
]
},
{
path
:
'/commodityAbility/trademark'
,
name
:
'trademark'
,
icon
:
'smile'
,
component
:
'@/pages/trademark'
,
},
{
path
:
'/commodityAbility/trademark/addBrand'
,
name
:
'addBrand'
,
icon
:
'smile'
,
hideInMenu
:
true
,
component
:
'@/pages/trademark/addBrand'
,
},
{
path
:
'/commodityAbility/trademark/viewBrand'
,
name
:
'viewBrand'
,
hideInMenu
:
true
,
icon
:
'smile'
,
component
:
'@/pages/trademark/viewBrand'
,
},
{
path
:
'/commodityAbility/commodity'
,
name
:
'commodity'
,
icon
:
'smile'
,
routes
:
[
{
path
:
'/commodityAbility/commodity/goods'
,
name
:
'goods'
,
icon
:
'smile'
,
component
:
'@/pages/commodity/goods'
,
},
{
path
:
'/commodityAbility/commodity/goods/addGoods'
,
name
:
'addGoods'
,
hideInMenu
:
true
,
icon
:
'smile'
,
component
:
'@/pages/commodity/goods/addGoods'
,
},
{
path
:
'/commodityAbility/commodity/products'
,
name
:
'products'
,
icon
:
'smile'
,
component
:
'@/pages/commodity/products'
,
},
{
path
:
'/commodityAbility/commodity/products/addProducts'
,
name
:
'addProducts'
,
hideInMenu
:
true
,
icon
:
'smile'
,
component
:
'@/pages/commodity/products/addProducts'
,
},
{
path
:
'/commodityAbility/commodity/products/viewProducts'
,
name
:
'viewProducts'
,
hideInMenu
:
true
,
icon
:
'smile'
,
component
:
'@/pages/commodity/products/viewProducts'
,
},
{
path
:
'/commodityAbility/commodity/products/fastModifyPrice'
,
name
:
'fastModifyPrice'
,
icon
:
'smile'
,
component
:
'@/pages/commodity/products/fastModifyPrice'
,
},
{
path
:
'/commodityAbility/commodity/products/directChannel'
,
name
:
'directChannel'
,
icon
:
'smile'
,
component
:
'@/pages/commodity/products/directChannel'
,
},
{
path
:
'/commodityAbility/commodity/products/addDirectChannel'
,
name
:
'addDirectChannel'
,
hideInMenu
:
true
,
icon
:
'smile'
,
component
:
'@/pages/commodity/products/addDirectChannel'
,
},
{
path
:
'/commodityAbility/commodity/products/viewDirectChannel'
,
name
:
'viewDirectChannel'
,
hideInMenu
:
true
,
icon
:
'smile'
,
component
:
'@/pages/commodity/products/viewDirectChannel'
,
},
]
},
{
path
:
'/commodityAbility/repositories'
,
name
:
'repositories'
,
icon
:
'smile'
,
component
:
'./repositories'
,
},
{
path
:
'/commodityAbility/repositories/addRepository'
,
name
:
'addRepository'
,
icon
:
'smile'
,
hideInMenu
:
true
,
component
:
'./repositories/addRepository'
,
},
{
path
:
'/commodityAbility/repositories/adjustRepository'
,
name
:
'adjustRepository'
,
icon
:
'smile'
,
hideInMenu
:
true
,
component
:
'./repositories/adjustRepository'
,
},
{
path
:
'/commodityAbility/repositories/viewRepository'
,
name
:
'viewRepository'
,
icon
:
'smile'
,
hideInMenu
:
true
,
component
:
'./repositories/viewRepository'
,
},
]
}
export
default
CommodityRoute
config/routes/index.ts
0 → 100644
View file @
1b23a0d7
import
{
default
as
CommodityRoute
}
from
'./commodityRoute'
import
{
default
as
MemberRoute
}
from
'./memberRoute'
const
routes
=
[
CommodityRoute
,
MemberRoute
]
export
default
routes
\ No newline at end of file
config/routes/memberRoute.ts
0 → 100644
View file @
1b23a0d7
const
MemberRoute
=
{
// 会员能力
path
:
'/memberAbility'
,
name
:
'memberAbility'
,
key
:
'memberAbility'
,
icon
:
'smile'
,
routes
:
[
{
path
:
'/memberAbility/manage'
,
name
:
'memberManage'
,
key
:
'memberManage'
,
routes
:
[
{
path
:
'/memberAbility/manage/import'
,
name
:
'memberImport'
,
component
:
'@/pages/index'
,
}
]
}
]
}
export
default
MemberRoute
\ No newline at end of file
src/layouts/BasicLayout.tsx
View file @
1b23a0d7
...
...
@@ -3,6 +3,7 @@ import ProLayout, {
BasicLayoutProps
as
ProLayoutProps
,
Settings
,
DefaultFooter
,
getMenuData
}
from
'@ant-design/pro-layout'
;
import
React
,
{
useState
,
useEffect
}
from
'react'
;
import
{
Link
,
useIntl
}
from
'umi'
;
...
...
@@ -18,8 +19,10 @@ export interface BasicLayoutProps extends ProLayoutProps {
};
route
:
ProLayoutProps
[
'route'
]
&
{
authority
:
string
[];
routes
:
Array
<
any
>
};
settings
:
Settings
;
location
:
any
;
// dispatch: Dispatch;
}
export
type
BasicLayoutContext
=
{
[
K
in
'location'
]:
BasicLayoutProps
[
K
]
}
&
{
...
...
@@ -41,35 +44,42 @@ const BasicLayout: React.FC<BasicLayoutProps> = (props) => {
children
,
// collapsed,
settings
,
location
=
{
pathname
:
'/'
,
},
location
,
}
=
props
;
const
[
openKeys
,
setOpenKeys
]
=
useState
<
string
[]
>
([])
const
[
collapsed
,
setCollapsed
]
=
useState
(
false
)
// useEffect(() => {
// if (dispatch) {
// dispatch({
// type: 'user/fetchCurrent',
// });
// }
// }, []);
const
handleMenuCollapse
=
(
payload
:
boolean
):
void
=>
{
// if (dispatch) {
// dispatch({
// type: 'global/changeLayoutCollapsed',
// payload,
// });
// }
setCollapsed
(
payload
)
console
.
log
(
'点击了缩起'
,
payload
)
};
const
getMenuRouter
=
(
routes
:
any
,
pathname
:
any
)
=>
{
let
list
=
routes
.
filter
((
item
:
any
)
=>
pathname
.
indexOf
(
item
.
key
)
>
-
1
)
return
list
[
0
]
}
const
initOpendKeys
=
(
routes
:
any
)
=>
{
if
(
routes
)
{
return
routes
.
map
((
item
:
any
)
=>
item
.
key
)
}
return
[]
}
const
{
formatMessage
}
=
useIntl
();
const
basicInfo
=
getMenuData
(
props
.
route
.
routes
,
{
locale
:
true
},
formatMessage
)
const
menuData
=
basicInfo
.
menuData
const
menuRouter
=
getMenuRouter
(
menuData
,
location
.
pathname
)
if
(
menuRouter
&&
menuRouter
.
children
)
{
useEffect
(()
=>
{
setOpenKeys
(
initOpendKeys
(
menuRouter
.
children
))
},
[
location
.
pathname
])
}
return
(
<
ProLayout
style=
{
{
minHeight
:
'100vh'
}
}
style=
{
{
minHeight
:
'100vh'
}
}
logo=
{
logo
}
formatMessage=
{
formatMessage
}
menuHeaderRender=
{
(
logoDom
,
titleDom
)
=>
(
...
...
@@ -80,9 +90,16 @@ const BasicLayout: React.FC<BasicLayoutProps> = (props) => {
)
}
onCollapse=
{
handleMenuCollapse
}
breadcrumbRender=
{
(
routers
=
[])
=>
[
]
}
menuRender=
{
()
=>
<
MenuSlider
collapseState=
{
collapsed
}
/>
}
menuRender=
{
()
=>
<
MenuSlider
currentSelectKey=
{
[
location
.
pathname
]
}
openKeys=
{
openKeys
}
menuData=
{
menuData
}
pathname=
{
location
.
pathname
}
collapseState=
{
collapsed
}
changeOpenKeys=
{
(
keys
:
string
[])
=>
setOpenKeys
(
keys
)
}
/>
}
footerRender=
{
()
=>
defaultFooterDom
}
rightContentRender=
{
()
=>
<
RightContent
/>
}
{
...
props
}
...
...
src/layouts/components/MenuSlider.tsx
View file @
1b23a0d7
import
React
,
{
useState
}
from
'react'
import
React
,
{
useState
}
from
'react'
import
{
Layout
,
Menu
}
from
'antd'
import
{
Link
}
from
'umi'
;
import
{
import
{
Link
,
history
}
from
'umi'
;
import
{
BorderOutlined
,
}
from
'@ant-design/icons'
}
from
'@ant-design/icons'
import
OuterSider
from
'./OuterSide'
import
'../styles/MenuSlider.less'
...
...
@@ -12,69 +12,83 @@ const { SubMenu } = Menu;
export
interface
MenuSliderProps
{
collapseState
:
boolean
|
undefined
;
menuData
:
Array
<
any
>
;
pathname
:
string
|
undefined
;
currentSelectKey
:
string
[];
openKeys
:
string
[];
changeOpenKeys
:
Function
;
}
const
MenuSlider
:
React
.
FC
<
MenuSliderProps
>
=
(
props
)
=>
{
const
MenuSlider
:
React
.
FC
<
MenuSliderProps
>
=
(
props
)
=>
{
const
{
menuData
,
pathname
,
currentSelectKey
=
[],
openKeys
=
[],
changeOpenKeys
}
=
props
const
[
innerCollapsed
,
setInnerCollapsed
]
=
useState
(
false
)
let
menuItemsCache
=
null
const
getMenuRouter
=
(
routes
:
any
,
pathname
:
any
)
=>
{
let
list
=
routes
.
filter
((
item
:
any
)
=>
pathname
.
indexOf
(
item
.
key
)
>
-
1
)
return
list
[
0
]
}
const
getMenus
=
(
menuArray
:
any
,
hasChildren
:
boolean
=
false
)
=>
{
if
(
!!
menuArray
&&
menuArray
.
length
>
0
)
{
return
menuArray
.
map
((
item
:
any
)
=>
{
if
(
item
.
hideInMenu
)
{
return
null
}
if
(
item
.
children
)
{
return
(
<
SubMenu
key=
{
item
.
key
}
title=
{
item
.
name
}
>
{
getMenus
(
item
.
children
,
true
)
}
</
SubMenu
>
)
}
return
(
<
Menu
.
Item
key=
{
item
.
path
}
className=
{
hasChildren
?
"menuItem"
:
""
}
>
{
hasChildren
&&
<
BorderOutlined
rotate=
{
45
}
style=
{
{
fontSize
:
6
,
verticalAlign
:
'middle'
}
}
/>
}
<
Link
to=
{
item
.
path
}
>
<
span
>
{
item
.
name
}
</
span
>
</
Link
>
</
Menu
.
Item
>
)
});
}
}
const
menuRouter
=
getMenuRouter
(
menuData
,
pathname
)
console
.
log
(
menuRouter
,
"menuRouter"
)
if
(
menuRouter
&&
menuRouter
.
children
)
{
menuItemsCache
=
getMenus
(
menuRouter
.
children
)
}
const
handleOpenchange
=
(
keys
:
string
[])
=>
{
changeOpenKeys
(
keys
)
}
return
<>
<
OuterSider
/>
<
OuterSider
{
...
props
}
/>
<
Sider
theme=
"light"
collapsed=
{
props
.
collapseState
}
>
<
div
className=
"logo"
>
LOGOLOGOGOG
</
div
>
<
div
className=
"menuTitle"
>
{
menuRouter
.
name
}
</
div
>
<
Menu
defaultSelectedKeys=
{
[
'1'
]
}
defaultOpenKeys=
{
[
'sub1'
]
}
className=
"menuSlider"
// defaultSelectedKeys={['1']}
// defaultOpenKeys={['sub1']}
onOpenChange=
{
handleOpenchange
}
selectedKeys=
{
currentSelectKey
}
openKeys=
{
openKeys
}
mode=
"inline"
inlineCollapsed=
{
innerCollapsed
}
>
<
Menu
.
Item
key=
"1"
>
通用
</
Menu
.
Item
>
<
Menu
.
Item
key=
"2"
>
<
Link
to=
"/"
>
首页
</
Link
>
</
Menu
.
Item
>
<
SubMenu
key=
"sub1"
title=
"商品品类及属性"
>
<
Menu
.
Item
key=
"5"
>
<
BorderOutlined
rotate=
{
45
}
style=
{
{
fontSize
:
6
,
verticalAlign
:
'middle'
}
}
/>
<
Link
to=
"/classAndProperty/class"
>
品类
</
Link
>
</
Menu
.
Item
>
<
Menu
.
Item
key=
"6"
>
<
BorderOutlined
rotate=
{
45
}
style=
{
{
fontSize
:
6
,
verticalAlign
:
'middle'
}
}
/>
<
Link
to=
"/classAndProperty/attribute"
>
属性
</
Link
>
</
Menu
.
Item
>
<
Menu
.
Item
key=
"7"
>
<
BorderOutlined
rotate=
{
45
}
style=
{
{
fontSize
:
6
,
verticalAlign
:
'middle'
}
}
/>
<
Link
to=
"/classAndProperty/propertyValue"
>
属性值
</
Link
>
</
Menu
.
Item
>
<
Menu
.
Item
key=
"8"
>
<
BorderOutlined
rotate=
{
45
}
style=
{
{
fontSize
:
6
,
verticalAlign
:
'middle'
}
}
/>
<
Link
to=
"/classAndProperty/categoryAttributes"
>
品类属性
</
Link
>
</
Menu
.
Item
>
</
SubMenu
>
<
Menu
.
Item
key=
"3"
>
<
Link
to=
"/trademark"
>
品牌
</
Link
>
</
Menu
.
Item
>
<
SubMenu
key=
"sub2"
title=
"商品"
>
<
Menu
.
Item
key=
"9"
>
<
BorderOutlined
rotate=
{
45
}
style=
{
{
fontSize
:
6
,
verticalAlign
:
'middle'
}
}
/>
<
Link
to=
"/commodity/goods"
>
货品
</
Link
>
</
Menu
.
Item
>
<
Menu
.
Item
key=
"10"
>
<
BorderOutlined
rotate=
{
45
}
style=
{
{
fontSize
:
6
,
verticalAlign
:
'middle'
}
}
/>
<
Link
to=
"/commodity/products"
>
商品
</
Link
>
</
Menu
.
Item
>
<
Menu
.
Item
key=
"11"
>
<
BorderOutlined
rotate=
{
45
}
style=
{
{
fontSize
:
6
,
verticalAlign
:
'middle'
}
}
/>
<
Link
to=
"/commodity/products/fastModifyPrice"
>
快捷修改单价
</
Link
>
</
Menu
.
Item
>
<
Menu
.
Item
key=
"12"
>
<
BorderOutlined
rotate=
{
45
}
style=
{
{
fontSize
:
6
,
verticalAlign
:
'middle'
}
}
/>
<
Link
to=
"/commodity/products/directChannel"
>
渠道直采商品
</
Link
>
</
Menu
.
Item
>
</
SubMenu
>
<
Menu
.
Item
key=
"4"
>
<
Link
to=
"/repositories"
>
仓位
</
Link
>
</
Menu
.
Item
>
{
menuItemsCache
}
</
Menu
>
</
Sider
>
</>
...
...
src/layouts/components/OuterSide.tsx
View file @
1b23a0d7
import
React
from
'react'
import
{
Layout
,
Menu
}
from
'antd'
import
{
AppstoreOutlined
}
from
'@ant-design/icons'
import
{
Link
}
from
'umi'
import
'../styles/MenuSlider.less'
const
{
Sider
}
=
Layout
export
interface
OuterSiderProps
{}
export
interface
OuterSiderProps
{
menuData
:
Array
<
any
>
;
pathname
:
string
|
undefined
;
}
const
OuterSider
:
React
.
FC
<
OuterSiderProps
>
=
(
props
)
=>
{
const
{
menuData
,
pathname
=
"/"
}
=
props
let
defaultSelectedKeys
:
string
=
""
const
getSubMenu
=
()
=>
{
const
subHeadMenus
:
Array
<
any
>
=
[]
menuData
.
forEach
(
item
=>
{
if
(
pathname
.
indexOf
(
item
.
key
)
>
-
1
)
{
defaultSelectedKeys
=
item
.
key
}
const
OuterSider
:
React
.
FC
<
OuterSiderProps
>
=
(
props
)
=>
{
subHeadMenus
.
push
({
path
:
item
.
path
,
title
:
item
.
name
,
icon
:
item
.
icon
,
key
:
item
.
key
})
})
return
subHeadMenus
}
const
siderMunu
=
getSubMenu
()
return
<>
<
Sider
collapsed=
{
true
}
collapsedWidth=
{
64
}
className=
"wrapperSilder"
>
<
div
className=
"userPic"
/>
<
ul
className=
"menuBox"
>
<
li
className=
"currentItem"
>
<
a
>
<
AppstoreOutlined
/>
<
span
>
通用
</
span
>
</
a
>
</
li
>
<
li
>
<
a
>
<
AppstoreOutlined
/>
<
span
>
渠道
</
span
>
</
a
>
</
li
>
<
li
>
<
a
>
<
AppstoreOutlined
/>
<
span
>
采购
</
span
>
</
a
>
</
li
>
<
li
>
<
a
>
<
AppstoreOutlined
/>
<
span
>
供应
</
span
>
</
a
>
</
li
>
<
li
>
<
a
>
<
AppstoreOutlined
/>
<
span
>
加工
</
span
>
</
a
>
</
li
>
<
li
>
<
a
>
<
AppstoreOutlined
/>
<
span
>
物流
</
span
>
</
a
>
</
li
>
{
siderMunu
.
map
(
item
=>
(
<
li
key=
{
item
.
key
}
className=
{
defaultSelectedKeys
===
item
.
key
?
"currentItem"
:
''
}
>
<
Link
to=
{
item
.
path
}
>
<
AppstoreOutlined
/>
<
span
>
{
item
.
title
}
</
span
>
</
Link
>
</
li
>
))
}
</
ul
>
{
/* <Menu mode="inline" defaultSelectedKeys={['1']}>
<Menu.Item key="1">
...
...
src/layouts/styles/MenuSlider.less
View file @
1b23a0d7
.logo{
.logo
{
height: 32px;
background: rgba(255, 255, 255, 1);
margin: 16px;
}
.menuTitle {
height: 64px;
font-size: 14px;
color: #6B778C;
display: flex;
align-items: center;
padding-left: 24px;
border-top: 1px solid #F4F5F7;
border-right: 1px solid #F4F5F7;
}
// 外层导航
.userPic{
.userPic
{
height: 32px;
width: 32px;
background: rgba(255, 255, 255, 0.2);
margin: 16px;
border-radius: 50%;
}
.wrapperSilder{
.wrapperSilder {
background-color: #38414A;
.menuBox{
.menuBox {
padding: 0;
text-align: center;
li{
li {
height: 60px;
line-height: 60px;
margin: 28px 0;
span{
span {
display: block;
height:24px;
font-size:12px;
font-weight:400;
color:rgba(151,160,175,1);
line-height:24px;
& :first-child{
height: 24px;
font-size: 12px;
font-weight: 400;
color: rgba(151, 160, 175, 1);
line-height: 24px;
& :first-child {
font-size: 24px;
}
}
}
}
}
.currentItem{
span{
.currentItem {
span {
color: #fff !important;
}
}
.menuItem {
padding-left: 30px !important;
}
.ant-menu-submenu-open {
.ant-menu-submenu-title {
background: rgba(0, 0, 0, 0.02);
}
}
.menuSlider {
.ant-menu-submenu-title {
height: 48px !important;
line-height: 48px !important;
}
}
\ No newline at end of file
src/locales/zh-CN.ts
View file @
1b23a0d7
import
menu
from
'./zh-CN/menu'
export
default
{
'menu.welcome'
:
'欢迎'
,
'menu.home'
:
'首页'
,
'menu.admin'
:
'管理页'
,
'menu.admin.sub-page'
:
'二级管理页'
,
'menu.login'
:
'登录'
,
'menu.register'
:
'注册'
,
'menu.register.result'
:
'注册结果'
,
'menu.exception.403'
:
'403'
,
'menu.exception.404'
:
'404'
,
'menu.exception.500'
:
'500'
,
//
'menu.classAndProperty'
:
'商品品类及属性'
,
'menu.classAndProperty.class'
:
'品类'
,
'menu.classAndProperty.attribute'
:
'属性'
,
'menu.classAndProperty.addAttribute'
:
'新建属性'
,
'menu.classAndProperty.propertyValue'
:
'属性值'
,
'menu.classAndProperty.addPropertyValue'
:
'新建属性值'
,
'menu.classAndProperty.categoryAttributes'
:
'品类属性'
,
'menu.classAndProperty.viewAttributes'
:
'品类属性'
,
'menu.trademark'
:
'品牌'
,
'menu.addBrand'
:
'新建品牌'
,
'menu.viewBrand'
:
'品牌详情'
,
'menu.commodity'
:
'商品'
,
'menu.commodity.goods'
:
'货品'
,
'menu.commodity.addGoods'
:
'新建货品'
,
'menu.commodity.products'
:
'商品'
,
'menu.commodity.addProducts'
:
'新建商品'
,
'menu.commodity.viewProducts'
:
'商品详情'
,
'menu.commodity.fastModifyPrice'
:
'快捷修改单价'
,
'menu.commodity.directChannel'
:
'渠道直采商品'
,
'menu.commodity.addDirectChannel'
:
'新建渠道直采商品'
,
'menu.commodity.viewDirectChannel'
:
'渠道直采商品详情'
,
'menu.repositories'
:
'仓位'
,
'menu.addRepository'
:
'新建仓位'
,
'menu.adjustRepository'
:
'仓位库存调拨'
,
'menu.viewRepository'
:
'查看仓位库存'
,
};
\ No newline at end of file
'global.siteName'
:
'瓴犀'
,
...
menu
,
}
\ No newline at end of file
src/locales/zh-CN/menu.ts
0 → 100644
View file @
1b23a0d7
export
default
{
'menu.welcome'
:
'欢迎'
,
'menu.home'
:
'首页'
,
'menu.admin'
:
'管理页'
,
'menu.admin.sub-page'
:
'二级管理页'
,
'menu.login'
:
'登录'
,
'menu.register'
:
'注册'
,
'menu.register.result'
:
'注册结果'
,
'menu.exception.403'
:
'403'
,
'menu.exception.404'
:
'404'
,
'menu.exception.500'
:
'500'
,
//商品能力
'menu.commodityAbility'
:
'商品'
,
'menu.commodityAbility.classAndProperty'
:
'品类及属性'
,
'menu.commodityAbility.classAndProperty.class'
:
'品类'
,
'menu.commodityAbility.classAndProperty.attribute'
:
'属性'
,
'menu.commodityAbility.classAndProperty.addAttribute'
:
'新建属性'
,
'menu.commodityAbility.classAndProperty.propertyValue'
:
'属性值'
,
'menu.commodityAbility.classAndProperty.addPropertyValue'
:
'新建属性值'
,
'menu.commodityAbility.classAndProperty.categoryAttributes'
:
'关联品类属性'
,
'menu.commodityAbility.classAndProperty.viewAttributes'
:
'品类属性'
,
'menu.commodityAbility.trademark'
:
'品牌'
,
'menu.commodityAbility.addBrand'
:
'新建品牌'
,
'menu.commodityAbility.viewBrand'
:
'品牌详情'
,
'menu.commodityAbility.commodity'
:
'商品'
,
'menu.commodityAbility.commodity.goods'
:
'货品'
,
'menu.commodityAbility.commodity.addGoods'
:
'新建货品'
,
'menu.commodityAbility.commodity.products'
:
'商品'
,
'menu.commodityAbility.commodity.addProducts'
:
'新建商品'
,
'menu.commodityAbility.commodity.viewProducts'
:
'商品详情'
,
'menu.commodityAbility.commodity.fastModifyPrice'
:
'快捷修改单价'
,
'menu.commodityAbility.commodity.directChannel'
:
'渠道直采商品'
,
'menu.commodityAbility.commodity.addDirectChannel'
:
'新建渠道直采商品'
,
'menu.commodityAbility.commodity.viewDirectChannel'
:
'渠道直采商品详情'
,
'menu.commodityAbility.repositories'
:
'仓位'
,
'menu.commodityAbility.addRepository'
:
'新建仓位'
,
'menu.commodityAbility.adjustRepository'
:
'仓位库存调拨'
,
'menu.commodityAbility.viewRepository'
:
'查看仓位库存'
,
// 会员能力
'menu.memberAbility'
:
'会员'
,
'menu.memberAbility.memberManage'
:
'会员管理'
,
'menu.memberAbility.memberManage.memberImport'
:
'会员导入'
,
};
\ No newline at end of file
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