Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
study
Project
Project
Details
Activity
Releases
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
Damon
study
Commits
a8eecbf2
Commit
a8eecbf2
authored
Jul 22, 2021
by
Damon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 答题-考试
parent
4b21073b
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
20 deletions
+38
-20
answer.vue
src/pages/learn/answer.vue
+38
-20
No files found.
src/pages/learn/answer.vue
View file @
a8eecbf2
...
@@ -96,6 +96,7 @@
...
@@ -96,6 +96,7 @@
:numberList=
"complete.result"
:numberList=
"complete.result"
:type=
"complete.type"
:type=
"complete.type"
:visible
.
sync=
"complete.visible"
:visible
.
sync=
"complete.visible"
:timeout=
"complete.timeout"
@
cancel=
"cancel"
@
cancel=
"cancel"
@
submit=
"submit"
@
submit=
"submit"
>
>
...
@@ -151,6 +152,7 @@ export default {
...
@@ -151,6 +152,7 @@ export default {
type
:
'pass'
,
type
:
'pass'
,
result
:
[],
result
:
[],
visible
:
false
,
visible
:
false
,
timeout
:
false
},
},
timestamp
:
60
*
60
,
timestamp
:
60
*
60
,
list
:
[],
list
:
[],
...
@@ -220,7 +222,6 @@ export default {
...
@@ -220,7 +222,6 @@ export default {
if
(
this
.
questionList
.
length
===
0
)
{
if
(
this
.
questionList
.
length
===
0
)
{
this
.
show
=
true
this
.
show
=
true
}
}
this
.
init
()
this
.
init
()
},
},
methods
:
{
methods
:
{
...
@@ -234,7 +235,13 @@ export default {
...
@@ -234,7 +235,13 @@ export default {
// 列表总长度,一定要在第一次请求列表数据前明确该值
// 列表总长度,一定要在第一次请求列表数据前明确该值
// 否则无法知道下一页是否还有数据
// 否则无法知道下一页是否还有数据
let
total
=
parseInt
(
res
)
||
0
let
total
=
parseInt
(
res
)
||
0
// 考试
if
(
this
.
type
===
2
)
{
this
.
pageSize
=
100
total
=
100
}
this
.
total
=
total
this
.
total
=
total
// 练习模式-初始化答题卡列表
// 练习模式-初始化答题卡列表
if
(
this
.
type
===
1
)
Utils
.
initAnswerCardList
(
total
,
this
)
if
(
this
.
type
===
1
)
Utils
.
initAnswerCardList
(
total
,
this
)
this
.
cachePageDataMap
=
new
Map
()
this
.
cachePageDataMap
=
new
Map
()
...
@@ -353,7 +360,8 @@ export default {
...
@@ -353,7 +360,8 @@ export default {
this
.
model
=
i
this
.
model
=
i
},
},
timeEnd
()
{
timeEnd
()
{
this
.
complete
.
timeout
=
true
this
.
handPapers
()
},
},
// 作答完毕
// 作答完毕
answerChange
(
status
,
lists
)
{
answerChange
(
status
,
lists
)
{
...
@@ -365,12 +373,13 @@ export default {
...
@@ -365,12 +373,13 @@ export default {
item
.
errShow
=
this
.
type
===
2
?
true
:
status
===
'fail'
item
.
errShow
=
this
.
type
===
2
?
true
:
status
===
'fail'
// 更新答题卡
// 更新答题卡
if
(
this
.
type
===
1
){
this
.
questionList
[
this
.
currentIndex
]
=
item
this
.
questionList
[
this
.
currentIndex
]
=
item
this
.
$u
.
vuex
(
'questionList'
,
this
.
questionList
)
this
.
$u
.
vuex
(
'questionList'
,
this
.
questionList
)
this
.
$u
.
vuex
(
'lastIndex'
,
this
.
currentIndex
)
this
.
$u
.
vuex
(
'lastIndex'
,
this
.
currentIndex
)
// 每日一练数量统计
// 每日一练数量统计
if
(
this
.
type
===
1
&&
this
.
daily
.
status
)
{
if
(
this
.
daily
.
status
)
{
if
(
this
.
daily
.
count
<
9
)
this
.
daily
.
count
++
if
(
this
.
daily
.
count
<
9
)
this
.
daily
.
count
++
if
(
this
.
daily
.
count
===
9
)
{
if
(
this
.
daily
.
count
===
9
)
{
this
.
daily
.
visible
=
true
this
.
daily
.
visible
=
true
...
@@ -378,10 +387,15 @@ export default {
...
@@ -378,10 +387,15 @@ export default {
return
return
}
}
}
}
}
// 如果回答错误或者是考试模式,自动进入下一题
// 如果回答错误或者是考试模式,自动进入下一题
if
((
status
===
'pass'
&&
this
.
model
!==
2
)
||
this
.
type
===
2
)
{
if
((
status
===
'pass'
&&
this
.
model
!==
2
)
||
this
.
type
===
2
)
{
if
(
this
.
currentIndex
+
1
>
this
.
total
-
1
)
{
if
(
this
.
currentIndex
+
1
>
this
.
total
-
1
)
{
if
(
this
.
type
===
2
)
{
this
.
handPapers
(
1
)
this
.
submit
()
}
return
return
}
}
this
.
$nextTick
(()
=>
{
this
.
$nextTick
(()
=>
{
...
@@ -389,19 +403,20 @@ export default {
...
@@ -389,19 +403,20 @@ export default {
})
})
}
}
},
},
//
交卷
//
统计分数
handPapers
()
{
handPapers
(
type
)
{
const
fail
=
this
.
list
.
filter
((
v
)
=>
v
.
result
===
'fail'
).
length
// 错题数
const
fail
=
this
.
list
.
filter
((
v
)
=>
v
.
result
===
'fail'
).
length
// 错题数
const
noStart
=
this
.
list
.
filter
((
v
)
=>
!
v
.
result
).
length
// 未做题数
const
noStart
=
this
.
list
.
filter
((
v
)
=>
!
v
.
result
).
length
// 未做题数
const
fraction
=
0
// 分数
const
fraction
=
this
.
total
-
noStart
-
fail
// 分数
this
.
complete
.
result
=
[
fail
,
noStart
,
fraction
]
this
.
complete
.
result
=
[
fail
,
noStart
,
fraction
]
this
.
complete
.
type
=
'pass'
this
.
complete
.
type
=
fraction
<
60
?
'fail'
:
'pass'
this
.
complete
.
visible
=
true
if
(
!
type
)
this
.
complete
.
visible
=
true
},
},
// 考试成绩弹框确认
// 考试成绩弹框确认
submit
()
{
submit
()
{
// 提前交卷
// 提前交卷
this
.
$u
.
route
({
this
.
$u
.
route
({
type
:
'redirect'
,
url
:
'/pages/learn/score'
,
url
:
'/pages/learn/score'
,
})
})
},
},
...
@@ -415,7 +430,10 @@ export default {
...
@@ -415,7 +430,10 @@ export default {
},
},
// 每日一练弹框取消
// 每日一练弹框取消
dailyCancel
()
{
dailyCancel
()
{
this
.
$u
.
route
(
'/pages/learn/record'
)
this
.
$u
.
route
({
type
:
'redirect'
,
url
:
'/pages/learn/record'
,
})
},
},
// 收藏
// 收藏
collection
()
{
collection
()
{
...
...
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