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
c3b23dc9
Commit
c3b23dc9
authored
Aug 21, 2020
by
GuanHua
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:update
parent
3131198a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
65 additions
and
63 deletions
+65
-63
app.tsx
src/app.tsx
+3
-3
LoginWrap.tsx
src/pages/user/components/LoginWrap.tsx
+62
-60
No files found.
src/app.tsx
View file @
c3b23dc9
...
...
@@ -81,7 +81,7 @@ export function render(oldRender: Function) {
removeRouters
()
history
.
push
(
'/user/login'
)
}
oldRender
()
})
}
else
{
...
...
@@ -116,11 +116,11 @@ export function onRouteChange({ routes, matchedRoutes, location, action }) {
return
url
===
pathname
&&
selfQuery
.
page_type
===
query
.
page_type
}))
{
// 深度匹配成功, 可正常访问
return
;
return
;
}
// 是否在路由权限列表里
if
(
routeAuthUrls
.
includes
(
pathname
))
{
return
;
return
;
}
// 无权限访问时
history
.
replace
(
'/memberCenter/noAuth'
)
...
...
src/pages/user/components/LoginWrap.tsx
View file @
c3b23dc9
...
...
@@ -14,17 +14,19 @@ const LoginWrap: React.FC = () => {
const
[
validFrame
,
setValidFrame
]
=
useState
(
false
)
const
[
validButton
,
setValidButton
]
=
useState
(
false
)
const
finish
=
(
value
:
any
)
=>
{
const
finish
=
(
value
:
any
)
=>
{
PublicApi
.
postMemberLogin
(
value
).
then
(
res
=>
{
const
{
data
}
=
res
setAuth
({
memberId
:
data
.
memberId
,
userId
:
data
.
userId
,
token
:
data
.
token
})
setRouters
(
data
.
urls
)
// 此处需使用href跳转, 否则无法触发app.ts中的路由初始化校验
window
.
location
.
href
=
'/memberCenter/home'
if
(
res
.
code
===
1000
)
{
const
{
data
}
=
res
setAuth
({
memberId
:
data
.
memberId
,
userId
:
data
.
userId
,
token
:
data
.
token
})
setRouters
(
data
.
urls
)
// 此处需使用href跳转, 否则无法触发app.ts中的路由初始化校验
window
.
location
.
href
=
'/memberCenter/home'
}
})
}
...
...
@@ -33,61 +35,61 @@ const LoginWrap: React.FC = () => {
<
p
>
{
validFrame
?
'当前手机号码:xxxxxxxxx'
:
'请使用平台账号登录'
}
</
p
>
{
validFrame
?
<>
<
Row
gutter=
{
[
0
,
80
]
}
>
<
Col
span=
{
16
}
>
<
Input
size=
'large'
/>
</
Col
>
<
Col
offset=
{
1
}
span=
{
7
}
>
<
Button
type=
'default'
size=
'large'
>
获取验证码
</
Button
>
</
Col
>
</
Row
>
<
Row
>
<
Col
span=
{
24
}
>
<
Button
type=
'primary'
size=
'large'
htmlType=
'submit'
block
>
点击登录
</
Button
>
</
Col
>
</
Row
>
</>
:
<
Form
onFinish=
{
finish
}
>
<
Form
.
Item
name=
'account'
rules=
{
[
{
required
:
true
,
message
:
<><
ExclamationCircleFilled
style=
{
{
marginRight
:
6
}
}
/><
span
>
请输入正确的用户名
</
span
></>
}
]
}
>
<
Input
prefix=
{
<
UserOutlined
/>
}
placeholder=
'用户名/手机号'
size=
'large'
/>
</
Form
.
Item
>
<
Form
.
Item
name=
'password'
rules=
{
[
{
required
:
true
,
message
:
<><
ExclamationCircleFilled
style=
{
{
marginRight
:
6
}
}
/><
span
>
请输入正确的密码
</
span
></>
}
]
}
<>
<
Row
gutter=
{
[
0
,
80
]
}
>
<
Col
span=
{
16
}
>
<
Input
size=
'large'
/>
</
Col
>
<
Col
offset=
{
1
}
span=
{
7
}
>
<
Button
type=
'default'
size=
'large'
>
获取验证码
</
Button
>
</
Col
>
</
Row
>
<
Row
>
<
Col
span=
{
24
}
>
<
Button
type=
'primary'
size=
'large'
htmlType=
'submit'
block
>
点击登录
</
Button
>
</
Col
>
</
Row
>
</>
:
<
Form
onFinish=
{
finish
}
>
<
Input
.
Password
prefix=
{
<
LockOutlined
/>
}
placeholder=
'请输入密码'
size=
'large'
/>
</
Form
.
Item
>
{
validButton
&&
(<
Form
.
Item
<
Form
.
Item
name=
'account'
rules=
{
[
{
required
:
true
,
message
:
<><
ExclamationCircleFilled
style=
{
{
marginRight
:
6
}
}
/><
span
>
请输入正确的用户名
</
span
></>
}
]
}
>
<
Input
prefix=
{
<
UserOutlined
/>
}
placeholder=
'用户名/手机号'
size=
'large'
/>
</
Form
.
Item
>
<
Form
.
Item
name=
'password'
rules=
{
[
{
required
:
true
,
message
:
<><
ExclamationCircleFilled
style=
{
{
marginRight
:
6
}
}
/><
span
>
请输入正确的密码
</
span
></>
}
]
}
>
<
Input
.
Password
prefix=
{
<
LockOutlined
/>
}
placeholder=
'请输入密码'
size=
'large'
/>
</
Form
.
Item
>
{
validButton
&&
(<
Form
.
Item
className=
{
styles
.
loginVerBtn
}
>
<
Button
ghost
type=
'primary'
block
size=
'large'
>
点击进行验证
</
Button
>
</
Form
.
Item
>)
}
<
Form
.
Item
>
<
Button
type=
'primary'
size=
'large'
htmlType=
'submit'
block
>
登录
</
Button
>
</
Form
.
Item
>
</
Form
>
}
<
Form
.
Item
>
<
Button
type=
'primary'
size=
'large'
htmlType=
'submit'
block
>
登录
</
Button
>
</
Form
.
Item
>
</
Form
>
}
</>
...
...
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