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
051fd8c0
Commit
051fd8c0
authored
Nov 03, 2020
by
张烨
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: add login authority
parent
ac33f5ff
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
36 additions
and
11 deletions
+36
-11
jsconfig.json
jsconfig.json
+16
-0
Authorized.js
src/components/Authorized/Authorized.js
+1
-1
index.js
src/containers/App/index.js
+12
-0
UserLayout.js
src/layouts/UserLayout.js
+2
-1
index.js
src/pages/user/login/index.js
+5
-3
checklogin.js
src/utils/checklogin.js
+0
-6
No files found.
jsconfig.json
0 → 100644
View file @
051fd8c0
{
"compilerOptions"
:
{
"jsx"
:
"react"
,
"target"
:
"ES6"
,
"module"
:
"commonjs"
,
"allowSyntheticDefaultImports"
:
true
,
"baseUrl"
:
"./"
,
"paths"
:
{
"@/*"
:
[
"src/*"
]
}
},
"exclude"
:
[
"node_modules"
]
}
\ No newline at end of file
src/components/Authorized/Authorized.js
View file @
051fd8c0
...
...
@@ -4,7 +4,7 @@ import check from './CheckPermissions';
const
Authorized
=
({
children
,
authority
,
authority
,
// 当前组件渲染需要的权限
noMatch
=
(
<
Result
status
=
"403"
...
...
src/containers/App/index.js
View file @
051fd8c0
...
...
@@ -3,6 +3,9 @@ import { Helmet } from 'react-helmet';
import
{
renderRoutes
}
from
'react-router-config'
;
import
{
BrowserRouter
as
Router
,
Switch
}
from
'react-router-dom'
;
import
config
from
'../../routes/config'
;
import
Authozed
from
'@/utils/authority'
;
import
UserLogin
from
'@/pages/user/login'
;
import
UserLayout
from
'@/layouts/UserLayout'
;
export
default
function
App
()
{
return
(
...
...
@@ -10,9 +13,18 @@ export default function App() {
<
Helmet
titleTemplate
=
"%s - 运维平台"
defaultTitle
=
"运维平台"
>
<
meta
name
=
"description"
content
=
"运维平台"
/>
<
/Helmet
>
<
Authozed
noMatch
=
{
<
UserLayout
>
<
UserLogin
/>
<
/UserLayout
>
}
authority
=
"login"
>
<
Router
basename
=
{
process
.
env
.
PUBLIC_PATH
||
'reactOMS'
}
>
<
Switch
>
{
renderRoutes
(
config
.
routes
)}
<
/Switch
>
<
/Router
>
<
/Authozed
>
<
/
>
);
}
src/layouts/UserLayout.js
View file @
051fd8c0
...
...
@@ -17,6 +17,7 @@ const UserLayout = props => {
route
=
{
routes
:
[],
},
children
,
}
=
props
;
// const { formatMessage } = useIntl();
const
{
breadcrumb
}
=
getMenuData
(
route
.
routes
);
...
...
@@ -46,7 +47,7 @@ const UserLayout = props => {
{
/* Ant Design 是西湖区最具影响力的 Web 设计规范 */
}
<
/div
>
<
/div
>
{
renderRoutes
(
route
.
routes
)}
{
children
||
renderRoutes
(
route
.
routes
)}
<
/div
>
<
DefaultFooter
copyright
=
{
`
${
new
Date
().
getFullYear
()}
熊猫智慧水务技术委员会出品`
}
...
...
src/pages/user/login/index.js
View file @
051fd8c0
import
React
,
{
useState
}
from
'react'
;
import
{
Alert
,
Checkbox
}
from
'antd'
;
import
{
login
}
from
'
../../..
/services/user/api'
;
import
{
USER_MODE
}
from
'
../../..
/utils/constants'
;
import
{
login
}
from
'
@
/services/user/api'
;
import
{
USER_MODE
}
from
'
@
/utils/constants'
;
import
LoginForm
from
'./components/Login'
;
import
styles
from
'./style.less'
;
import
{
setAuthority
}
from
'@/utils/authority'
;
const
{
UserName
,
Password
,
Submit
}
=
LoginForm
;
const
LoginMessage
=
({
content
})
=>
(
...
...
@@ -33,9 +33,11 @@ const Login = props => {
const
{
userMode
}
=
result
;
localStorage
.
setItem
(
'userMode'
,
userMode
);
if
(
userMode
===
USER_MODE
.
ADMIN
||
userMode
===
USER_MODE
.
SUPER
)
{
setAuthority
([
'login'
,
USER_MODE
.
ADMIN
,
USER_MODE
.
SUPER
]);
window
.
location
.
href
=
'/dbm/dbInit/'
;
}
if
(
userMode
===
USER_MODE
.
COMMON
)
{
setAuthority
([
'login'
,
USER_MODE
.
COMMON
]);
window
.
location
.
href
=
'/ou/orgList/'
;
}
}
else
{
...
...
src/utils/checklogin.js
deleted
100644 → 0
View file @
ac33f5ff
export
default
(...
routerProps
)
=>
new
Promise
((
resolve
,
reject
)
=>
{
setTimeout
(()
=>
{
resolve
();
},
1500
);
}).
then
(()
=>
{});
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