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
9af057a3
Commit
9af057a3
authored
Jul 23, 2021
by
Damon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 收藏
parent
4336834e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
21 deletions
+35
-21
learn.js
src/api/learn.js
+14
-0
index.vue
src/components/answer-sheet/index.vue
+5
-13
answer.vue
src/pages/learn/answer.vue
+16
-8
No files found.
src/api/learn.js
View file @
9af057a3
...
@@ -4,19 +4,31 @@ let learnApiFun = function(vm) {
...
@@ -4,19 +4,31 @@ let learnApiFun = function(vm) {
let
getQuestion
=
async
(
params
=
{})
=>
let
getQuestion
=
async
(
params
=
{})
=>
await
vm
.
$u
.
post
(
'/rest/question/query/getQuestion'
,
params
)
await
vm
.
$u
.
post
(
'/rest/question/query/getQuestion'
,
params
)
let
getQuestionTotal
=
async
(
params
=
{})
=>
let
getQuestionTotal
=
async
(
params
=
{})
=>
await
vm
.
$u
.
post
(
'/rest/question/query/getQuestionTotal'
,
params
)
await
vm
.
$u
.
post
(
'/rest/question/query/getQuestionTotal'
,
params
)
let
answer
=
async
(
params
=
{})
=>
let
answer
=
async
(
params
=
{})
=>
await
vm
.
$u
.
post
(
'/rest/question/save/answer'
,
params
)
await
vm
.
$u
.
post
(
'/rest/question/save/answer'
,
params
)
let
subjectList
=
async
(
params
=
{})
=>
let
subjectList
=
async
(
params
=
{})
=>
await
vm
.
$u
.
get
(
'/rest/question/query/subjectList'
,
params
)
await
vm
.
$u
.
get
(
'/rest/question/query/subjectList'
,
params
)
let
getQuestionWarehouse
=
async
(
subjectId
,
params
=
{})
=>
let
getQuestionWarehouse
=
async
(
subjectId
,
params
=
{})
=>
await
vm
.
$u
.
get
(
await
vm
.
$u
.
get
(
'/rest/question/query/getQuestionWarehouse/'
+
subjectId
,
'/rest/question/query/getQuestionWarehouse/'
+
subjectId
,
params
params
)
)
let
getProvinceList
=
async
(
params
=
{})
=>
let
getProvinceList
=
async
(
params
=
{})
=>
await
vm
.
$u
.
get
(
'/rest/question/getProvinceList'
,
params
)
await
vm
.
$u
.
get
(
'/rest/question/getProvinceList'
,
params
)
let
joinCollection
=
async
(
params
=
{})
=>
await
vm
.
$u
.
get
(
'/rest/question/join/collection/'
+
params
.
questionId
,
params
)
let
removeCollection
=
async
(
params
=
{})
=>
await
vm
.
$u
.
get
(
'/rest/question/remove/collection/'
+
params
.
questionId
,
params
)
const
learnApi
=
{
const
learnApi
=
{
getQuestion
,
getQuestion
,
getQuestionTotal
,
getQuestionTotal
,
...
@@ -24,6 +36,8 @@ let learnApiFun = function(vm) {
...
@@ -24,6 +36,8 @@ let learnApiFun = function(vm) {
subjectList
,
subjectList
,
getQuestionWarehouse
,
getQuestionWarehouse
,
getProvinceList
,
getProvinceList
,
joinCollection
,
removeCollection
}
}
return
learnApi
return
learnApi
}
}
...
...
src/components/answer-sheet/index.vue
View file @
9af057a3
...
@@ -86,7 +86,7 @@ export default {
...
@@ -86,7 +86,7 @@ export default {
getCheckedNum
()
{
getCheckedNum
()
{
const
num
=
this
.
lists
.
filter
((
v
)
=>
v
.
checked
)
const
num
=
this
.
lists
.
filter
((
v
)
=>
v
.
checked
)
return
num
.
length
>
1
?
true
:
false
return
num
.
length
>
1
?
true
:
false
}
,
}
},
},
methods
:
{
methods
:
{
select
(
index
)
{
select
(
index
)
{
...
@@ -165,27 +165,19 @@ export default {
...
@@ -165,27 +165,19 @@ export default {
height
:
40rpx
;
height
:
40rpx
;
line-height
:
40rpx
;
line-height
:
40rpx
;
border-radius
:
10rpx
;
border-radius
:
10rpx
;
background
:
#2953ff
;
background
:
url('https://qn-static.banshouhui.com/study/pass.png')
no-repeat
;
b
order
:
2rpx
solid
#2953ff
;
b
ackground-size
:
40rpx
40rpx
;
text-align
:
center
;
text-align
:
center
;
}
}
.success
:before
{
content
:
'\2714'
;
color
:
#fff
;
}
.error
{
.error
{
width
:
40rpx
;
width
:
40rpx
;
height
:
40rpx
;
height
:
40rpx
;
line-height
:
40rpx
;
line-height
:
40rpx
;
border-radius
:
10rpx
;
border-radius
:
10rpx
;
background
:
#fa5a49
;
background
:
url('https://qn-static.banshouhui.com/study/fail.png')
no-repeat
;
b
order
:
2rpx
solid
#fa5a49
;
b
ackground-size
:
40rpx
40rpx
;
text-align
:
center
;
text-align
:
center
;
}
}
.error
:before
{
content
:
'\2716'
;
color
:
#fff
;
}
.text
{
.text
{
color
:
#191C27
;
color
:
#191C27
;
padding-left
:
20rpx
;
padding-left
:
20rpx
;
...
...
src/pages/learn/answer.vue
View file @
9af057a3
...
@@ -59,10 +59,11 @@
...
@@ -59,10 +59,11 @@
<view
<view
class=
"c-list"
class=
"c-list"
v-if=
"type === 1 || type === 3"
v-if=
"type === 1 || type === 3"
@
click=
"collection"
@
click=
"collection
(collectionFlag)
"
>
>
<u-icon
name=
"star"
color=
"#5A6073"
size=
"40"
></u-icon>
<u-icon
v-show=
"!collectionFlag"
name=
"star"
color=
"#5A6073"
size=
"40"
></u-icon>
<text>
收藏
</text>
<u-icon
v-show=
"collectionFlag"
name=
"star-fill"
color=
"#FF930D"
size=
"40"
></u-icon>
<text>
{{
collectionFlag
?
'已收藏'
:
'收藏'
}}
</text>
</view>
</view>
<view
class=
"c-list"
v-if=
"type === 2"
@
click=
"handPapers"
>
<view
class=
"c-list"
v-if=
"type === 2"
@
click=
"handPapers"
>
<u-icon
name=
"file-text"
color=
"#5A6073"
size=
"40"
></u-icon>
<u-icon
name=
"file-text"
color=
"#5A6073"
size=
"40"
></u-icon>
...
@@ -177,7 +178,8 @@ export default {
...
@@ -177,7 +178,8 @@ export default {
questionWarehouseId
:
null
,
questionWarehouseId
:
null
,
// 1.顺序答题 2.随机练习 3.模拟考试 4.收藏答题 5.错题答题 6.专项练习-单选 7.专项练习-多选 8.专项练习-判断 9.专项练习-答案是
// 1.顺序答题 2.随机练习 3.模拟考试 4.收藏答题 5.错题答题 6.专项练习-单选 7.专项练习-多选 8.专项练习-判断 9.专项练习-答案是
source
:
0
,
source
:
0
,
recordId
:
0
recordId
:
0
,
currentItem
:
{}
}
}
},
},
computed
:
{
computed
:
{
...
@@ -193,6 +195,10 @@ export default {
...
@@ -193,6 +195,10 @@ export default {
currentNumber
()
{
currentNumber
()
{
let
index
=
this
.
currentIndex
let
index
=
this
.
currentIndex
return
index
===
-
2
?
this
.
total
:
index
+
1
return
index
===
-
2
?
this
.
total
:
index
+
1
},
collectionFlag
()
{
const
info
=
this
.
list
.
find
(
v
=>
v
.
index
===
this
.
currentIndex
)
return
info
?
info
.
collectionFlag
:
false
}
}
},
},
onLoad
(
e
)
{
onLoad
(
e
)
{
...
@@ -254,7 +260,8 @@ export default {
...
@@ -254,7 +260,8 @@ export default {
})
})
},
},
// 切换
// 切换
swiperChange
(
e
)
{
swiperChange
(
e
,
currentItem
)
{
this
.
currentItem
=
currentItem
let
current
=
e
.
current
let
current
=
e
.
current
this
.
currentIndex
=
current
this
.
currentIndex
=
current
if
(
current
==
NO_PREV_PAGE
||
current
==
NO_NEXT_PAGE
)
{
if
(
current
==
NO_PREV_PAGE
||
current
==
NO_NEXT_PAGE
)
{
...
@@ -455,9 +462,10 @@ export default {
...
@@ -455,9 +462,10 @@ export default {
})
})
},
},
// 收藏
// 收藏
collection
()
{
collection
(
status
)
{
console
.
log
(
'this.list[this.currentIndex]'
,
this
.
list
[
this
.
currentIndex
])
const
info
=
this
.
list
.
find
(
v
=>
v
.
index
===
this
.
currentIndex
)
console
.
log
(
'收藏'
)
const
action
=
status
?
'joinCollection'
:
'removeCollection'
this
.
$u
.
api
[
action
]({
questionId
:
info
.
id
})
},
},
// 移除
// 移除
remove
()
{
remove
()
{
...
...
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