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
6b2e55e9
Commit
6b2e55e9
authored
Jul 22, 2021
by
Damon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 提交答案
parent
bc18f8f8
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
28 additions
and
7 deletions
+28
-7
.env.dev.js
.env.dev.js
+1
-1
http.interceptor.js
src/common/http.interceptor.js
+1
-0
index.vue
src/components/answer-sheet/index.vue
+7
-1
index.vue
src/components/swiper-limited-load/index.vue
+2
-2
answer.vue
src/pages/learn/answer.vue
+16
-3
utils.js
src/pages/learn/utils.js
+1
-0
No files found.
.env.dev.js
View file @
6b2e55e9
const
UNI_APP
=
{
const
UNI_APP
=
{
apiUrl
:
'http://192.168.0.20
8
:8760'
,
apiUrl
:
'http://192.168.0.20
4
:8760'
,
qn_base_url
:
'https://qn-static.banshouhui.com/study/'
,
qn_base_url
:
'https://qn-static.banshouhui.com/study/'
,
qn_asset_url
:
'http://deudn.c.pp.cc/'
,
qn_asset_url
:
'http://deudn.c.pp.cc/'
,
uCenterUrl
:
'http://192.168.0.5:8093/'
,
//'http://rest-u.yunya.com/'
uCenterUrl
:
'http://192.168.0.5:8093/'
,
//'http://rest-u.yunya.com/'
...
...
src/common/http.interceptor.js
View file @
6b2e55e9
...
@@ -11,6 +11,7 @@ const install = (Vue, vm) => {
...
@@ -11,6 +11,7 @@ const install = (Vue, vm) => {
'content-type'
:
'application/json; charset=utf-8'
,
'content-type'
:
'application/json; charset=utf-8'
,
},
},
loadingTime
:
800
,
loadingTime
:
800
,
showLoading
:
false
,
originalData
:
true
,
originalData
:
true
,
})
})
...
...
src/components/answer-sheet/index.vue
View file @
6b2e55e9
...
@@ -69,6 +69,7 @@ export default {
...
@@ -69,6 +69,7 @@ export default {
lists
:
[],
lists
:
[],
// 答案对错
// 答案对错
answer
:
''
,
answer
:
''
,
userAnswer
:
''
}
}
},
},
watch
:
{
watch
:
{
...
@@ -98,6 +99,8 @@ export default {
...
@@ -98,6 +99,8 @@ export default {
v
.
confirm
=
false
// 确认答案
v
.
confirm
=
false
// 确认答案
})
})
this
.
$set
(
this
.
lists
[
index
],
'confirm'
,
true
)
this
.
$set
(
this
.
lists
[
index
],
'confirm'
,
true
)
// 用户选的答案
this
.
userAnswer
=
this
.
lists
[
index
].
sort
// 判断所选答案是否正确
// 判断所选答案是否正确
this
.
answer
=
this
.
rightKey
.
includes
(
this
.
lists
[
index
].
sort
)
this
.
answer
=
this
.
rightKey
.
includes
(
this
.
lists
[
index
].
sort
)
?
'pass'
?
'pass'
...
@@ -114,6 +117,9 @@ export default {
...
@@ -114,6 +117,9 @@ export default {
if
(
num
.
length
>
1
)
{
if
(
num
.
length
>
1
)
{
// 判断所选答案是否正确
// 判断所选答案是否正确
const
checkedList
=
num
.
map
((
v
)
=>
v
.
sort
)
const
checkedList
=
num
.
map
((
v
)
=>
v
.
sort
)
// 用户选的答案
this
.
userAnswer
=
checkedList
.
join
(
','
)
// 判断所选答案是否正确
this
.
answer
=
equar
(
checkedList
,
this
.
rightKey
)
?
'pass'
:
'fail'
this
.
answer
=
equar
(
checkedList
,
this
.
rightKey
)
?
'pass'
:
'fail'
// 处理显示逻辑
// 处理显示逻辑
this
.
lists
.
forEach
((
v
)
=>
{
this
.
lists
.
forEach
((
v
)
=>
{
...
@@ -124,7 +130,7 @@ export default {
...
@@ -124,7 +130,7 @@ export default {
}
}
},
},
submitAnswer
()
{
submitAnswer
()
{
this
.
$emit
(
'change'
,
this
.
answer
,
this
.
lists
)
this
.
$emit
(
'change'
,
this
.
answer
,
this
.
lists
,
this
.
userAnswer
)
},
},
},
},
}
}
...
...
src/components/swiper-limited-load/index.vue
View file @
6b2e55e9
...
@@ -125,10 +125,10 @@ export default {
...
@@ -125,10 +125,10 @@ export default {
this
.
swiperIndex
=
current
this
.
swiperIndex
=
current
this
.
swiperCurrent
=
current
this
.
swiperCurrent
=
current
},
},
answerChange
(
status
,
lists
)
{
answerChange
(
status
,
lists
,
userAnswer
)
{
this
.
$set
(
this
.
swiperList
[
this
.
swiperIndex
],
'errShow'
,
this
.
type
===
2
?
true
:
status
===
'fail'
)
this
.
$set
(
this
.
swiperList
[
this
.
swiperIndex
],
'errShow'
,
this
.
type
===
2
?
true
:
status
===
'fail'
)
this
.
$set
(
this
.
swiperList
[
this
.
swiperIndex
],
'submitStatus'
,
true
)
this
.
$set
(
this
.
swiperList
[
this
.
swiperIndex
],
'submitStatus'
,
true
)
this
.
$emit
(
"answerChange"
,
status
,
lists
)
this
.
$emit
(
"answerChange"
,
status
,
lists
,
userAnswer
)
},
},
clear
()
{
clear
()
{
this
.
list
=
[]
this
.
list
=
[]
...
...
src/pages/learn/answer.vue
View file @
6b2e55e9
...
@@ -364,14 +364,15 @@ export default {
...
@@ -364,14 +364,15 @@ export default {
this
.
handPapers
()
this
.
handPapers
()
},
},
// 作答完毕
// 作答完毕
answerChange
(
status
,
lists
)
{
answerChange
(
status
,
lists
,
userAnswer
)
{
// 保存答题状态
// 保存答题状态
const
item
=
this
.
list
.
find
(
v
=>
v
.
index
===
this
.
currentIndex
)
const
item
=
this
.
list
.
find
(
v
=>
v
.
index
===
this
.
currentIndex
)
item
.
submitStatus
=
true
item
.
submitStatus
=
true
item
.
answerList
=
lists
item
.
answerList
=
lists
item
.
result
=
status
item
.
result
=
status
item
.
errShow
=
this
.
type
===
2
?
true
:
status
===
'fail'
item
.
errShow
=
this
.
type
===
2
?
true
:
status
===
'fail'
item
.
userAnswer
=
userAnswer
if
(
this
.
model
===
1
)
this
.
saveAnswer
(
item
)
// 更新答题卡
// 更新答题卡
if
(
this
.
type
===
1
){
if
(
this
.
type
===
1
){
this
.
questionList
[
this
.
currentIndex
]
=
item
this
.
questionList
[
this
.
currentIndex
]
=
item
...
@@ -391,7 +392,7 @@ export default {
...
@@ -391,7 +392,7 @@ export default {
// 如果回答错误或者是考试模式,自动进入下一题
// 如果回答错误或者是考试模式,自动进入下一题
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
)
{
if
(
this
.
type
===
2
)
{
this
.
handPapers
(
1
)
this
.
handPapers
(
1
)
this
.
submit
()
this
.
submit
()
...
@@ -403,6 +404,18 @@ export default {
...
@@ -403,6 +404,18 @@ export default {
})
})
}
}
},
},
// 保存答案
saveAnswer
(
info
)
{
const
params
=
{
answer
:
info
.
userAnswer
,
answerRight
:
info
.
result
===
'pass'
,
questionId
:
info
.
id
,
questionWarehouseId
:
this
.
questionWarehouseId
,
recordId
:
this
.
recordId
,
source
:
this
.
source
}
this
.
$u
.
api
.
answer
([
params
])
},
// 统计分数
// 统计分数
handPapers
(
type
)
{
handPapers
(
type
)
{
const
fail
=
this
.
list
.
filter
((
v
)
=>
v
.
result
===
'fail'
).
length
// 错题数
const
fail
=
this
.
list
.
filter
((
v
)
=>
v
.
result
===
'fail'
).
length
// 错题数
...
...
src/pages/learn/utils.js
View file @
6b2e55e9
...
@@ -135,6 +135,7 @@ function request({ currentPage, size, onSuccess, onFailed }, vm) {
...
@@ -135,6 +135,7 @@ function request({ currentPage, size, onSuccess, onFailed }, vm) {
}
}
let
item
=
{
let
item
=
{
index
:
i
+
(
currentPage
-
1
)
*
size
,
index
:
i
+
(
currentPage
-
1
)
*
size
,
id
:
info
.
id
,
currentPage
:
currentPage
,
currentPage
:
currentPage
,
total
:
data
.
total
,
total
:
data
.
total
,
title
:
content
.
title
,
title
:
content
.
title
,
...
...
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