Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
X
x-learn
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
EzijingWeb
x-learn
Commits
86e3e6c3
提交
86e3e6c3
authored
10月 20, 2021
作者:
王鹏飞
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
updates
上级
cf194517
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
63 行增加
和
53 行删除
+63
-53
examCard.vue
src/components/exam/examCard.vue
+0
-0
index.vue
src/pages/exam/courseExam/chapter/index.vue
+15
-21
questionDetails.vue
src/pages/exam/myExam/questionDetails.vue
+34
-31
index.vue
src/pages/exam/testExam/exam/index.vue
+14
-1
没有找到文件。
src/components/exam/examCard.vue
浏览文件 @
86e3e6c3
差异被折叠。
点击展开。
src/pages/exam/courseExam/chapter/index.vue
浏览文件 @
86e3e6c3
...
...
@@ -2,8 +2,9 @@
<exam-card
title=
"课后练习"
:data=
"data"
@
submitExam=
"handleSubmit"
:hasCountDown=
"false"
:hasCountdown=
"false"
@
submit=
"handleSubmit"
@
back=
"handleBack"
v-if=
"Object.keys(data).length"
></exam-card>
</
template
>
...
...
@@ -36,10 +37,9 @@ export default {
this
.
data
=
JSON
.
parse
(
response
.
data
).
sheet
})
},
// 缓存答案
handleCache
(
data
)
{
const
params
=
this
.
genSubmitData
(
data
)
api
.
setCourseCache
(
Object
.
assign
(
params
,
{
status
:
0
}))
// 返回
handleBack
()
{
this
.
$router
.
push
(
`/course/learn/
${
this
.
$route
.
query
.
course_id
}
`
)
},
// 提交答案
handleSubmit
(
data
)
{
...
...
@@ -52,26 +52,20 @@ export default {
})
},
// 组装提交数据
genSubmitData
(
question
List
)
{
genSubmitData
(
question
Groups
)
{
const
answers
=
{}
question
List
.
forEach
(
item
=>
{
if
(
!
answers
[
item
.
question_item_id
])
{
answers
[
item
.
question_item_id
]
=
{}
question
Groups
.
forEach
(
group
=>
{
if
(
!
answers
[
group
.
question_item_id
])
{
answers
[
group
.
question_item_id
]
=
{}
}
item
.
question_list
.
forEach
(
cI
tem
=>
{
answers
[
item
.
question_item_id
][
cI
tem
.
id
]
=
{
sign
:
cItem
.
sign
?
cI
tem
.
sign
:
false
,
answers
:
cI
tem
.
user_answer
group
.
question_list
.
forEach
(
i
tem
=>
{
answers
[
item
.
question_item_id
][
i
tem
.
id
]
=
{
sign
:
item
.
sign
?
i
tem
.
sign
:
false
,
answers
:
i
tem
.
user_answer
}
})
})
return
{
type
:
1
,
sheet_id
:
this
.
data
.
id
,
status
:
0
,
answers
:
JSON
.
stringify
(
answers
),
duration
:
0
}
return
{
type
:
1
,
sheet_id
:
this
.
data
.
id
,
status
:
0
,
answers
:
JSON
.
stringify
(
answers
),
duration
:
0
}
}
}
}
...
...
src/pages/exam/myExam/questionDetails.vue
浏览文件 @
86e3e6c3
<
template
>
<exam-card
:title=
"title"
:
questionItems=
"questionItem
s"
:
groups=
"questionGroup
s"
:hasMark=
"false"
:hasDeleteBtn=
"true"
:hasCountDown=
"false"
:hasShowResultBtn=
"true"
submitButtonText=
"清空记录,重新答题"
@
submitExam=
"handleSubmit"
@
back=
"handleBack"
@
submit=
"handleSubmit"
@
page-change=
"handlePageChange"
@
delete
Question
=
"deleteQuestion"
@
delete=
"deleteQuestion"
ref=
"exam"
v-if=
"Object.keys(data).length"
></exam-card>
...
...
@@ -28,10 +30,10 @@ export default {
title
()
{
return
this
.
$route
.
query
.
type
===
'1'
?
'错题集合'
:
'收藏试题'
},
question
Item
s
()
{
return
this
.
data
.
list
.
map
(
groups
=>
{
const
[
first
=
{}]
=
groups
return
{
question_item_id
:
''
,
question_type
:
first
.
question_type
,
question_list
:
groups
,
hasResult
:
false
}
question
Group
s
()
{
return
this
.
data
.
list
.
map
(
list
=>
{
const
[
first
=
{}]
=
list
return
{
question_item_id
:
''
,
question_type
:
first
.
question_type
,
question_list
:
list
,
hasResult
:
false
}
})
}
},
...
...
@@ -46,15 +48,20 @@ export default {
question_id
:
data
.
question_list
[
0
].
question_id
,
type
:
this
.
$route
.
query
.
type
}
api
.
deleteQuestion
(
param
)
.
then
(
response
=>
{
// this.getTopic()
this
.
$router
.
go
(
0
)
api
.
deleteQuestion
(
param
).
then
(
response
=>
{
this
.
getTopic
().
then
(()
=>
{
// 重置
this
.
$refs
.
exam
.
reset
()
})
.
finally
(()
=>
{
})
console
.
log
(
data
)
})
},
// 返回
handleBack
()
{
if
(
this
.
$route
.
query
.
type
===
'1'
)
{
this
.
$router
.
push
(
'/my/questions/wrong'
)
}
else
{
this
.
$router
.
push
(
'/my/questions/collection'
)
}
},
// 获取考卷
getTopic
()
{
...
...
@@ -65,7 +72,7 @@ export default {
page
:
this
.
page
,
page_size
:
20
}
api
.
getMyQuestion
(
param
).
then
(
response
=>
{
return
api
.
getMyQuestion
(
param
).
then
(
response
=>
{
this
.
data
=
response
})
},
...
...
@@ -81,25 +88,21 @@ export default {
})
},
// 缓存答案
handlePageChange
(
data
)
{
this
.
cacheQuestion
(
this
.
genSubmitData
(
this
.
$refs
.
exam
.
questionItem
s
))
handlePageChange
(
data
,
groups
)
{
this
.
cacheQuestion
(
this
.
genSubmitData
(
group
s
))
},
cacheQuestion
(
param
,
call
)
{
api
.
setMyCache
(
param
)
.
then
(
response
=>
{
call
()
})
.
finally
(()
=>
{
})
cacheQuestion
(
param
,
callback
)
{
api
.
setMyCache
(
param
).
then
(
response
=>
{
callback
&&
callback
()
})
},
// 组装提交数据
genSubmitData
(
question
List
)
{
genSubmitData
(
question
Groups
)
{
const
answers
=
{}
question
List
.
forEach
(
item
=>
{
item
.
question_list
.
forEach
(
cI
tem
=>
{
if
(
cI
tem
.
user_answer
.
length
)
{
answers
[
cItem
.
question_id
]
=
cI
tem
.
user_answer
question
Groups
.
forEach
(
group
=>
{
group
.
question_list
.
forEach
(
i
tem
=>
{
if
(
i
tem
.
user_answer
.
length
)
{
answers
[
item
.
question_id
]
=
i
tem
.
user_answer
}
})
})
...
...
src/pages/exam/testExam/exam/index.vue
浏览文件 @
86e3e6c3
<
template
>
<div>
<exam-card
:hasSubmitBtn=
"!!(!this.$route.query.id)"
:hasCountDown=
"!!(!this.$route.query.id)"
v-if=
"Object.keys(data).length"
@
submitExam=
"submitExam"
ref=
"exam"
title=
"模拟考试"
:data=
"data"
></exam-card>
<exam-card
title=
"模拟考试"
:hasSubmitBtn=
"!!!this.$route.query.id"
:hasCountdown=
"!!!this.$route.query.id"
:data=
"data"
@
submit=
"submitExam"
@
back=
"handleBack"
ref=
"exam"
v-if=
"Object.keys(data).length"
></exam-card>
</div>
</
template
>
<
script
>
...
...
@@ -47,6 +56,10 @@ export default {
this
.
data
=
JSON
.
parse
(
response
.
data
).
sheet
})
},
// 返回
handleBack
()
{
this
.
$router
.
push
(
'/testExam'
)
},
// 提交考卷 isCache:0缓存,1提交
submitExam
(
isCache
)
{
const
refData
=
this
.
$refs
.
exam
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论