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
f2396170
Commit
f2396170
authored
Jul 24, 2021
by
Damon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor: 练习模式回答完全部试题逻辑修改
parent
712675d8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
10 deletions
+22
-10
answer.vue
src/pages/learn/answer.vue
+22
-10
No files found.
src/pages/learn/answer.vue
View file @
f2396170
...
@@ -246,6 +246,7 @@ export default {
...
@@ -246,6 +246,7 @@ export default {
if
(
this
.
source
===
1
){
// 顺序答题,如果答满则清空数据
if
(
this
.
source
===
1
){
// 顺序答题,如果答满则清空数据
const
check
=
this
.
questionList
.
every
(
v
=>
v
.
id
)
const
check
=
this
.
questionList
.
every
(
v
=>
v
.
id
)
if
(
check
)
{
if
(
check
)
{
this
.
$u
.
vuex
(
'lastIndex'
,
0
)
this
.
$u
.
vuex
(
'questionList'
,
[])
this
.
$u
.
vuex
(
'questionList'
,
[])
}
}
}
}
...
@@ -260,7 +261,12 @@ export default {
...
@@ -260,7 +261,12 @@ export default {
recordId
:
this
.
recordId
,
recordId
:
this
.
recordId
,
source
:
this
.
source
source
:
this
.
source
}
}
uni
.
showLoading
({
title
:
'加载中'
})
this
.
$u
.
api
.
getQuestionTotal
(
params
).
then
(
res
=>
{
this
.
$u
.
api
.
getQuestionTotal
(
params
).
then
(
res
=>
{
uni
.
hideLoading
()
// 列表总长度,一定要在第一次请求列表数据前明确该值
// 列表总长度,一定要在第一次请求列表数据前明确该值
// 否则无法知道下一页是否还有数据
// 否则无法知道下一页是否还有数据
let
total
=
parseInt
(
res
)
||
0
let
total
=
parseInt
(
res
)
||
0
...
@@ -295,14 +301,14 @@ export default {
...
@@ -295,14 +301,14 @@ export default {
if
(
current
==
NO_PREV_PAGE
)
{
if
(
current
==
NO_PREV_PAGE
)
{
return
uni
.
showToast
({
return
uni
.
showToast
({
title
:
'已经是第一
题了
'
,
title
:
'已经是第一
道试题
'
,
icon
:
'none'
,
icon
:
'none'
,
})
})
}
}
if
(
current
==
NO_NEXT_PAGE
)
{
if
(
current
==
NO_NEXT_PAGE
)
{
return
uni
.
showToast
({
return
uni
.
showToast
({
title
:
'已经是最后一
题了
'
,
title
:
'已经是最后一
道试题
'
,
icon
:
'none'
,
icon
:
'none'
,
})
})
}
}
...
@@ -410,6 +416,19 @@ export default {
...
@@ -410,6 +416,19 @@ export default {
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
)
// 统计是否达满所有试题
const
count
=
this
.
questionList
.
reduce
((
accumulator
,
currentValue
)
=>
{
if
(
currentValue
.
id
)
accumulator
++
return
accumulator
},
0
)
if
(
count
===
this
.
total
)
{
return
uni
.
showToast
({
title
:
'您已经答完全部试题'
,
icon
:
'none'
,
})
}
}
}
// 如果回答错误或者是考试模式,自动进入下一题
// 如果回答错误或者是考试模式,自动进入下一题
...
@@ -437,14 +456,7 @@ export default {
...
@@ -437,14 +456,7 @@ export default {
source
:
this
.
source
source
:
this
.
source
}
}
this
.
$u
.
api
.
answer
([
params
]).
then
(
res
=>
{
this
.
$u
.
api
.
answer
([
params
]).
then
(
res
=>
{
if
(
this
.
source
===
1
)
{
if
(
this
.
source
===
2
)
{
// 每日一练
if
(
res
===
this
.
total
)
{
return
uni
.
showToast
({
title
:
'你已经回答了全部试题'
,
icon
:
'none'
,
})
}
}
else
if
(
this
.
source
===
2
)
{
if
(
this
.
daily
.
status
&&
res
===
10
)
this
.
dailyComplete
()
if
(
this
.
daily
.
status
&&
res
===
10
)
this
.
dailyComplete
()
}
}
})
})
...
...
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