Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
C
center-qa
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
EzijingWeb
center-qa
Commits
590d575d
提交
590d575d
authored
3月 03, 2022
作者:
王鹏飞
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
bug fixes
上级
9a22a3b3
隐藏空白字符变更
内嵌
并排
正在显示
7 个修改的文件
包含
82 行增加
和
50 行删除
+82
-50
AddPaper.vue
src/modules/paper/components/AddPaper.vue
+27
-21
PaperQuestions.vue
src/modules/paper/components/PaperQuestions.vue
+1
-0
QuestionList.vue
src/modules/paper/components/QuestionList.vue
+16
-2
QuestionListItem.vue
src/modules/paper/components/QuestionListItem.vue
+17
-13
QuestionNum.vue
src/modules/paper/components/QuestionNum.vue
+3
-0
Detail.vue
src/modules/paper/views/Detail.vue
+6
-4
Update.vue
src/modules/paper/views/Update.vue
+12
-10
没有找到文件。
src/modules/paper/components/AddPaper.vue
浏览文件 @
590d575d
...
@@ -46,7 +46,7 @@
...
@@ -46,7 +46,7 @@
</el-form>
</el-form>
<div
class=
"buttons"
>
<div
class=
"buttons"
>
<el-button
type=
"primary"
@
click=
"prevStep"
>
上一步
</el-button>
<el-button
type=
"primary"
@
click=
"prevStep"
>
上一步
</el-button>
<el-button
type=
"primary"
style=
"margin-left: 20px"
@
click=
"handleSave"
>
保存
</el-button>
<el-button
type=
"primary"
style=
"margin-left: 20px"
:disabled=
"loading"
@
click=
"handleSave"
>
保存
</el-button>
</div>
</div>
</div>
</div>
<BatchSetting
<BatchSetting
...
@@ -76,7 +76,8 @@ export default {
...
@@ -76,7 +76,8 @@ export default {
questions
:
[],
// 选择的完整试题列表
questions
:
[],
// 选择的完整试题列表
questionTypeGroups
:
{},
// 试题类型组
questionTypeGroups
:
{},
// 试题类型组
visible
:
false
,
visible
:
false
,
batchSettingQuestionType
:
null
// 批量设置试题类型
batchSettingQuestionType
:
null
,
// 批量设置试题类型
loading
:
false
}
}
},
},
computed
:
{
computed
:
{
...
@@ -111,30 +112,35 @@ export default {
...
@@ -111,30 +112,35 @@ export default {
},
},
// 批量获取试题列表,根据选中的试题
// 批量获取试题列表,根据选中的试题
batchGetQuestionList
()
{
batchGetQuestionList
()
{
this
.
loading
=
true
const
ids
=
this
.
multipleSelection
.
map
(
item
=>
item
.
id
)
const
ids
=
this
.
multipleSelection
.
map
(
item
=>
item
.
id
)
batchGetQuestionList
({
ids
}).
then
(
res
=>
{
batchGetQuestionList
({
ids
})
this
.
questions
=
res
.
data
.
then
(
res
=>
{
this
.
questionTypeGroups
=
this
.
questions
.
reduce
((
result
,
item
)
=>
{
this
.
questions
=
res
.
data
const
map
=
{
1
:
'单选题'
,
2
:
'多选题'
,
3
:
'问答题'
,
5
:
'案例题'
,
6
:
'判断题'
,
7
:
'实操题'
,
8
:
'情景题'
}
this
.
questionTypeGroups
=
this
.
questions
.
reduce
((
result
,
item
)
=>
{
if
(
result
[
item
.
question_type
])
{
const
map
=
{
1
:
'单选题'
,
2
:
'多选题'
,
3
:
'问答题'
,
5
:
'案例题'
,
6
:
'判断题'
,
7
:
'实操题'
,
8
:
'情景题'
}
result
[
item
.
question_type
].
total
+=
1
if
(
result
[
item
.
question_type
])
{
result
[
item
.
question_type
].
questions
.
push
(
item
)
result
[
item
.
question_type
].
total
+=
1
}
else
{
result
[
item
.
question_type
].
questions
.
push
(
item
)
result
[
item
.
question_type
]
=
{
}
else
{
total
:
1
,
result
[
item
.
question_type
]
=
{
question_type
:
item
.
question_type
,
total
:
1
,
question_type_name
:
map
[
item
.
question_type
],
question_type
:
item
.
question_type
,
score
:
'0'
,
question_type_name
:
map
[
item
.
question_type
],
questions
:
[
item
]
score
:
'0'
,
questions
:
[
item
]
}
}
}
}
return
result
return
result
},
{})
},
{})
})
})
.
finally
(()
=>
{
this
.
loading
=
false
})
},
},
// 是否可以批量设置分数
// 是否可以批量设置分数
canBatchSetting
(
value
)
{
canBatchSetting
(
value
)
{
return
[
1
,
2
,
6
].
includes
(
value
)
return
[
1
,
2
,
3
,
6
].
includes
(
value
)
},
},
// 批量设置分数
// 批量设置分数
showBatchSetting
(
data
)
{
showBatchSetting
(
data
)
{
...
...
src/modules/paper/components/PaperQuestions.vue
浏览文件 @
590d575d
...
@@ -96,6 +96,7 @@ export default {
...
@@ -96,6 +96,7 @@ export default {
// 删除选中试题
// 删除选中试题
handleRemove
()
{
handleRemove
()
{
this
.
questions
=
this
.
questions
.
filter
(
item
=>
!
this
.
multipleSelection
.
includes
(
item
.
id
))
this
.
questions
=
this
.
questions
.
filter
(
item
=>
!
this
.
multipleSelection
.
includes
(
item
.
id
))
this
.
multipleSelection
=
[]
},
},
// 保存试卷
// 保存试卷
handleSubmit
()
{
handleSubmit
()
{
...
...
src/modules/paper/components/QuestionList.vue
浏览文件 @
590d575d
...
@@ -10,7 +10,13 @@
...
@@ -10,7 +10,13 @@
v-on=
"$listeners"
v-on=
"$listeners"
>
>
<template
v-if=
"item.children && item.children.length"
>
<template
v-if=
"item.children && item.children.length"
>
<question-list
:list=
"item.children"
:key=
"item.id"
v-bind=
"$attrs"
v-on=
"$listeners"
>
<question-list
:list=
"item.children"
:key=
"item.id"
@
change=
"handleChange(item)"
v-bind=
"$attrs"
v-on=
"$listeners"
>
<template
#
selection
>
<template
#
selection
>
<slot
name=
"selection"
v-bind=
"item"
></slot>
<slot
name=
"selection"
v-bind=
"item"
></slot>
</
template
>
</
template
>
...
@@ -30,6 +36,14 @@ import QuestionListItem from './QuestionListItem.vue'
...
@@ -30,6 +36,14 @@ import QuestionListItem from './QuestionListItem.vue'
export
default
{
export
default
{
name
:
'QuestionList'
,
name
:
'QuestionList'
,
props
:
{
list
:
{
type
:
Array
,
default
:
()
=>
[]
}
},
props
:
{
list
:
{
type
:
Array
,
default
:
()
=>
[]
}
},
components
:
{
QuestionListItem
}
components
:
{
QuestionListItem
},
methods
:
{
handleChange
(
data
)
{
// 直接修改父级分数
data
.
score
=
data
.
children
.
reduce
((
total
,
item
)
=>
{
return
total
+
item
.
score
},
0
)
}
}
}
}
</
script
>
</
script
>
src/modules/paper/components/QuestionListItem.vue
浏览文件 @
590d575d
<
template
>
<
template
>
<el-card
style=
"margin-bottom: 20px"
shadow=
"hover"
>
<el-card
style=
"margin-bottom: 20px"
shadow=
"hover"
:id=
"`question_index_$
{index}`"
>
<div
class=
"question-item"
>
<div
class=
"question-item"
>
<div
class=
"question-item-selection"
>
<div
class=
"question-item-selection"
>
<slot
name=
"selection"
></slot>
<slot
name=
"selection"
></slot>
...
@@ -18,6 +18,7 @@
...
@@ -18,6 +18,7 @@
:min=
"0"
:min=
"0"
:disabled=
"disableScore || hasChildren"
:disabled=
"disableScore || hasChildren"
style=
"width: 80px"
style=
"width: 80px"
@
change=
"changeScore"
></el-input-number>
></el-input-number>
</div>
</div>
</div>
</div>
...
@@ -58,12 +59,12 @@
...
@@ -58,12 +59,12 @@
</el-radio-group>
</el-radio-group>
</
template
>
</
template
>
</div>
</div>
<div
class=
"question-item-ft"
>
<div
class=
"question-item-ft"
v-if=
"correctAnswerText || data.question_analysis"
>
<dl>
<dl
v-if=
"correctAnswerText"
>
<dt>
正确答案:
</dt>
<dt>
正确答案:
</dt>
<dd
class=
"is-answer"
>
{{ correctAnswerText }}
</dd>
<dd
class=
"is-answer"
>
{{ correctAnswerText }}
</dd>
</dl>
</dl>
<dl>
<dl
v-if=
"data.question_analysis"
>
<dt>
试题解析:
</dt>
<dt>
试题解析:
</dt>
<dd><div
v-html=
"data.question_analysis"
></div></dd>
<dd><div
v-html=
"data.question_analysis"
></div></dd>
</dl>
</dl>
...
@@ -84,11 +85,8 @@ export default {
...
@@ -84,11 +85,8 @@ export default {
hasChildren
:
{
type
:
Boolean
,
default
:
false
}
hasChildren
:
{
type
:
Boolean
,
default
:
false
}
},
},
data
()
{
data
()
{
return
{
return
{}
question
:
{}
}
},
},
computed
:
{
computed
:
{
// 试题类型
// 试题类型
questionType
()
{
questionType
()
{
...
@@ -110,14 +108,15 @@ export default {
...
@@ -110,14 +108,15 @@ export default {
},
},
// 处理后的options数据
// 处理后的options数据
currentQuestionOptions
()
{
currentQuestionOptions
()
{
if
(
!
this
.
data
.
question_options
)
{
const
options
=
this
.
data
.
question_options
||
[]
if
(
!
options
.
length
)
{
return
[]
return
[]
}
}
return
this
.
data
.
question_
options
.
map
((
item
,
index
)
=>
{
return
options
.
map
((
item
,
index
)
=>
{
// 英文字母 + 名称
// 英文字母 + 名称
item
.
abc
=
this
.
A_Z
[
index
]
const
abc
=
this
.
A_Z
[
index
]
item
.
abc_o
ption
=
`
${
this
.
A_Z
[
index
]}
.
${
item
.
option
}
`
const
abcO
ption
=
`
${
this
.
A_Z
[
index
]}
.
${
item
.
option
}
`
return
item
return
{
...
item
,
abc
,
abc_option
:
abcOption
}
})
})
},
},
// 正确答案显示的英文字母
// 正确答案显示的英文字母
...
@@ -128,6 +127,11 @@ export default {
...
@@ -128,6 +127,11 @@ export default {
},
[])
},
[])
return
result
.
join
(
'、'
)
return
result
.
join
(
'、'
)
}
}
},
methods
:
{
changeScore
()
{
this
.
$emit
(
'change'
,
this
.
data
)
}
}
}
}
}
</
script
>
</
script
>
...
...
src/modules/paper/components/QuestionNum.vue
浏览文件 @
590d575d
...
@@ -35,6 +35,9 @@ export default {
...
@@ -35,6 +35,9 @@ export default {
},
},
methods
:
{
methods
:
{
handleClick
(
index
)
{
handleClick
(
index
)
{
const
qItemEl
=
document
.
querySelector
(
`#question_index_
${
index
+
1
}
`
)
const
top
=
qItemEl
.
getBoundingClientRect
().
top
window
.
scrollTo
(
0
,
top
+
document
.
documentElement
.
scrollTop
-
84
)
this
.
currentIndex
=
index
this
.
currentIndex
=
index
this
.
$emit
(
'indexClick'
,
`
${
index
+
1
}
`
)
this
.
$emit
(
'indexClick'
,
`
${
index
+
1
}
`
)
}
}
...
...
src/modules/paper/views/Detail.vue
浏览文件 @
590d575d
...
@@ -14,11 +14,13 @@
...
@@ -14,11 +14,13 @@
<el-descriptions-item
label=
"及格分数"
>
{{ detail.pass_score }}
</el-descriptions-item>
<el-descriptions-item
label=
"及格分数"
>
{{ detail.pass_score }}
</el-descriptions-item>
<el-descriptions-item
label=
"考试时长"
>
{{ detail.paper_times }}分钟
</el-descriptions-item>
<el-descriptions-item
label=
"考试时长"
>
{{ detail.paper_times }}分钟
</el-descriptions-item>
<el-descriptions-item
label=
"最短交卷时长"
>
{{ detail.minimum_paper_handing_time }}分钟
</el-descriptions-item>
<el-descriptions-item
label=
"最短交卷时长"
>
{{ detail.minimum_paper_handing_time }}分钟
</el-descriptions-item>
<el-descriptions-item
label=
"试题顺序"
>
{{ detail.paper_question_order_name }}
</el-descriptions-item>
<el-descriptions-item
label=
"试题顺序"
v-if=
"detail.paper_type === 1"
>
{{ detail.paper_question_order_name }}
</el-descriptions-item>
<el-descriptions-item
label=
"多次考试"
>
{{ detail.is_multiple_exams_name }}
</el-descriptions-item>
<el-descriptions-item
label=
"多次考试"
>
{{ detail.is_multiple_exams_name }}
</el-descriptions-item>
<el-descriptions-item
label=
"多次考试成绩计算规则"
v-if=
"detail.is_multiple_exams
_name === '是'"
>
{{
<el-descriptions-item
label=
"多次考试成绩计算规则"
v-if=
"detail.is_multiple_exams
=== 1"
>
detail.multiple_test_score_rule_name
{{ detail.multiple_test_score_rule_name }}
}}
</el-descriptions-item>
</el-descriptions-item>
</el-descriptions>
</el-descriptions>
</app-card>
</app-card>
<!-- 试卷列表 -->
<!-- 试卷列表 -->
...
...
src/modules/paper/views/Update.vue
浏览文件 @
590d575d
...
@@ -69,7 +69,7 @@
...
@@ -69,7 +69,7 @@
:controls=
"false"
:controls=
"false"
v-model=
"form.pass_score"
v-model=
"form.pass_score"
:min=
"0"
:min=
"0"
:max=
"200"
:max=
"
form.paper_total_score ||
200"
placeholder=
"请输入及格分数"
placeholder=
"请输入及格分数"
style=
"width: 100%"
style=
"width: 100%"
:precision=
"0"
:precision=
"0"
...
@@ -140,6 +140,13 @@ export default {
...
@@ -140,6 +140,13 @@ export default {
props
:
{
id
:
{
type
:
String
}
},
props
:
{
id
:
{
type
:
String
}
},
components
:
{
QuestionTypeTreeselect
},
components
:
{
QuestionTypeTreeselect
},
data
()
{
data
()
{
const
checkPassScore
=
(
rule
,
value
,
callback
)
=>
{
if
(
value
>
this
.
form
.
paper_total_score
)
{
callback
(
new
Error
(
'及格分数不能大于试卷总分'
))
}
else
{
callback
()
}
}
return
{
return
{
form
:
{
form
:
{
paper_title
:
''
,
// 试卷名称
paper_title
:
''
,
// 试卷名称
...
@@ -162,7 +169,10 @@ export default {
...
@@ -162,7 +169,10 @@ export default {
paper_type
:
[{
message
:
'请选择组卷模式'
,
required
:
true
,
trigger
:
'change'
}],
paper_type
:
[{
message
:
'请选择组卷模式'
,
required
:
true
,
trigger
:
'change'
}],
paper_total_score
:
[{
message
:
'请输入试卷总分'
,
required
:
true
,
trigger
:
'blur'
}],
paper_total_score
:
[{
message
:
'请输入试卷总分'
,
required
:
true
,
trigger
:
'blur'
}],
paper_question_order
:
[{
message
:
'请选择试题顺序'
,
required
:
true
,
trigger
:
'change'
}],
paper_question_order
:
[{
message
:
'请选择试题顺序'
,
required
:
true
,
trigger
:
'change'
}],
pass_score
:
[{
message
:
'请输入及格分数'
,
required
:
true
,
trigger
:
'blur'
}],
pass_score
:
[
{
message
:
'请输入及格分数'
,
required
:
true
,
trigger
:
'blur'
},
{
validator
:
checkPassScore
,
trigger
:
'blur'
}
],
paper_times
:
[{
message
:
'请输入考试时长'
,
required
:
true
,
trigger
:
'blur'
}],
paper_times
:
[{
message
:
'请输入考试时长'
,
required
:
true
,
trigger
:
'blur'
}],
minimum_paper_handing_time
:
[{
message
:
'请输入考试时长'
,
required
:
true
,
trigger
:
'blur'
}],
minimum_paper_handing_time
:
[{
message
:
'请输入考试时长'
,
required
:
true
,
trigger
:
'blur'
}],
is_multiple_exams
:
[{
message
:
'请选择是否多次考试'
,
required
:
true
,
trigger
:
'change'
}]
is_multiple_exams
:
[{
message
:
'请选择是否多次考试'
,
required
:
true
,
trigger
:
'change'
}]
...
@@ -188,10 +198,6 @@ export default {
...
@@ -188,10 +198,6 @@ export default {
},
},
// 保存
// 保存
handleSubmit
()
{
handleSubmit
()
{
if
(
this
.
form
.
pass_score
>=
this
.
form
.
paper_total_score
)
{
this
.
$message
.
warning
(
'及格分数要小于试卷总分'
)
return
}
this
.
$refs
.
form
.
validate
().
then
(()
=>
{
this
.
$refs
.
form
.
validate
().
then
(()
=>
{
// 保存成功回到列表
// 保存成功回到列表
if
(
this
.
isEdit
)
{
if
(
this
.
isEdit
)
{
...
@@ -207,10 +213,6 @@ export default {
...
@@ -207,10 +213,6 @@ export default {
},
},
// 保存并选择试题
// 保存并选择试题
handleSubmitSelect
()
{
handleSubmitSelect
()
{
if
(
this
.
form
.
pass_score
>=
this
.
form
.
paper_total_score
)
{
this
.
$message
.
warning
(
'及格分数要小于试卷总分'
)
return
}
this
.
$refs
.
form
.
validate
().
then
(
async
()
=>
{
this
.
$refs
.
form
.
validate
().
then
(
async
()
=>
{
if
(
this
.
isEdit
)
{
if
(
this
.
isEdit
)
{
this
.
updatePaper
(()
=>
{
this
.
updatePaper
(()
=>
{
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论