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
5e0dfae3
Commit
5e0dfae3
authored
Sep 26, 2019
by
FE
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'issue-20190920' into pre
parents
f460a5b6
57fdd7da
Show 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 @
5e0dfae3
import
React
,
{
Component
}
from
'react'
;
import
{
initCaptcha
}
from
'@/utils'
;
import
{
BarLoader
}
from
'react-spinners'
;
import
'./index.scss'
;
const
CAPTCHAID
=
'6b0f5f6c8f334f3693ee754ba5692e36'
class
Captcha
extends
Component
{
state
=
{
isReady
:
false
}
componentDidMount
()
{
const
{
getInstance
,
handleError
,
onVerify
}
=
this
.
props
const
{
getInstance
,
handleError
,
onVerify
}
=
this
.
props
;
const
_this
=
this
;
const
el
=
document
.
getElementById
(
'captcha'
);
el
&&
initCaptcha
(
function
()
{
initNECaptcha
({
...
...
@@ -14,6 +22,13 @@ class Captcha extends Component {
captchaId
:
CAPTCHAID
,
mode
:
'float'
,
width
:
'auto'
,
onReady
:
function
(
instance
)
{
// 验证码一切准备就绪,此时可正常使用验证码的相关功能
console
.
log
(
_this
);
_this
.
setState
({
isReady
:
true
});
},
onVerify
:
function
(
err
,
data
)
{
onVerify
(
err
,
data
)
}
...
...
@@ -30,7 +45,25 @@ class Captcha extends Component {
render
()
{
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 @
5e0dfae3
.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