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
5d804078
Commit
5d804078
authored
Apr 01, 2021
by
GuanHua
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 修改登录页扫码,切换回密码登录时仍然请求的问题
parent
74199014
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
10 deletions
+13
-10
UserLayouts.tsx
src/layouts/UserLayouts.tsx
+1
-1
ScanLoginWrap.tsx
src/pages/user/components/ScanLoginWrap.tsx
+12
-9
No files found.
src/layouts/UserLayouts.tsx
View file @
5d804078
...
...
@@ -10,7 +10,7 @@ import { GlobalConfig } from '@/global/config';
* @author xjm
*/
const
UserLayouts
:
React
.
FC
=
(
props
)
=>
{
console
.
log
(
props
)
return
(
<>
{
/* <Helmet>
...
...
src/pages/user/components/ScanLoginWrap.tsx
View file @
5d804078
import
React
,
{
useState
,
useEffect
}
from
'react'
import
{
Form
,
Row
,
Col
,
Input
,
Button
,
message
}
from
'antd'
import
React
,
{
useState
,
useEffect
,
useRef
}
from
'react'
import
{
message
}
from
'antd'
import
{
history
}
from
'umi'
;
import
{
UserOutlined
,
LockOutlined
,
ExclamationCircleFilled
}
from
'@ant-design/icons'
;
import
{
setAuth
,
setRouters
}
from
'@/utils/auth'
;
import
QRCode
from
'qrcode'
;
import
{
PublicApi
}
from
'@/services/api'
;
...
...
@@ -13,12 +8,14 @@ import { PublicApi } from '@/services/api';
const
ScanLoginWrap
:
React
.
FC
=
()
=>
{
const
{
redirect
}
=
history
.
location
.
query
const
[
qrCode
,
setQrCode
]
=
useState
(
''
)
const
timer
=
useRef
(
null
)
let
time
=
60
*
5
;
const
hanleCountdown
=
(
authCode
)
=>
{
if
(
time
>
0
&&
time
<=
60
*
5
)
{
time
-=
2
;
console
.
log
(
time
);
setTimeout
(()
=>
{
timer
.
current
=
setTimeout
(()
=>
{
loginInfo
(
authCode
)
hanleCountdown
(
authCode
);
},
2000
);
...
...
@@ -62,13 +59,19 @@ const ScanLoginWrap: React.FC = () => {
useEffect
(()
=>
{
AuthCode
();
return
()
=>
{
clearTimeout
(
timer
.
current
)
timer
.
current
=
null
}
// hanleCountdown()
},
[])
return
(
<
div
className=
{
'scanLoginWrap'
}
>
<
h2
>
扫码登录
</
h2
>
<
div
className=
{
'qrCodeImage'
}
>
<
img
src=
{
qrCode
}
alt=
""
/>
{
qrCode
&&
<
img
src=
{
qrCode
}
alt=
""
/>
}
</
div
>
</
div
>
)
...
...
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