Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
L
learn-online-pc
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
EzijingWeb
learn-online-pc
Commits
a07bd999
提交
a07bd999
authored
10月 19, 2020
作者:
王鹏飞
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
bug fixes
上级
882b76e0
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
10 行增加
和
24 行删除
+10
-24
chapterTest.vue
src/modules/viewer/components/work/chapterTest.vue
+10
-24
没有找到文件。
src/modules/viewer/components/work/chapterTest.vue
浏览文件 @
a07bd999
<
template
>
<
template
>
<container
:title=
"chapter.name"
v-loading=
"loading"
>
<container
:title=
"chapter.name"
v-loading=
"loading"
>
<template
v-slot:header-aside
v-if=
"isSubmited"
>
正确率:
{{
detail
.
score
}}
%
</
template
>
<template
v-slot:header-aside
v-if=
"isSubmited"
>
正确率:
{{
detail
.
score
}}
%
</
template
>
<div
class=
"exam"
>
<div
class=
"exam"
>
<div
class=
"exam-form"
>
<div
class=
"exam-form"
>
<el-form
:disabled=
"isSubmited"
>
<el-form
:disabled=
"isSubmited"
>
...
@@ -15,7 +15,7 @@
...
@@ -15,7 +15,7 @@
></exam-item>
></exam-item>
<div
class=
"exam-buttons"
>
<div
class=
"exam-buttons"
>
<el-tooltip
effect=
"dark"
content=
"提交之后就不能修改了哦"
placement=
"right"
>
<el-tooltip
effect=
"dark"
content=
"提交之后就不能修改了哦"
placement=
"right"
>
<el-button
type=
"primary"
:loading=
"submitLoading"
@
click=
"onSubmit"
>
{{
submitText
}}
</el-button>
<el-button
type=
"primary"
:loading=
"submitLoading"
@
click=
"onSubmit"
>
{{
submitText
}}
</el-button>
</el-tooltip>
</el-tooltip>
</div>
</div>
</el-form>
</el-form>
...
@@ -60,9 +60,7 @@ export default {
...
@@ -60,9 +60,7 @@ export default {
chapter
:
{
chapter
:
{
immediate
:
true
,
immediate
:
true
,
handler
(
data
)
{
handler
(
data
)
{
this
.
questions
=
data
.
homework
this
.
questions
=
data
.
homework
?
this
.
genQuenstions
(
data
.
homework
.
questions
)
:
[]
?
this
.
genQuenstions
(
data
.
homework
.
questions
)
:
[]
}
}
}
}
},
},
...
@@ -91,8 +89,7 @@ export default {
...
@@ -91,8 +89,7 @@ export default {
},
},
// 是否提交
// 是否提交
isSubmited
()
{
isSubmited
()
{
// return this.detail ? !!this.detail.work_contents : false
return
this
.
detail
?
!!
this
.
detail
.
work_contents
:
false
return
false
},
},
// 提交按钮文本
// 提交按钮文本
submitText
()
{
submitText
()
{
...
@@ -111,16 +108,13 @@ export default {
...
@@ -111,16 +108,13 @@ export default {
const
parseAnswers
=
JSON
.
parse
(
this
.
detail
.
work_contents
)
const
parseAnswers
=
JSON
.
parse
(
this
.
detail
.
work_contents
)
// 设置答案
// 设置答案
this
.
questions
=
this
.
questions
.
map
(
item
=>
{
this
.
questions
=
this
.
questions
.
map
(
item
=>
{
const
found
=
parseAnswers
.
find
(
const
found
=
parseAnswers
.
find
(
answer
=>
answer
.
question_id
===
item
.
id
)
answer
=>
answer
.
question_id
===
item
.
id
)
if
(
found
)
{
if
(
found
)
{
const
selectedIds
=
found
.
options
.
reduce
((
result
,
item
)
=>
{
const
selectedIds
=
found
.
options
.
reduce
((
result
,
item
)
=>
{
item
.
selected
&&
result
.
push
(
item
.
id
)
item
.
selected
&&
result
.
push
(
item
.
id
)
return
result
return
result
},
[])
},
[])
item
.
user_answer
=
item
.
user_answer
=
item
.
question_type
===
2
?
selectedIds
:
selectedIds
[
0
]
item
.
question_type
===
2
?
selectedIds
:
selectedIds
[
0
]
}
}
return
item
return
item
})
})
...
@@ -153,9 +147,7 @@ export default {
...
@@ -153,9 +147,7 @@ export default {
temp
=
{
temp
=
{
formModel
:
{
formModel
:
{
id
:
item
.
id
,
id
:
item
.
id
,
user_answer
:
item
.
user_answer
user_answer
:
item
.
user_answer
?
Base64
.
decode
(
item
.
user_answer
)
:
''
,
?
Base64
.
decode
(
item
.
user_answer
)
:
''
,
attachments
:
item
.
attachments
||
''
attachments
:
item
.
attachments
||
''
}
}
}
}
...
@@ -165,9 +157,7 @@ export default {
...
@@ -165,9 +157,7 @@ export default {
item
,
item
,
{
{
content
:
item
.
question_content
,
content
:
item
.
question_content
,
options
:
item
.
question_options
options
:
item
.
question_options
?
JSON
.
parse
(
item
.
question_options
)
:
[]
?
JSON
.
parse
(
item
.
question_options
)
:
[]
},
},
temp
temp
)
)
...
@@ -193,9 +183,7 @@ export default {
...
@@ -193,9 +183,7 @@ export default {
return
return
}
}
// 计算答题时间
// 计算答题时间
const
duration
=
Math
.
floor
(
const
duration
=
Math
.
floor
((
new
Date
().
getTime
()
-
this
.
startTime
)
/
1000
)
(
new
Date
().
getTime
()
-
this
.
startTime
)
/
1000
)
// 答案数据
// 答案数据
const
data
=
this
.
handleSubmitData
()
const
data
=
this
.
handleSubmitData
()
// 计算分数
// 计算分数
...
@@ -225,9 +213,7 @@ export default {
...
@@ -225,9 +213,7 @@ export default {
// 选择的项
// 选择的项
const
answers
=
item
.
formModel
.
user_answer
const
answers
=
item
.
formModel
.
user_answer
// 是否选中该项
// 是否选中该项
const
selected
=
Array
.
isArray
(
answers
)
const
selected
=
Array
.
isArray
(
answers
)
?
answers
.
includes
(
option
.
id
)
:
option
.
id
===
answers
?
answers
.
includes
(
option
.
id
)
:
option
.
id
===
answers
// 是否选择正确
// 是否选择正确
if
(
option
.
checked
!==
selected
&&
isCorrect
)
{
if
(
option
.
checked
!==
selected
&&
isCorrect
)
{
isCorrect
=
false
isCorrect
=
false
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论