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
021ae48e
Commit
021ae48e
authored
Jun 05, 2020
by
zhanghaozhe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ai测试
parent
de4e7b07
Hide 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 @
021ae48e
...
...
@@ -35,12 +35,6 @@ class Exam extends Component {
this
.
props
.
history
.
replace
(
'/ai-test'
)
}
this
.
getQuestions
()
this
.
unlisten
=
this
.
props
.
history
.
listen
((
location
,
action
)
=>
{
if
(
action
===
'POP'
)
{
this
.
store
.
clearAll
()
}
this
.
unlisten
()
})
}
componentWillUnmount
()
{
...
...
@@ -122,15 +116,19 @@ class Exam extends Component {
selectAnswer
=
(
question
,
optionId
)
=>
{
this
.
setState
(
state
=>
{
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
return
{
answer
,
}
},
()
=>
{
const
{
answer
,
questions
}
=
this
.
state
const
keys
=
Object
.
keys
(
answer
)
const
values
=
Object
.
values
(
answer
)
if
(
keys
.
length
===
questions
.
length
&&
values
.
every
(
item
=>
item
))
{
const
{
questions
,
activeQuestion
}
=
this
.
state
if
(
activeQuestion
===
questions
.
length
-
1
)
{
this
.
storeData
()
}
})
...
...
src/components/ai-test/report/index.js
View file @
021ae48e
...
...
@@ -172,7 +172,7 @@ class scoreReport extends Component {
<
tr
>
<
td
>
分数
<
/td
>
<
td
>
用时
<
/td
>
<
td
>
排名
<
/td
>
<
td
>
最终
排名
<
/td
>
<
/tr
>
<
/thead
>
<
tbody
>
...
...
src/components/ai-test/scores/index.js
View file @
021ae48e
...
...
@@ -189,14 +189,14 @@ class Scores extends Component {
<
tr
>
<
th
>
分数
<
/th
>
<
th
>
用时
<
/th
>
<
th
>
最终
排名
<
/th
>
<
th
>
排名
<
/th
>
<
/tr
>
<
/thead
>
<
tbody
>
<
tr
>
{
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
>
{
...
...
src/components/ai-test/submit-answer/index.js
View file @
021ae48e
...
...
@@ -24,9 +24,14 @@ class SubmitAnswer extends Component {
}
componentDidMount
()
{
this
.
setCounter
()
if
(
isEmpty
(
this
.
state
.
answer
)
||
!
this
.
state
.
recordId
)
{
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 {
const
{
answer
,
recordId
}
=
this
.
state
http
.
post
(
`
${
API
.
home
}
/sys/submit_answer`
,
{
answer
:
JSON
.
stringify
(
answer
),
cost_time
:
this
.
state
.
elapsed
,
cost_time
:
this
.
state
.
elapsed
*
1000
,
record_id
:
recordId
,
}).
then
(
res
=>
{
const
{
code
,
msg
,
data
}
=
res
.
data
const
{
code
,
msg
}
=
res
.
data
if
(
code
===
200
)
{
this
.
store
.
clearAll
()
this
.
store
.
set
(
'submitted'
,
true
)
clearInterval
(
this
.
timer
)
this
.
getAnalysis
(
)
this
.
props
.
history
.
push
(
'/ai-test/report'
)
}
else
{
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