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
faaa7322
Commit
faaa7322
authored
Jun 05, 2020
by
zhanghaozhe
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'ai-test-merge' into dev
parents
68d80bd2
021ae48e
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
18 deletions
+20
-18
src/components/ai-test/exam/index.js
+8
-10
src/components/ai-test/report/index.js
+1
-1
src/components/ai-test/scores/index.js
+2
-2
src/components/ai-test/submit-answer/index.js
+9
-5
No files found.
src/components/ai-test/exam/index.js
View file @
faaa7322
...
@@ -35,12 +35,6 @@ class Exam extends Component {
...
@@ -35,12 +35,6 @@ class Exam extends Component {
this
.
props
.
history
.
replace
(
'/ai-test'
)
this
.
props
.
history
.
replace
(
'/ai-test'
)
}
}
this
.
getQuestions
()
this
.
getQuestions
()
this
.
unlisten
=
this
.
props
.
history
.
listen
((
location
,
action
)
=>
{
if
(
action
===
'POP'
)
{
this
.
store
.
clearAll
()
}
this
.
unlisten
()
})
}
}
componentWillUnmount
()
{
componentWillUnmount
()
{
...
@@ -122,15 +116,19 @@ class Exam extends Component {
...
@@ -122,15 +116,19 @@ class Exam extends Component {
selectAnswer
=
(
question
,
optionId
)
=>
{
selectAnswer
=
(
question
,
optionId
)
=>
{
this
.
setState
(
state
=>
{
this
.
setState
(
state
=>
{
const
answer
=
state
.
answer
const
answer
=
state
.
answer
const
activeQuestion
=
state
.
activeQuestion
+
1
setTimeout
(()
=>
{
this
.
setState
({
activeQuestion
:
activeQuestion
>=
state
.
questions
.
length
?
state
.
questions
.
length
-
1
:
activeQuestion
,
});
},
200
)
answer
[
question
.
id
]
=
optionId
answer
[
question
.
id
]
=
optionId
return
{
return
{
answer
,
answer
,
}
}
},
()
=>
{
},
()
=>
{
const
{
answer
,
questions
}
=
this
.
state
const
{
questions
,
activeQuestion
}
=
this
.
state
const
keys
=
Object
.
keys
(
answer
)
if
(
activeQuestion
===
questions
.
length
-
1
)
{
const
values
=
Object
.
values
(
answer
)
if
(
keys
.
length
===
questions
.
length
&&
values
.
every
(
item
=>
item
))
{
this
.
storeData
()
this
.
storeData
()
}
}
})
})
...
...
src/components/ai-test/report/index.js
View file @
faaa7322
...
@@ -172,7 +172,7 @@ class scoreReport extends Component {
...
@@ -172,7 +172,7 @@ class scoreReport extends Component {
<
tr
>
<
tr
>
<
td
>
分数
<
/td
>
<
td
>
分数
<
/td
>
<
td
>
用时
<
/td
>
<
td
>
用时
<
/td
>
<
td
>
排名
<
/td
>
<
td
>
最终
排名
<
/td
>
<
/tr
>
<
/tr
>
<
/thead
>
<
/thead
>
<
tbody
>
<
tbody
>
...
...
src/components/ai-test/scores/index.js
View file @
faaa7322
...
@@ -189,14 +189,14 @@ class Scores extends Component {
...
@@ -189,14 +189,14 @@ class Scores extends Component {
<
tr
>
<
tr
>
<
th
>
分数
<
/th
>
<
th
>
分数
<
/th
>
<
th
>
用时
<
/th
>
<
th
>
用时
<
/th
>
<
th
>
最终
排名
<
/th
>
<
th
>
排名
<
/th
>
<
/tr
>
<
/tr
>
<
/thead
>
<
/thead
>
<
tbody
>
<
tbody
>
<
tr
>
<
tr
>
{
{
userScore
.
score
===
'-'
?
'-'
:
userScore
.
score
===
'-'
?
'-'
:
<
td
>
{
userScore
.
score
}
<
Link
to
=
{
`/ai-test/
parse
/
${
userScore
.
r_id
}
`
}
>
解析
<
/Link></
td
>
<
td
>
{
userScore
.
score
}
<
Link
to
=
{
`/ai-test/
analysis
/
${
userScore
.
r_id
}
`
}
>
解析
<
/Link></
td
>
}
}
<
td
>
{
userScore
.
cost_time
}
<
/td
>
<
td
>
{
userScore
.
cost_time
}
<
/td
>
{
{
...
...
src/components/ai-test/submit-answer/index.js
View file @
faaa7322
...
@@ -24,9 +24,14 @@ class SubmitAnswer extends Component {
...
@@ -24,9 +24,14 @@ class SubmitAnswer extends Component {
}
}
componentDidMount
()
{
componentDidMount
()
{
this
.
setCounter
()
if
(
isEmpty
(
this
.
state
.
answer
)
||
!
this
.
state
.
recordId
)
{
if
(
isEmpty
(
this
.
state
.
answer
)
||
!
this
.
state
.
recordId
)
{
this
.
props
.
history
.
replace
(
'/ai-test'
)
this
.
props
.
history
.
replace
(
'/ai-test'
)
this
.
store
.
remove
(
'submitted'
)
}
if
(
this
.
store
.
get
(
'submitted'
))
{
this
.
getAnalysis
()
}
else
{
this
.
setCounter
()
}
}
}
}
...
@@ -57,15 +62,14 @@ class SubmitAnswer extends Component {
...
@@ -57,15 +62,14 @@ class SubmitAnswer extends Component {
const
{
answer
,
recordId
}
=
this
.
state
const
{
answer
,
recordId
}
=
this
.
state
http
.
post
(
`
${
API
.
home
}
/sys/submit_answer`
,
{
http
.
post
(
`
${
API
.
home
}
/sys/submit_answer`
,
{
answer
:
JSON
.
stringify
(
answer
),
answer
:
JSON
.
stringify
(
answer
),
cost_time
:
this
.
state
.
elapsed
,
cost_time
:
this
.
state
.
elapsed
*
1000
,
record_id
:
recordId
,
record_id
:
recordId
,
}).
then
(
res
=>
{
}).
then
(
res
=>
{
const
{
code
,
msg
,
data
}
=
res
.
data
const
{
code
,
msg
}
=
res
.
data
if
(
code
===
200
)
{
if
(
code
===
200
)
{
this
.
store
.
clearAll
()
this
.
store
.
set
(
'submitted'
,
true
)
this
.
store
.
set
(
'submitted'
,
true
)
clearInterval
(
this
.
timer
)
clearInterval
(
this
.
timer
)
this
.
getAnalysis
(
)
this
.
props
.
history
.
push
(
'/ai-test/report'
)
}
else
{
}
else
{
Toast
.
fail
(
msg
,
2
,
null
,
false
)
Toast
.
fail
(
msg
,
2
,
null
,
false
)
}
}
...
...
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