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
831b3396
Commit
831b3396
authored
Jun 24, 2020
by
zhanghaozhe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
题库适配
parent
6da10838
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
8 deletions
+39
-8
src/components/problems/index.js
+32
-7
src/components/problems/index.scss
+7
-1
No files found.
src/components/problems/index.js
View file @
831b3396
...
@@ -10,7 +10,7 @@ class Problems extends Component {
...
@@ -10,7 +10,7 @@ class Problems extends Component {
state
=
{
state
=
{
isShowAnswer
:
false
,
isShowAnswer
:
false
,
isShowCaptcha
:
fals
e
,
isShowCaptcha
:
tru
e
,
instance
:
null
,
instance
:
null
,
problem
:
{},
problem
:
{},
}
}
...
@@ -19,12 +19,35 @@ class Problems extends Component {
...
@@ -19,12 +19,35 @@ class Problems extends Component {
this
.
getProblem
()
this
.
getProblem
()
}
}
getInstance
=
()
=>
{
componentDidUpdate
(
prevProps
,
prevState
)
{
if
(
prevProps
.
match
.
params
.
id
!==
this
.
props
.
match
.
params
.
id
)
{
this
.
setState
({
problem
:
{},
});
this
.
getProblem
()
}
}
}
switchProblem
()
{
onVerify
=
data
=>
{
http
.
post
(
`
${
API
.
home
}
/m/safety`
,
data
)
.
then
(
res
=>
{
const
{
code
}
=
res
.
data
if
(
code
===
200
)
{
this
.
setState
({
isShowCaptcha
:
false
,
})
this
.
getProblem
()
}
else
{
this
.
state
.
instance
&&
this
.
state
.
instance
.
reset
()
}
})
}
getInstance
=
(
instance
)
=>
{
this
.
setState
({
instance
,
});
}
}
getProblem
=
()
=>
{
getProblem
=
()
=>
{
...
@@ -51,7 +74,7 @@ class Problems extends Component {
...
@@ -51,7 +74,7 @@ class Problems extends Component {
render
()
{
render
()
{
const
{
isShowAnswer
,
problem
:
{
quesInfo
,
between
},
isShowCaptcha
}
=
this
.
state
const
{
isShowAnswer
,
problem
:
{
quesInfo
,
between
},
isShowCaptcha
}
=
this
.
state
return
(
return
(
<
article
id
=
{
'problems'
}
>
quesInfo
||
isShowCaptcha
?
<
article
id
=
{
'problems'
}
>
{
{
!
isShowCaptcha
?
!
isShowCaptcha
?
<>
<>
...
@@ -90,10 +113,12 @@ class Problems extends Component {
...
@@ -90,10 +113,12 @@ class Problems extends Component {
<
/footer
>
<
/footer
>
<
/
>
<
/
>
:
<
div
className
=
"captcha-container"
>
:
<
div
className
=
"captcha-container"
>
<
CaptchaAli
getInstance
=
{
this
.
getInstance
}
/
>
<
div
>
亲,系统正忙,滑动一下马上回来
<
/div
>
<
CaptchaAli
getInstance
=
{
this
.
getInstance
}
onVerify
=
{
this
.
onVerify
}
/
>
<
/div
>
<
/div
>
}
}
<
/article
>
<
/article> : nul
l
);
);
}
}
}
}
...
...
src/components/problems/index.scss
View file @
831b3396
...
@@ -45,6 +45,7 @@
...
@@ -45,6 +45,7 @@
font-size
:
16px
;
font-size
:
16px
;
color
:
#333
;
color
:
#333
;
white-space
:
pre-wrap
;
white-space
:
pre-wrap
;
word-break
:
break-all
;
.title
{
.title
{
margin-bottom
:
5px
;
margin-bottom
:
5px
;
...
@@ -95,8 +96,13 @@
...
@@ -95,8 +96,13 @@
.captcha-container
{
.captcha-container
{
width
:
80%
;
width
:
80%
;
padding-top
:
4
0%
;
padding-top
:
5
0%
;
margin
:
0
auto
;
margin
:
0
auto
;
text-align
:
center
;
font-size
:
20px
;
div
:nth-child
(
1
)
{
margin-bottom
:
10px
;
}
}
}
}
}
...
...
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