Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
CivManage
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
ReactWeb5
CivManage
Commits
6f787970
Commit
6f787970
authored
Nov 19, 2020
by
张烨
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: fix登录权限路由菜单没有刷新
parent
328b6031
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
24 additions
and
19 deletions
+24
-19
app.js
src/app.js
+2
-2
index.js
src/containers/App/index.js
+2
-2
BasicLayout.js
src/layouts/BasicLayout.js
+7
-5
index.js
src/pages/user/login/index.js
+8
-5
config.js
src/routes/config.js
+5
-5
No files found.
src/app.js
View file @
6f787970
...
...
@@ -17,7 +17,7 @@ import zhCN from 'antd/es/locale/zh_CN';
import
configureStore
from
'./configureStore'
;
import
App
from
'./containers/App'
;
import
history
from
'./utils/history'
;
import
config
from
'./routes/config'
;
const
initialState
=
Immutable
.
Map
();
const
store
=
configureStore
(
initialState
,
history
);
const
MOUNT_NODE
=
document
.
getElementById
(
'app'
);
...
...
@@ -27,7 +27,7 @@ const render = () => {
<
Provider
store
=
{
store
}
>
<
ConnectedRouter
history
=
{
history
}
>
<
ConfigProvider
locale
=
{
zhCN
}
>
<
App
/>
<
App
routesConfig
=
{
config
}
/
>
<
/ConfigProvider
>
<
/ConnectedRouter
>
<
/Provider>
,
...
...
src/containers/App/index.js
View file @
6f787970
...
...
@@ -3,12 +3,12 @@ import { Helmet } from 'react-helmet';
import
{
renderRoutes
}
from
'react-router-config'
;
import
{
BrowserRouter
as
Router
,
Switch
}
from
'react-router-dom'
;
import
{
appConnector
}
from
'./store'
;
import
config
from
'../../routes/config'
;
import
Authozed
from
'@/utils/authority'
;
import
UserLogin
from
'@/pages/user/login'
;
import
UserLayout
from
'@/layouts/UserLayout'
;
import
{
AUTHORITY
,
BASENAME
}
from
'@/utils/constants'
;
export
default
appConnector
(
function
App
(
props
)
{
const
{
routesConfig
}
=
props
;
return
(
<>
<
Helmet
titleTemplate
=
"%s - 运维平台"
defaultTitle
=
"运维平台"
>
...
...
@@ -23,7 +23,7 @@ export default appConnector(function App(props) {
}
authority
=
{[
AUTHORITY
.
LOGIN
]}
>
<
Switch
>
{
renderRoutes
(
c
onfig
.
routes
)}
<
/Switch
>
<
Switch
>
{
renderRoutes
(
routesC
onfig
.
routes
)}
<
/Switch
>
<
/Authozed
>
<
/Router
>
<
/
>
...
...
src/layouts/BasicLayout.js
View file @
6f787970
...
...
@@ -7,6 +7,7 @@ import ProLayout, { DefaultFooter } from '@ant-design/pro-layout';
import
logo
from
'../assets/images/logo/panda-logo.svg'
;
import
RightContent
from
'../components/GlobalHeader/RightContent'
;
import
{
BASENAME
}
from
'@/utils/constants'
;
// const noMatch = (
// <Result
...
...
@@ -27,15 +28,16 @@ const defaultFooterDom = (
const
BasicLayout
=
props
=>
{
/* eslint-disable no-unused-vars */
const
[
pathname
,
setPathname
]
=
useState
(
'/welcome'
);
const
[
pathname
,
setPathname
]
=
useState
(
`/
${
BASENAME
}
`
);
const
filterMenu
=
menuRoutes
=>
menuRoutes
.
map
(
route
=>
{
if
(
route
.
routes
)
route
.
routes
=
filterMenu
(
route
.
routes
);
return
route
.
hideMenu
||
(
route
.
authority
&&
!
check
(
route
.
authority
,
true
,
false
))
const
routeCopy
=
{
...
route
};
if
(
routeCopy
.
routes
)
routeCopy
.
routes
=
filterMenu
(
routeCopy
.
routes
);
return
routeCopy
.
hideMenu
||
(
routeCopy
.
authority
&&
!
check
(
routeCopy
.
authority
,
true
,
false
))
?
null
:
route
;
:
route
Copy
;
})
.
filter
(
Boolean
);
const
handleMenuCollapse
=
()
=>
{};
// get children authority
...
...
src/pages/user/login/index.js
View file @
6f787970
...
...
@@ -48,10 +48,13 @@ const Login = props => {
history
.
push
(
`/dbm/dbInit/`
);
}
if
(
userMode
===
USER_MODE
.
COMMON
)
{
const
authority
=
[
AUTHORITY
.
LOGIN
,
AUTHORITY
.
COMMON
];
setAuthority
(
authority
);
setAuth
(
authority
);
history
.
push
(
`/ou/orgList/`
);
// const authority = [AUTHORITY.LOGIN, AUTHORITY.COMMON];
// setAuthority(authority);
// setAuth(authority);
// history.push(`/ou/orgList/`);
notification
.
warning
({
message
:
msg
||
'没有权限!'
,
});
}
}
else
{
notification
.
warning
({
...
...
@@ -60,7 +63,7 @@ const Login = props => {
}
setLoading
(
false
);
})
.
then
(
e
=>
{
.
catch
(
e
=>
{
setLoading
(
false
);
notification
.
error
({
message
:
e
.
message
||
'没有权限!'
,
...
...
src/routes/config.js
View file @
6f787970
...
...
@@ -33,7 +33,7 @@ const iconStyle = { verticalAlign: '0.125em' };
const
superAuthority
=
[
USER_MODE
.
SUPER
];
const
adminAuthority
=
[...
superAuthority
,
USER_MODE
.
ADMIN
];
const
commonAuthority
=
[...
adminAuthority
,
USER_MODE
.
COMMON
];
//
const commonAuthority = [...adminAuthority, USER_MODE.COMMON];
export
default
{
routes
:
[
...
...
@@ -102,7 +102,7 @@ export default {
path
:
'/userCenter'
,
name
:
'用户中心'
,
component
:
BlankLayout
,
authority
:
commo
nAuthority
,
authority
:
admi
nAuthority
,
icon
:
<
UsergroupAddOutlined
style
=
{
iconStyle
}
/>
,
routes
:
[
{
...
...
@@ -133,7 +133,7 @@ export default {
component
:
BlankLayout
,
name
:
'平台中心'
,
icon
:
<
SettingOutlined
style
=
{
iconStyle
}
/>
,
authority
:
commo
nAuthority
,
authority
:
admi
nAuthority
,
routes
:
[
{
path
:
'/platformCenter/gis'
,
...
...
@@ -188,7 +188,7 @@ export default {
component
:
BlankLayout
,
name
:
'应用中心'
,
icon
:
<
HomeOutlined
style
=
{
iconStyle
}
/>
,
authority
:
commo
nAuthority
,
authority
:
admi
nAuthority
,
routes
:
[
{
path
:
'/productCenter/web'
,
...
...
@@ -212,7 +212,7 @@ export default {
component
:
BlankLayout
,
name
:
'系统日志'
,
icon
:
<
CopyOutlined
style
=
{
iconStyle
}
/>
,
authority
:
commo
nAuthority
,
authority
:
admi
nAuthority
,
routes
:
[
{
path
:
'/log/common'
,
...
...
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