Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
C
center-exam-show
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
EzijingWeb
center-exam-show
Commits
60c24cae
提交
60c24cae
authored
11月 06, 2023
作者:
王鹏飞
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
chore: 新增显示答案
上级
ae56e216
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
58 行增加
和
25 行删除
+58
-25
base.js
src/api/base.js
+2
-2
QuestionListItem.vue
src/components/QuestionListItem.vue
+3
-3
QuestionNum.vue
src/components/QuestionNum.vue
+39
-9
Exam.vue
src/views/Exam.vue
+14
-11
没有找到文件。
src/api/base.js
浏览文件 @
60c24cae
...
@@ -21,8 +21,8 @@ export function sendExamInfo(data) {
...
@@ -21,8 +21,8 @@ export function sendExamInfo(data) {
}
}
// 获取试卷
// 获取试卷
export
function
getTopic
(
examId
)
{
export
function
getTopic
(
examId
,
params
)
{
return
httpRequest
.
get
(
`/api/xexam/v1/exam/sheet/
${
examId
}
`
)
return
httpRequest
.
get
(
`/api/xexam/v1/exam/sheet/
${
examId
}
`
,
{
params
}
)
}
}
// 获取试卷缓存
// 获取试卷缓存
...
...
src/components/QuestionListItem.vue
浏览文件 @
60c24cae
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
<div
class=
"question-item-bd"
>
<div
class=
"question-item-bd"
>
<!-- 单选题 || 判断题 -->
<!-- 单选题 || 判断题 -->
<template
v-if=
"questionType == 1 || questionType == 6"
>
<template
v-if=
"questionType == 1 || questionType == 6"
>
<el-radio-group
v-model=
"question.answer[0]"
@
change=
"$emit('changeNumber', question.q_number)"
>
<el-radio-group
v-model=
"question.
user_
answer[0]"
@
change=
"$emit('changeNumber', question.q_number)"
>
<div
class=
"question-item-option"
v-for=
"item in currentQuestionOptions"
:key=
"item.id"
>
<div
class=
"question-item-option"
v-for=
"item in currentQuestionOptions"
:key=
"item.id"
>
<el-radio
:label=
"item.id"
>
{{
item
.
abc_option
}}
</el-radio>
<el-radio
:label=
"item.id"
>
{{
item
.
abc_option
}}
</el-radio>
</div>
</div>
...
@@ -15,7 +15,7 @@
...
@@ -15,7 +15,7 @@
</
template
>
</
template
>
<!-- 多选题 -->
<!-- 多选题 -->
<
template
v-if=
"questionType == 2"
>
<
template
v-if=
"questionType == 2"
>
<el-checkbox-group
v-model=
"question.answer"
@
change=
"$emit('changeNumber', question.q_number)"
>
<el-checkbox-group
v-model=
"question.
user_
answer"
@
change=
"$emit('changeNumber', question.q_number)"
>
<div
class=
"question-item-option"
v-for=
"item in currentQuestionOptions"
:key=
"item.id"
>
<div
class=
"question-item-option"
v-for=
"item in currentQuestionOptions"
:key=
"item.id"
>
<el-checkbox
:label=
"item.id"
>
{{
item
.
abc_option
}}
</el-checkbox>
<el-checkbox
:label=
"item.id"
>
{{
item
.
abc_option
}}
</el-checkbox>
</div>
</div>
...
@@ -23,7 +23,7 @@
...
@@ -23,7 +23,7 @@
</
template
>
</
template
>
<!-- 问答题 -->
<!-- 问答题 -->
<
template
v-if=
"questionType == 3"
>
<
template
v-if=
"questionType == 3"
>
<el-input
type=
"textarea"
placeholder=
"请输入内容"
v-model=
"question.answer[0]"
:autosize=
"
{ minRows: 6 }" @input="$emit('changeNumber', question.q_number)" />
<el-input
type=
"textarea"
placeholder=
"请输入内容"
v-model=
"question.
user_
answer[0]"
:autosize=
"
{ minRows: 6 }" @input="$emit('changeNumber', question.q_number)" />
</
template
>
</
template
>
</div>
</div>
</div>
</div>
...
...
src/components/QuestionNum.vue
浏览文件 @
60c24cae
...
@@ -19,7 +19,7 @@
...
@@ -19,7 +19,7 @@
<li
<li
v-for=
"item in group.question_list"
v-for=
"item in group.question_list"
:key=
"item.id"
:key=
"item.id"
:class=
"
{ stu1: !!item.
answer.length, stu2: item.q_number === questionNumber, stu3: item.sign
}"
:class=
"
{ stu1: !!item.
user_answer.length, stu2: item.q_number === questionNumber, stu3: item.sign, stu4: checkAnswer(item)
}"
@click="handleChange(item)">
@click="handleChange(item)">
{{
item
.
q_number
}}
{{
item
.
q_number
}}
</li>
</li>
...
@@ -44,14 +44,7 @@ export default {
...
@@ -44,14 +44,7 @@ export default {
questionNumber
:
{
type
:
Number
}
questionNumber
:
{
type
:
Number
}
},
},
data
()
{
data
()
{
return
{
return
{}
tipsList
:
[
{
className
:
'circle1'
,
title
:
'已答'
},
{
className
:
'circle2'
,
title
:
'未答'
},
{
className
:
'circle3'
,
title
:
'当前'
},
{
className
:
'circle4'
,
title
:
'标记'
}
]
}
},
},
computed
:
{
computed
:
{
questions
()
{
questions
()
{
...
@@ -62,11 +55,36 @@ export default {
...
@@ -62,11 +55,36 @@ export default {
},
[])
},
[])
return
{
...
group
,
question_list
}
return
{
...
group
,
question_list
}
})
})
},
pageOptions
()
{
const
{
show_answer
=
'0'
}
=
this
.
$route
.
query
return
{
showAnswer
:
show_answer
==
'1'
}
},
tipsList
()
{
const
list
=
[
{
className
:
'circle1'
,
title
:
'已答'
},
{
className
:
'circle2'
,
title
:
'未答'
},
{
className
:
'circle3'
,
title
:
'当前'
},
{
className
:
'circle4'
,
title
:
'标记'
}
]
if
(
this
.
pageOptions
.
showAnswer
)
{
list
.
push
({
className
:
'circle5'
,
title
:
'答错'
})
}
return
list
}
}
},
},
methods
:
{
methods
:
{
handleChange
(
item
)
{
handleChange
(
item
)
{
this
.
$emit
(
'changeNumber'
,
item
.
q_number
)
this
.
$emit
(
'changeNumber'
,
item
.
q_number
)
},
checkAnswer
(
item
)
{
if
(
this
.
pageOptions
.
showAnswer
&&
!!
item
.
user_answer
.
length
)
{
return
JSON
.
stringify
(
item
.
user_answer
)
!==
item
.
answer
}
else
{
return
false
}
}
}
}
}
}
}
...
@@ -158,6 +176,12 @@ export default {
...
@@ -158,6 +176,12 @@ export default {
border-radius
:
50%
;
border-radius
:
50%
;
}
}
}
}
&
.stu4
{
width
:
22px
;
height
:
22px
;
line-height
:
22px
;
border
:
2px
solid
#c01540
;
}
}
}
}
}
}
}
...
@@ -210,6 +234,12 @@ export default {
...
@@ -210,6 +234,12 @@ export default {
border-radius
:
50%
;
border-radius
:
50%
;
}
}
}
}
.circle5
{
width
:
24px
;
height
:
24px
;
border
:
2px
solid
#c01540
;
border-radius
:
50%
;
}
.txt
{
.txt
{
margin-top
:
5px
;
margin-top
:
5px
;
font-size
:
12px
;
font-size
:
12px
;
...
...
src/views/Exam.vue
浏览文件 @
60c24cae
...
@@ -95,12 +95,13 @@ export default {
...
@@ -95,12 +95,13 @@ export default {
return
this
.
questionNumber
<
this
.
paper
.
total_question_count
return
this
.
questionNumber
<
this
.
paper
.
total_question_count
},
},
pageOptions
()
{
pageOptions
()
{
const
{
has_time
=
'1'
,
has_mark
=
'1'
,
has_submit
=
'1'
,
has_save
=
'0'
}
=
this
.
$route
.
query
const
{
has_time
=
'1'
,
has_mark
=
'1'
,
has_submit
=
'1'
,
has_save
=
'0'
,
show_answer
=
'0'
}
=
this
.
$route
.
query
return
{
return
{
hasTime
:
has_time
!=
'0'
,
hasTime
:
has_time
==
'1'
,
hasMark
:
has_mark
!=
'0'
,
hasMark
:
has_mark
==
'1'
,
hasSubmit
:
has_submit
!=
'0'
,
hasSubmit
:
has_submit
==
'1'
,
hasSave
:
has_save
!=
'0'
hasSave
:
has_save
==
'1'
,
showAnswer
:
show_answer
==
'1'
}
}
}
}
},
},
...
@@ -116,7 +117,7 @@ export default {
...
@@ -116,7 +117,7 @@ export default {
async
fetchExam
()
{
async
fetchExam
()
{
this
.
pageOptions
.
hasTime
&&
this
.
setCountdownTimer
()
this
.
pageOptions
.
hasTime
&&
this
.
setCountdownTimer
()
try
{
try
{
const
res
=
await
api
.
getTopic
(
this
.
examId
)
const
res
=
await
api
.
getTopic
(
this
.
examId
,
{
show_answer
:
this
.
pageOptions
.
showAnswer
?
'1'
:
undefined
}
)
this
.
paper
=
res
this
.
paper
=
res
this
.
questionItems
=
this
.
genQuestionList
(
res
.
question_items
)
this
.
questionItems
=
this
.
genQuestionList
(
res
.
question_items
)
this
.
setCacheExamTimer
()
this
.
setCacheExamTimer
()
...
@@ -148,13 +149,13 @@ export default {
...
@@ -148,13 +149,13 @@ export default {
const
list
=
item
.
list
.
map
(
item
=>
{
const
list
=
item
.
list
.
map
(
item
=>
{
qNumber
++
qNumber
++
const
questionAnswers
=
groupAnswers
?.[
item
.
id
]
const
questionAnswers
=
groupAnswers
?.[
item
.
id
]
return
{
...
baseAttrs
,
...
item
,
sign
:
questionAnswers
?.
sign
||
false
,
answer
:
questionAnswers
?.
answer
||
[],
q_number
:
qNumber
}
return
{
...
baseAttrs
,
...
item
,
sign
:
questionAnswers
?.
sign
||
false
,
user_
answer
:
questionAnswers
?.
answer
||
[],
q_number
:
qNumber
}
})
})
return
{
...
baseAttrs
,
...
item
,
list
}
return
{
...
baseAttrs
,
...
item
,
list
}
}
else
{
}
else
{
qNumber
++
qNumber
++
const
questionAnswers
=
groupAnswers
?.[
item
.
id
]
const
questionAnswers
=
groupAnswers
?.[
item
.
id
]
return
{
...
baseAttrs
,
...
item
,
sign
:
questionAnswers
?.
sign
||
false
,
answer
:
questionAnswers
?.
answer
||
[],
q_number
:
qNumber
}
return
{
...
baseAttrs
,
...
item
,
sign
:
questionAnswers
?.
sign
||
false
,
user_
answer
:
questionAnswers
?.
answer
||
[],
q_number
:
qNumber
}
}
}
})
})
return
{
...
group
,
question_list
}
return
{
...
group
,
question_list
}
...
@@ -166,11 +167,11 @@ export default {
...
@@ -166,11 +167,11 @@ export default {
group
.
question_list
.
forEach
(
item
=>
{
group
.
question_list
.
forEach
(
item
=>
{
if
(
item
.
list
)
{
if
(
item
.
list
)
{
item
.
list
.
forEach
(
item
=>
{
item
.
list
.
forEach
(
item
=>
{
const
data
=
{
[
item
.
question_item_type
]:
{
[
item
.
id
]:
{
answer
:
item
.
answer
,
sign
:
item
.
sign
}
}
}
const
data
=
{
[
item
.
question_item_type
]:
{
[
item
.
id
]:
{
answer
:
item
.
user_
answer
,
sign
:
item
.
sign
}
}
}
result
=
merge
(
result
,
data
)
result
=
merge
(
result
,
data
)
})
})
}
else
{
}
else
{
const
data
=
{
[
item
.
question_item_type
]:
{
[
item
.
id
]:
{
answer
:
item
.
answer
,
sign
:
item
.
sign
}
}
}
const
data
=
{
[
item
.
question_item_type
]:
{
[
item
.
id
]:
{
answer
:
item
.
user_
answer
,
sign
:
item
.
sign
}
}
}
result
=
merge
(
result
,
data
)
result
=
merge
(
result
,
data
)
}
}
})
})
...
@@ -193,7 +194,9 @@ export default {
...
@@ -193,7 +194,9 @@ export default {
async
handleSubmitExam
()
{
async
handleSubmitExam
()
{
const
count
=
parseInt
(
this
.
paper
.
total_question_count
)
-
parseInt
(
this
.
getAnswerCount
())
const
count
=
parseInt
(
this
.
paper
.
total_question_count
)
-
parseInt
(
this
.
getAnswerCount
())
const
confirmText
=
const
confirmText
=
count
===
0
?
'确定后要结束本次考试?还有作答时间,结束考试后,将不能返回本次考试!'
:
`确定要结束本次考试?还有
${
count
}
题未答,结束考试后,将不能返回本次考试`
count
===
0
?
'确定后要结束本次考试?还有作答时间,结束考试后,将不能返回本次考试!'
:
`确定要结束本次考试?还有
${
count
}
题未答,结束考试后,将不能返回本次考试`
await
this
.
$confirm
(
confirmText
,
'提示'
,
{
await
this
.
$confirm
(
confirmText
,
'提示'
,
{
confirmButtonText
:
'确定'
,
confirmButtonText
:
'确定'
,
cancelButtonText
:
'关闭'
,
cancelButtonText
:
'关闭'
,
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论