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
9bb7c049
Commit
9bb7c049
authored
Jul 22, 2021
by
Damon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor: 学习模式
parent
036e24b0
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
2 deletions
+27
-2
learn.js
src/api/learn.js
+3
-1
index.vue
src/components/swiper-limited-load/index.vue
+19
-0
answer.vue
src/pages/learn/answer.vue
+5
-1
No files found.
src/api/learn.js
View file @
9bb7c049
...
@@ -4,10 +4,12 @@ let learnApiFun = function(vm) {
...
@@ -4,10 +4,12 @@ let learnApiFun = function(vm) {
let
getQuestion
=
async
(
params
=
{})
=>
await
vm
.
$u
.
post
(
'/rest/question/query/getQuestion'
,
params
)
let
getQuestion
=
async
(
params
=
{})
=>
await
vm
.
$u
.
post
(
'/rest/question/query/getQuestion'
,
params
)
let
getQuestionTotal
=
async
(
params
=
{})
=>
await
vm
.
$u
.
post
(
'/rest/question/query/getQuestionTotal'
,
params
)
let
getQuestionTotal
=
async
(
params
=
{})
=>
await
vm
.
$u
.
post
(
'/rest/question/query/getQuestionTotal'
,
params
)
let
answer
=
async
(
params
=
{})
=>
await
vm
.
$u
.
post
(
'/rest/question/save/answer'
,
params
)
const
learnApi
=
{
const
learnApi
=
{
getQuestion
,
getQuestion
,
getQuestionTotal
getQuestionTotal
,
answer
}
}
return
learnApi
return
learnApi
}
}
...
...
src/components/swiper-limited-load/index.vue
View file @
9bb7c049
...
@@ -109,6 +109,9 @@ export default {
...
@@ -109,6 +109,9 @@ export default {
},
},
immediate
:
true
immediate
:
true
},
},
model
(
newVal
,
oldVal
){
if
(
newVal
===
2
)
this
.
autoAnswer
()
}
},
},
methods
:
{
methods
:
{
init
(
defaulaIndex
)
{
init
(
defaulaIndex
)
{
...
@@ -177,6 +180,22 @@ export default {
...
@@ -177,6 +180,22 @@ export default {
this
.
$emit
(
"change"
,
info
)
this
.
$emit
(
"change"
,
info
)
// 记录滑过来的位置,此值对于下一次滑动的计算很重要
// 记录滑过来的位置,此值对于下一次滑动的计算很重要
this
.
swiperIndex
=
current
this
.
swiperIndex
=
current
if
(
this
.
model
===
2
)
{
this
.
autoAnswer
()
}
},
autoAnswer
()
{
this
.
$set
(
this
.
swiperList
[
this
.
swiperIndex
],
'errShow'
,
true
)
this
.
$set
(
this
.
swiperList
[
this
.
swiperIndex
],
'submitStatus'
,
true
)
const
info
=
this
.
swiperList
[
this
.
swiperIndex
]
const
lists
=
info
.
answerList
.
map
(
v
=>
{
if
(
info
.
rightKey
.
includes
(
v
.
sort
))
{
v
.
checked
=
true
v
.
confirm
=
true
}
return
v
})
this
.
$emit
(
"answerChange"
,
'pass'
,
lists
)
},
},
/**
/**
* 获取初始化的swiperList
* 获取初始化的swiperList
...
...
src/pages/learn/answer.vue
View file @
9bb7c049
...
@@ -28,6 +28,7 @@
...
@@ -28,6 +28,7 @@
:timestamp=
"timestamp"
:timestamp=
"timestamp"
bg-color=
""
bg-color=
""
:show-hours=
"false"
:show-hours=
"false"
@
end=
"timeEnd"
></u-count-down
></u-count-down
></view>
></view>
</view>
</view>
...
@@ -326,6 +327,9 @@ export default {
...
@@ -326,6 +327,9 @@ export default {
changeModel
(
i
)
{
changeModel
(
i
)
{
this
.
model
=
i
this
.
model
=
i
},
timeEnd
()
{
},
},
// 作答完毕
// 作答完毕
answerChange
(
status
,
lists
)
{
answerChange
(
status
,
lists
)
{
...
@@ -352,7 +356,7 @@ export default {
...
@@ -352,7 +356,7 @@ export default {
}
}
// 如果回答错误或者是考试模式,自动进入下一题
// 如果回答错误或者是考试模式,自动进入下一题
if
(
status
===
'pass'
||
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
)
{
return
return
}
}
...
...
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