Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
S
sage-front-framework
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
郁骅焌
sage-front-framework
Commits
84a61eca
提交
84a61eca
authored
6月 09, 2020
作者:
郁骅焌
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
菜单控制
上级
a104a24e
显示空白字符变更
内嵌
并排
正在显示
17 个修改的文件
包含
88 行增加
和
31 行删除
+88
-31
app.jsx
src/app.jsx
+4
-0
index.jsx
src/components/TabBar/index.jsx
+4
-2
BasicLayout.jsx
src/layouts/BasicLayout.jsx
+40
-4
login.js
src/models/login.js
+2
-0
user.js
src/models/user.js
+1
-1
CreateForm.jsx
src/pages/dept/components/CreateForm.jsx
+7
-7
UpdateForm.jsx
src/pages/dept/components/UpdateForm.jsx
+5
-6
index.jsx
src/pages/dept/index.jsx
+2
-2
CreateForm.jsx
src/pages/menu/components/CreateForm.jsx
+2
-3
UpdateForm.jsx
src/pages/menu/components/UpdateForm.jsx
+1
-2
index.jsx
src/pages/menu/index.jsx
+1
-1
CreateForm.jsx
src/pages/role/components/CreateForm.jsx
+4
-0
UpdateForm.jsx
src/pages/role/components/UpdateForm.jsx
+5
-1
index.jsx
src/pages/role/index.jsx
+1
-1
CreateForm.jsx
src/pages/user/manage/components/CreateForm.jsx
+4
-0
UpdateForm.jsx
src/pages/user/manage/components/UpdateForm.jsx
+4
-0
index.jsx
src/pages/user/manage/index.jsx
+1
-1
没有找到文件。
src/app.jsx
浏览文件 @
84a61eca
export
function
patchRoutes
({
routes
})
{
console
.
log
(
JSON
.
parse
(
localStorage
.
menuTree
))
console
.
log
(
routes
)
}
src/components/TabBar/index.jsx
浏览文件 @
84a61eca
...
@@ -4,6 +4,8 @@ import { ReloadOutlined } from '@ant-design/icons';
...
@@ -4,6 +4,8 @@ import { ReloadOutlined } from '@ant-design/icons';
import
{
useLocation
,
useIntl
,
history
,
dropByCacheKey
}
from
'umi'
;
import
{
useLocation
,
useIntl
,
history
,
dropByCacheKey
}
from
'umi'
;
import
'./style.less'
;
import
'./style.less'
;
const
{
REACT_APP_ENV
}
=
process
.
env
;
const
{
TabPane
}
=
Tabs
;
const
{
TabPane
}
=
Tabs
;
const
TabBar
=
(
props
,
ref
)
=>
{
const
TabBar
=
(
props
,
ref
)
=>
{
...
@@ -49,7 +51,7 @@ const TabBar = (props, ref) => {
...
@@ -49,7 +51,7 @@ const TabBar = (props, ref) => {
if
(
p
)
{
if
(
p
)
{
const
newPanes
=
panes
.
slice
();
const
newPanes
=
panes
.
slice
();
newPanes
.
push
({
newPanes
.
push
({
title
:
formatMessage
({
id
:
p
.
menuName
})
,
title
:
REACT_APP_ENV
===
'dev'
?
formatMessage
({
id
:
p
.
menuName
})
:
p
.
menuName
,
key
:
path
,
key
:
path
,
});
});
setPanes
(
newPanes
);
setPanes
(
newPanes
);
...
@@ -86,7 +88,7 @@ const TabBar = (props, ref) => {
...
@@ -86,7 +88,7 @@ const TabBar = (props, ref) => {
if
(
p
)
{
if
(
p
)
{
const
newPanes
=
panes
.
slice
();
const
newPanes
=
panes
.
slice
();
newPanes
.
push
({
newPanes
.
push
({
title
:
formatMessage
({
id
:
p
.
menuName
})
,
title
:
REACT_APP_ENV
===
'dev'
?
formatMessage
({
id
:
p
.
menuName
})
:
p
.
menuName
,
key
:
pathname
,
key
:
pathname
,
});
});
setPanes
(
newPanes
);
setPanes
(
newPanes
);
...
...
src/layouts/BasicLayout.jsx
浏览文件 @
84a61eca
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
import
ProLayout
,
{
DefaultFooter
}
from
'@ant-design/pro-layout'
;
import
ProLayout
,
{
DefaultFooter
}
from
'@ant-design/pro-layout'
;
import
React
,
{
useState
,
useEffect
,
useRef
,
useMemo
}
from
'react'
;
import
React
,
{
useState
,
useEffect
,
useRef
,
useMemo
}
from
'react'
;
import
{
Link
,
useIntl
,
connect
,
history
,
FormattedMessage
,
KeepAliveLayout
}
from
'umi'
;
import
{
Link
,
useIntl
,
connect
,
history
,
FormattedMessage
,
KeepAliveLayout
}
from
'umi'
;
import
{
GithubOutlined
,
MenuFoldOutlined
,
MenuUnfoldOutlined
}
from
'@ant-design/icons'
;
import
{
createFromIconfontCN
,
GithubOutlined
,
MenuFoldOutlined
,
MenuUnfoldOutlined
}
from
'@ant-design/icons'
;
import
{
Result
,
Button
,
Menu
}
from
'antd'
;
import
{
Result
,
Button
,
Menu
}
from
'antd'
;
import
Authorized
from
'@/utils/Authorized'
;
import
Authorized
from
'@/utils/Authorized'
;
import
RightContent
from
'@/components/GlobalHeader/RightContent'
;
import
RightContent
from
'@/components/GlobalHeader/RightContent'
;
...
@@ -17,6 +17,12 @@ import logo from '../assets/logo.svg';
...
@@ -17,6 +17,12 @@ import logo from '../assets/logo.svg';
import
'./BasicLayout.less'
import
'./BasicLayout.less'
const
{
REACT_APP_ENV
}
=
process
.
env
;
const
IconFont
=
createFromIconfontCN
({
scriptUrl
:
'//at.alicdn.com/t/font_1873986_46xeik9dra8.js'
,
});
const
{
SubMenu
}
=
Menu
;
const
{
SubMenu
}
=
Menu
;
const
noMatch
=
(
const
noMatch
=
(
...
@@ -111,6 +117,8 @@ const BasicLayout = (props) => {
...
@@ -111,6 +117,8 @@ const BasicLayout = (props) => {
// 处理菜单数据
// 处理菜单数据
const
disposeMenu
=
(
list
,
pname
,
pitem
)
=>
{
const
disposeMenu
=
(
list
,
pname
,
pitem
)
=>
{
if
(
REACT_APP_ENV
===
'dev'
)
{
list
.
forEach
(
item
=>
{
list
.
forEach
(
item
=>
{
const
menuName
=
pname
?
`
${
pname
}
.
${
item
.
name
}
`
:
`menu.
${
item
.
name
}
`
const
menuName
=
pname
?
`
${
pname
}
.
${
item
.
name
}
`
:
`menu.
${
item
.
name
}
`
item
.
menuName
=
menuName
item
.
menuName
=
menuName
...
@@ -121,17 +129,43 @@ const BasicLayout = (props) => {
...
@@ -121,17 +129,43 @@ const BasicLayout = (props) => {
disposeMenu
(
item
.
children
,
menuName
,
item
)
disposeMenu
(
item
.
children
,
menuName
,
item
)
}
}
})
})
}
else
{
list
.
forEach
(
item
=>
{
item
.
path
=
item
.
url
if
(
item
.
parentId
!==
0
)
{
item
.
parentPath
=
pitem
.
path
}
if
(
item
.
children
)
{
if
(
item
.
children
.
length
!==
0
)
{
disposeMenu
(
item
.
children
,
item
.
menuName
,
item
)
}
else
{
delete
item
.
children
}
}
})
}
return
list
return
list
}
}
// 获取菜单
// 获取菜单
const
getMenuTree
=
()
=>
{
const
getMenuTree
=
()
=>
{
const
menuList
=
[]
const
menuList
=
[]
if
(
REACT_APP_ENV
===
'dev'
)
{
route
.
children
.
forEach
(
item
=>
{
route
.
children
.
forEach
(
item
=>
{
if
(
!
item
.
redirect
)
{
if
(
!
item
.
redirect
)
{
menuList
.
push
(
item
)
menuList
.
push
(
item
)
}
}
})
})
}
else
{
const
localMenuTree
=
JSON
.
parse
(
localStorage
.
menuTree
)
console
.
log
(
localMenuTree
)
localMenuTree
.
forEach
(
item
=>
{
menuList
.
push
(
item
)
})
}
return
disposeMenu
(
menuList
)
return
disposeMenu
(
menuList
)
}
}
...
@@ -141,7 +175,7 @@ const BasicLayout = (props) => {
...
@@ -141,7 +175,7 @@ const BasicLayout = (props) => {
return
menuChildren
.
map
(
item
=>
{
return
menuChildren
.
map
(
item
=>
{
if
(
item
.
children
)
{
if
(
item
.
children
)
{
return
(
return
(
<
SubMenu
key=
{
item
.
path
}
icon=
{
item
.
icon
}
title=
{
<
FormattedMessage
id=
{
item
.
menuName
}
/>
}
>
<
SubMenu
key=
{
item
.
path
}
icon=
{
<
IconFont
type=
{
`icon-${item.icon}`
}
/>
}
title=
{
REACT_APP_ENV
===
'dev'
?
<
FormattedMessage
id=
{
item
.
menuName
}
/>
:
item
.
menuName
}
>
{
{
getMenuChildren
(
item
.
children
)
getMenuChildren
(
item
.
children
)
}
}
...
@@ -149,8 +183,10 @@ const BasicLayout = (props) => {
...
@@ -149,8 +183,10 @@ const BasicLayout = (props) => {
)
)
}
}
return
(
return
(
<
Menu
.
Item
key=
{
item
.
path
}
icon=
{
item
.
icon
}
>
<
Menu
.
Item
key=
{
item
.
path
}
icon=
{
<
IconFont
type=
{
`icon-${item.icon}`
}
/>
}
>
<
FormattedMessage
id=
{
item
.
menuName
}
/>
{
REACT_APP_ENV
===
'dev'
?
<
FormattedMessage
id=
{
item
.
menuName
}
/>
:
item
.
menuName
}
</
Menu
.
Item
>
</
Menu
.
Item
>
)
)
})
})
...
...
src/models/login.js
浏览文件 @
84a61eca
...
@@ -22,6 +22,8 @@ const Model = {
...
@@ -22,6 +22,8 @@ const Model = {
},
},
});
// Login successfully
});
// Login successfully
// 菜单赋值
localStorage
.
menuTree
=
JSON
.
stringify
(
response
.
data
.
menuTree
)
const
urlParams
=
new
URL
(
window
.
location
.
href
);
const
urlParams
=
new
URL
(
window
.
location
.
href
);
const
params
=
getPageQuery
();
const
params
=
getPageQuery
();
...
...
src/models/user.js
浏览文件 @
84a61eca
...
@@ -19,7 +19,7 @@ const UserModel = {
...
@@ -19,7 +19,7 @@ const UserModel = {
if
(
response
.
isSuccess
)
{
if
(
response
.
isSuccess
)
{
const
userInfo
=
response
.
data
const
userInfo
=
response
.
data
userInfo
.
name
=
userInfo
.
user
||
'创世者'
userInfo
.
name
=
userInfo
.
loginName
||
'创世者'
userInfo
.
avatar
=
'https://gw.alipayobjects.com/zos/antfincdn/XAosXuNZyF/BiazfanxmamNRoxxVxka.png'
userInfo
.
avatar
=
'https://gw.alipayobjects.com/zos/antfincdn/XAosXuNZyF/BiazfanxmamNRoxxVxka.png'
yield
put
({
yield
put
({
...
...
src/pages/dept/components/CreateForm.jsx
浏览文件 @
84a61eca
...
@@ -112,13 +112,13 @@ const CreateForm = (props, ref) => {
...
@@ -112,13 +112,13 @@ const CreateForm = (props, ref) => {
},
},
{
{
name
:
'status'
,
name
:
'status'
,
label
:
'
部门
状态'
,
label
:
'状态'
,
type
:
'
radio
'
,
type
:
'
switch
'
,
initialValue
:
'1'
,
initialValue
:
true
,
options
:
[
props
:
{
{
value
:
'1'
,
text
:
'启用'
}
,
checkedChildren
:
'启用'
,
{
value
:
'0'
,
text
:
'禁用'
},
unCheckedChildren
:
'禁用'
]
}
},
},
]
]
...
...
src/pages/dept/components/UpdateForm.jsx
浏览文件 @
84a61eca
...
@@ -105,12 +105,11 @@ const UpdateForm = (props, ref) => {
...
@@ -105,12 +105,11 @@ const UpdateForm = (props, ref) => {
{
{
name
:
'status'
,
name
:
'status'
,
label
:
'部门状态'
,
label
:
'部门状态'
,
type
:
'radio'
,
type
:
'switch'
,
initialValue
:
'1'
,
props
:
{
options
:
[
checkedChildren
:
'启用'
,
{
value
:
'1'
,
text
:
'启用'
},
unCheckedChildren
:
'禁用'
{
value
:
'0'
,
text
:
'禁用'
},
}
]
},
},
]
]
...
...
src/pages/dept/index.jsx
浏览文件 @
84a61eca
...
@@ -100,7 +100,7 @@ const DeptList = () => {
...
@@ -100,7 +100,7 @@ const DeptList = () => {
leader
:
data
.
leader
,
leader
:
data
.
leader
,
phone
:
data
.
phone
,
phone
:
data
.
phone
,
email
:
data
.
email
,
email
:
data
.
email
,
status
:
data
.
status
status
:
data
.
status
===
'1'
})
})
}
}
...
@@ -165,7 +165,7 @@ const DeptList = () => {
...
@@ -165,7 +165,7 @@ const DeptList = () => {
title
:
'状态'
,
title
:
'状态'
,
dataIndex
:
'status'
,
dataIndex
:
'status'
,
key
:
'status'
,
key
:
'status'
,
render
:
(
text
,
record
)
=>
<
Switch
checked=
{
text
===
'1'
}
onChange=
{
(
checked
)
=>
onChangeStatus
(
checked
,
record
)
}
/>
render
:
(
text
,
record
)
=>
<
Switch
checked
Children=
"启用"
unCheckedChildren=
"禁用"
checked
=
{
text
===
'1'
}
onChange=
{
(
checked
)
=>
onChangeStatus
(
checked
,
record
)
}
/>
},
},
{
{
title
:
'创建时间'
,
title
:
'创建时间'
,
...
...
src/pages/menu/components/CreateForm.jsx
浏览文件 @
84a61eca
...
@@ -87,12 +87,11 @@ const CreateForm = (props, ref) => {
...
@@ -87,12 +87,11 @@ const CreateForm = (props, ref) => {
},
},
{
{
name
:
'url'
,
name
:
'url'
,
label
:
menuType
===
'1'
?
'路由地址'
:
'请求地址'
,
label
:
menuType
===
'
0'
||
menuType
===
'
1'
?
'路由地址'
:
'请求地址'
,
type
:
'input'
,
type
:
'input'
,
props
:
{
props
:
{
placeholder
:
'请输入'
placeholder
:
'请输入'
},
}
isShow
:
menuType
===
'1'
||
menuType
===
'2'
},
},
{
{
name
:
'target'
,
name
:
'target'
,
...
...
src/pages/menu/components/UpdateForm.jsx
浏览文件 @
84a61eca
...
@@ -81,12 +81,11 @@ const UpdateForm = (props, ref) => {
...
@@ -81,12 +81,11 @@ const UpdateForm = (props, ref) => {
},
},
{
{
name
:
'url'
,
name
:
'url'
,
label
:
menuType
===
'1'
?
'路由地址'
:
'请求地址'
,
label
:
menuType
===
'
0'
||
menuType
===
'
1'
?
'路由地址'
:
'请求地址'
,
type
:
'input'
,
type
:
'input'
,
props
:
{
props
:
{
placeholder
:
'请输入'
placeholder
:
'请输入'
},
},
isShow
:
menuType
===
'1'
||
menuType
===
'2'
},
},
{
{
name
:
'target'
,
name
:
'target'
,
...
...
src/pages/menu/index.jsx
浏览文件 @
84a61eca
...
@@ -134,7 +134,7 @@ const MenuList = () => {
...
@@ -134,7 +134,7 @@ const MenuList = () => {
dataIndex
:
'url'
,
dataIndex
:
'url'
,
key
:
'url'
,
key
:
'url'
,
width
:
200
,
width
:
200
,
render
:
(
text
,
record
)
=>
record
.
menuType
===
'1'
?
text
:
''
render
:
(
text
,
record
)
=>
record
.
menuType
===
'
0'
||
record
.
menuType
===
'
1'
?
text
:
''
},
},
{
{
title
:
'请求地址'
,
title
:
'请求地址'
,
...
...
src/pages/role/components/CreateForm.jsx
浏览文件 @
84a61eca
...
@@ -35,6 +35,10 @@ const CreateForm = (props, ref) => {
...
@@ -35,6 +35,10 @@ const CreateForm = (props, ref) => {
label
:
'状态'
,
label
:
'状态'
,
type
:
'switch'
,
type
:
'switch'
,
initialValue
:
true
,
initialValue
:
true
,
props
:
{
checkedChildren
:
'启用'
,
unCheckedChildren
:
'禁用'
}
}
}
]
]
...
...
src/pages/role/components/UpdateForm.jsx
浏览文件 @
84a61eca
...
@@ -33,7 +33,11 @@ const UpdateForm = (props, ref) => {
...
@@ -33,7 +33,11 @@ const UpdateForm = (props, ref) => {
{
{
name
:
'status'
,
name
:
'status'
,
label
:
'状态'
,
label
:
'状态'
,
type
:
'switch'
type
:
'switch'
,
props
:
{
checkedChildren
:
'启用'
,
unCheckedChildren
:
'禁用'
}
}
}
]
]
...
...
src/pages/role/index.jsx
浏览文件 @
84a61eca
...
@@ -151,7 +151,7 @@ const TableList = () => {
...
@@ -151,7 +151,7 @@ const TableList = () => {
title
:
'角色状态'
,
title
:
'角色状态'
,
dataIndex
:
'status'
,
dataIndex
:
'status'
,
key
:
'status'
,
key
:
'status'
,
render
:
(
text
,
record
)
=>
<
Switch
checked=
{
text
===
'1'
}
onChange=
{
(
checked
)
=>
onChangeStatus
(
checked
,
record
)
}
/>
render
:
(
text
,
record
)
=>
<
Switch
checked
Children=
"启用"
unCheckedChildren=
"禁用"
checked
=
{
text
===
'1'
}
onChange=
{
(
checked
)
=>
onChangeStatus
(
checked
,
record
)
}
/>
},
},
{
{
title
:
'创建时间'
,
title
:
'创建时间'
,
...
...
src/pages/user/manage/components/CreateForm.jsx
浏览文件 @
84a61eca
...
@@ -133,6 +133,10 @@ const CreateForm = (props, ref) => {
...
@@ -133,6 +133,10 @@ const CreateForm = (props, ref) => {
label
:
'状态'
,
label
:
'状态'
,
type
:
'switch'
,
type
:
'switch'
,
initialValue
:
true
,
initialValue
:
true
,
props
:
{
checkedChildren
:
'启用'
,
unCheckedChildren
:
'禁用'
}
},
},
{
{
name
:
'headImage'
,
name
:
'headImage'
,
...
...
src/pages/user/manage/components/UpdateForm.jsx
浏览文件 @
84a61eca
...
@@ -133,6 +133,10 @@ const UpdateForm = (props, ref) => {
...
@@ -133,6 +133,10 @@ const UpdateForm = (props, ref) => {
name
:
'status'
,
name
:
'status'
,
label
:
'状态'
,
label
:
'状态'
,
type
:
'switch'
,
type
:
'switch'
,
props
:
{
checkedChildren
:
'启用'
,
unCheckedChildren
:
'禁用'
}
},
},
{
{
name
:
'headImage'
,
name
:
'headImage'
,
...
...
src/pages/user/manage/index.jsx
浏览文件 @
84a61eca
...
@@ -166,7 +166,7 @@ const TableList = () => {
...
@@ -166,7 +166,7 @@ const TableList = () => {
title
:
'状态'
,
title
:
'状态'
,
dataIndex
:
'status'
,
dataIndex
:
'status'
,
key
:
'status'
,
key
:
'status'
,
render
:
(
text
,
record
)
=>
<
Switch
checked=
{
text
===
'1'
}
onChange=
{
(
checked
)
=>
onChangeStatus
(
checked
,
record
)
}
/>
render
:
(
text
,
record
)
=>
<
Switch
checked
Children=
"启用"
unCheckedChildren=
"禁用"
checked
=
{
text
===
'1'
}
onChange=
{
(
checked
)
=>
onChangeStatus
(
checked
,
record
)
}
/>
},
},
{
{
title
:
'操作'
,
title
:
'操作'
,
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论