Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
cdsf-wx-app
Project
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
姜雷
cdsf-wx-app
Commits
6a02cfe6
Commit
6a02cfe6
authored
Sep 29, 2018
by
姜雷
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加权限校验
parent
05e43a36
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
11 deletions
+31
-11
App.js
src/containers/App.js
+1
-3
Index.js
src/containers/Home/Index.js
+29
-7
Login.js
src/containers/Login/Login.js
+1
-1
No files found.
src/containers/App.js
View file @
6a02cfe6
...
@@ -112,9 +112,7 @@ class App extends Component {
...
@@ -112,9 +112,7 @@ class App extends Component {
return
<
Component
{...
props
}
/>
;
return
<
Component
{...
props
}
/>
;
}
else
{
}
else
{
Toast
.
fail
(
'无权使用该功能'
);
Toast
.
fail
(
'无权使用该功能'
);
const
{
from
}
=
props
.
location
.
state
||
{
const
from
=
{
pathname
:
'/home'
};
from
:
{
pathname
:
'/home'
},
};
return
<
Redirect
to
=
{
from
}
/>
;
return
<
Redirect
to
=
{
from
}
/>
;
}
}
};
};
...
...
src/containers/Home/Index.js
View file @
6a02cfe6
import
React
from
'react'
;
import
React
from
'react'
;
import
PropTypes
from
'prop-types'
;
import
PropTypes
from
'prop-types'
;
import
styles
from
'./style.css'
;
import
styles
from
'./style.css'
;
import
{
Link
}
from
'react-router-dom'
;
import
{
Toast
}
from
'antd-mobile'
;
import
UserInfoContext
from
'../../context/userinfo-context'
;
export
class
Index
extends
React
.
Component
{
export
class
Index
extends
React
.
Component
{
static
propTypes
=
{
static
propTypes
=
{
name
:
PropTypes
.
string
,
name
:
PropTypes
.
string
,
};
};
validate
=
(
code
,
path
)
=>
{
const
{
userinfo
:
{
author
},
history
,
}
=
this
.
props
;
let
item
=
author
.
find
(
i
=>
i
.
code
===
code
);
if
(
item
.
type
)
{
history
.
push
(
path
);
return
;
}
else
{
Toast
.
fail
(
'无权使用该功能'
);
return
;
}
};
render
()
{
render
()
{
return
(
return
(
<
div
className
=
{
styles
.
LoadPage
}
>
<
div
className
=
{
styles
.
LoadPage
}
>
<
h2
>
HomePage
<
/h2
>
<
h2
>
HomePage
<
/h2
>
<
Link
to
=
"/Repair"
>
报修
<
/Link
>
<
div
onClick
=
{()
=>
this
.
validate
(
'CSXY0001'
,
'/Repair'
)}
>
报修
<
/div
>
<
br
/>
<
br
/>
<
Link
to
=
"/RepairDeal"
>
报修处理
<
/Link
>
<
div
onClick
=
{()
=>
this
.
validate
(
'CSXY0002'
,
'/RepairDeal'
)}
>
报修处理
<
/div
>
<
br
/>
<
br
/>
<
Link
to
=
"/publicCar"
>
约车
<
/Link
>
<
div
onClick
=
{()
=>
this
.
validate
(
'CSXY0003'
,
'/publicCar'
)}
>
约车
<
/div
>
<
br
/>
<
br
/>
<
Link
to
=
"/publicCarDeal"
>
约车处理
<
/Link
>
<
div
onClick
=
{()
=>
this
.
validate
(
'CSXY0004'
,
'/publicCarDeal'
)}
>
约车处理
<
/div
>
<
/div
>
<
/div
>
);
);
}
}
}
}
export
default
Index
;
export
default
props
=>
(
<
UserInfoContext
>
{({
userinfo
})
=>
<
Index
userinfo
=
{
userinfo
}
{...
props
}
/>
}
<
/UserInfoContext
>
);
src/containers/Login/Login.js
View file @
6a02cfe6
...
@@ -106,7 +106,7 @@ class Login extends Component {
...
@@ -106,7 +106,7 @@ class Login extends Component {
}
}
};
};
loginHandle
=
()
=>
{
loginHandle
=
()
=>
{
const
{
updateUserInfo
,
history
}
=
this
.
props
;
const
{
updateUserInfo
}
=
this
.
props
;
const
{
code
,
cellphone
}
=
this
.
state
;
const
{
code
,
cellphone
}
=
this
.
state
;
if
(
!
code
)
{
if
(
!
code
)
{
Toast
.
fail
(
'请输入短信验证码'
);
Toast
.
fail
(
'请输入短信验证码'
);
...
...
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