Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mr-julyedu
Overview
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
baiguangyao
mr-julyedu
Commits
57fdd7da
Commit
57fdd7da
authored
Sep 26, 2019
by
FE
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add loading in captcha
parent
3745f015
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
52 additions
and
2 deletions
+52
-2
src/common/Captcha/index.js
+35
-2
src/common/Captcha/index.scss
+17
-0
No files found.
src/common/Captcha/index.js
View file @
57fdd7da
import
React
,
{
Component
}
from
'react'
;
import
React
,
{
Component
}
from
'react'
;
import
{
initCaptcha
}
from
'@/utils'
;
import
{
initCaptcha
}
from
'@/utils'
;
import
{
BarLoader
}
from
'react-spinners'
;
import
'./index.scss'
;
const
CAPTCHAID
=
'6b0f5f6c8f334f3693ee754ba5692e36'
const
CAPTCHAID
=
'6b0f5f6c8f334f3693ee754ba5692e36'
class
Captcha
extends
Component
{
class
Captcha
extends
Component
{
state
=
{
isReady
:
false
}
componentDidMount
()
{
componentDidMount
()
{
const
{
getInstance
,
handleError
,
onVerify
}
=
this
.
props
const
{
getInstance
,
handleError
,
onVerify
}
=
this
.
props
;
const
_this
=
this
;
const
el
=
document
.
getElementById
(
'captcha'
);
const
el
=
document
.
getElementById
(
'captcha'
);
el
&&
initCaptcha
(
function
()
{
el
&&
initCaptcha
(
function
()
{
initNECaptcha
({
initNECaptcha
({
...
@@ -14,6 +22,13 @@ class Captcha extends Component {
...
@@ -14,6 +22,13 @@ class Captcha extends Component {
captchaId
:
CAPTCHAID
,
captchaId
:
CAPTCHAID
,
mode
:
'float'
,
mode
:
'float'
,
width
:
'auto'
,
width
:
'auto'
,
onReady
:
function
(
instance
)
{
// 验证码一切准备就绪,此时可正常使用验证码的相关功能
console
.
log
(
_this
);
_this
.
setState
({
isReady
:
true
});
},
onVerify
:
function
(
err
,
data
)
{
onVerify
:
function
(
err
,
data
)
{
onVerify
(
err
,
data
)
onVerify
(
err
,
data
)
}
}
...
@@ -30,7 +45,25 @@ class Captcha extends Component {
...
@@ -30,7 +45,25 @@ class Captcha extends Component {
render
()
{
render
()
{
return
(
return
(
<
div
id
=
{
'captcha'
}
style
=
{{
'marginBottom'
:
this
.
props
.
mrBtm
}}
><
/div
>
<
div
className
=
"captcha-container"
style
=
{{
'marginBottom'
:
this
.
props
.
mrBtm
}}
>
{
!
this
.
state
.
isReady
&&
<
div
className
=
"captcha-animation"
>
<
BarLoader
/>
<
/div
>
}
<
div
id
=
{
'captcha'
}
style
=
{{
'marginBottom'
:
this
.
props
.
mrBtm
}}
/
>
<
/div
>
);
);
}
}
}
}
...
...
src/common/Captcha/index.scss
0 → 100644
View file @
57fdd7da
.captcha-container
{
position
:
relative
;
width
:
100%
;
height
:
40px
;
}
.captcha-animation
{
display
:
flex
;
align-items
:
center
;
justify-content
:
center
;
position
:
absolute
;
top
:
0
;
left
:
0
;
width
:
100%
;
height
:
100%
;
}
\ No newline at end of file
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