Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
C
center-qa
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
EzijingWeb
center-qa
Commits
01bcb2cb
提交
01bcb2cb
authored
3月 03, 2022
作者:
王鹏飞
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
bug fixes
上级
84211d17
显示空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
143 行增加
和
42 行删除
+143
-42
AddPaper.vue
src/modules/paper/components/AddPaper.vue
+1
-1
AutomaticPaper.vue
src/modules/paper/components/AutomaticPaper.vue
+16
-17
BatchSetting.vue
src/modules/paper/components/BatchSetting.vue
+1
-1
PaperQuestions.vue
src/modules/paper/components/PaperQuestions.vue
+68
-5
QuestionListItem.vue
src/modules/paper/components/QuestionListItem.vue
+2
-3
QuestionNum.vue
src/modules/paper/components/QuestionNum.vue
+55
-15
没有找到文件。
src/modules/paper/components/AddPaper.vue
浏览文件 @
01bcb2cb
...
...
@@ -88,7 +88,7 @@ export default {
// 已添加的试题总分
addedQuestionsScore
()
{
return
this
.
addedQuestions
.
reduce
((
total
,
item
)
=>
{
return
total
+
parse
In
t
(
item
.
score
)
return
total
+
parse
Floa
t
(
item
.
score
)
},
0
)
}
},
...
...
src/modules/paper/components/AutomaticPaper.vue
浏览文件 @
01bcb2cb
...
...
@@ -63,12 +63,7 @@
<el-table-column
align=
"center"
label=
"每题分值"
width=
"140"
>
<
template
slot-scope=
"{ row }"
>
<el-input-number
v-model=
"row.question_score"
:min=
"0"
step-strictly
style=
"width: 100%"
></el-input-number>
<el-input-number
v-model=
"row.question_score"
:min=
"0"
:max=
"30"
style=
"width: 100%"
></el-input-number>
</
template
>
</el-table-column>
...
...
@@ -157,7 +152,6 @@ export default {
question_num
:
''
,
question_score
:
''
,
question_categories
:
[],
edit
:
true
,
max_question_num
:
0
}
return
{
...
...
@@ -185,13 +179,11 @@ export default {
computed
:
{
// 试题数量总数
questionTotalNum
()
{
return
this
.
getQuestionTotalNumber
ByProp
(
'question_num'
)
return
this
.
getQuestionTotalNumber
(
this
.
questionList
)
},
// 试题总分
questionTotalScore
()
{
return
this
.
questionList
.
reduce
((
result
,
item
)
=>
{
return
result
+
parseInt
(
item
.
question_score
)
*
parseInt
(
item
.
question_num
)
},
0
)
return
this
.
getQuestionTotalScoreNumber
(
this
.
questionList
)
},
// 试题情况
totalQuestionList
()
{
...
...
@@ -214,15 +206,15 @@ export default {
return
{
question_difficulty
:
item
.
value
,
question_difficulty_name
:
item
.
label
,
question_num
:
this
.
getQuestionTotalNumber
ByProp
(
'question_num'
,
currentDifficultyQuestionList
),
question_score
:
this
.
getQuestionTotal
NumberByProp
(
'question_score'
,
currentDifficultyQuestionList
)
question_num
:
this
.
getQuestionTotalNumber
(
currentDifficultyQuestionList
),
question_score
:
this
.
getQuestionTotal
ScoreNumber
(
currentDifficultyQuestionList
)
}
})
const
temp
=
{
question_type
:
item
.
question_type
,
question_type_name
:
this
.
questionTypeMap
.
find
(
type
=>
type
.
value
===
item
.
question_type
)?.
label
,
question_num
:
this
.
getQuestionTotalNumber
ByProp
(
'question_num'
,
currentTypeQuestionList
),
question_score
:
this
.
getQuestionTotal
NumberByProp
(
'question_score'
,
currentTypeQuestionList
),
question_num
:
this
.
getQuestionTotalNumber
(
currentTypeQuestionList
),
question_score
:
this
.
getQuestionTotal
ScoreNumber
(
currentTypeQuestionList
),
children
:
questionDifficultyList
.
filter
(
item
=>
item
.
question_num
)
// 难度列表
}
result
.
push
(
temp
)
...
...
@@ -232,9 +224,16 @@ export default {
}
},
methods
:
{
getQuestionTotalNumberByProp
(
prop
,
list
=
this
.
questionList
)
{
// 获取试题数量
getQuestionTotalNumber
(
list
=
this
.
questionList
)
{
return
list
.
reduce
((
result
,
item
)
=>
{
return
result
+
parseFloat
(
item
.
question_num
)
},
0
)
},
// 获取试题分数
getQuestionTotalScoreNumber
(
list
=
this
.
questionList
)
{
return
list
.
reduce
((
result
,
item
)
=>
{
return
result
+
parse
Int
(
item
[
prop
]
)
return
result
+
parse
Float
(
item
.
question_score
)
*
parseFloat
(
item
.
question_num
)
},
0
)
},
// 新增
...
...
src/modules/paper/components/BatchSetting.vue
浏览文件 @
01bcb2cb
...
...
@@ -12,7 +12,7 @@
<el-form-item
label=
"试题类型"
>
{{
data
.
question_type_name
}}
</el-form-item>
<el-form-item
label=
"数量"
>
{{
data
.
total
}}
</el-form-item>
<el-form-item
label=
"每道试题分值"
prop=
"score"
>
<el-input-number
v-model=
"form.score"
:min=
"0"
step-strictly
:controls=
"false"
/>
<el-input-number
v-model=
"form.score"
:min=
"0"
:controls=
"false"
/>
</el-form-item>
</el-form>
<template
#
footer
>
...
...
src/modules/paper/components/PaperQuestions.vue
浏览文件 @
01bcb2cb
...
...
@@ -16,10 +16,10 @@
</
template
>
</template>
<question-list
:list=
"
q
uestions"
:list=
"
currentQ
uestions"
:disableScore=
"data.paper_type === 2"
style=
"margin-top: 20px"
v-if=
"
q
uestions.length"
v-if=
"
currentQ
uestions.length"
>
<
template
v-slot:selection=
"item"
v-if=
"data.paper_type === 1"
>
<el-checkbox
@
change=
"handleSelectionChange(arguments[0], item)"
></el-checkbox>
...
...
@@ -30,10 +30,26 @@
</el-col>
<!-- 试题序号 -->
<el-col
:span=
"6"
class=
"is-sticky"
>
<question-num
:list=
"questions"
>
<
template
#
footer
v-if=
"data.paper_type === 1"
>
<question-num
:list=
"currentQuestions"
>
<
template
#
header
>
<div
class=
"score"
>
<el-tooltip>
<div
slot=
"content"
>
所有试题总分
</div>
<span
class=
"question-total-number"
>
{{
questionsTotalScore
}}
</span>
</el-tooltip>
<i>
/
</i>
<el-tooltip>
<div
slot=
"content"
>
试卷总分
</div>
<span
class=
"paper-total-score"
>
{{
data
.
paper_total_score
}}
</span>
</el-tooltip>
<em>
分
</em>
</div>
</
template
>
<
template
#
footer
>
<template
v-if=
"data.paper_type === 1"
>
<el-button
type=
"primary"
@
click=
"handleSubmit"
>
保存试卷
</el-button>
</
template
>
</template>
</question-num>
</el-col>
</el-row>
...
...
@@ -81,6 +97,23 @@ export default {
}
}
},
computed
:
{
// 有序试题列表
currentQuestions
()
{
// 试题类型map 1单选 2多选 6判断 3问答 5案例 8情景 7实操
// 试题展示顺序
const
arr
=
[
1
,
2
,
6
,
3
,
5
,
8
,
7
]
return
arr
.
reduce
((
result
,
item
)
=>
{
return
result
.
concat
(
this
.
questions
.
filter
(
question
=>
question
.
question_type
===
item
))
},
[])
},
// 已添加的试题总分
questionsTotalScore
()
{
return
this
.
questions
.
reduce
((
total
,
item
)
=>
{
return
total
+
parseFloat
(
item
.
score
)
},
0
)
}
},
methods
:
{
// 增加试题
showSelectQuestion
()
{
...
...
@@ -109,13 +142,28 @@ export default {
})
}
})
// 试题分数为0
for
(
const
item
of
rules
)
{
if
(
!
item
.
score
)
{
this
.
$message
.
error
(
'存在分值为0分的试题,无法保存'
)
const
scoreEl
=
document
.
querySelector
(
'#score_'
+
item
.
id
)
const
top
=
scoreEl
.
getBoundingClientRect
().
top
// 滚动到该区域
window
.
scrollTo
(
0
,
top
+
document
.
documentElement
.
scrollTop
-
86
)
// 光标聚焦
const
scoreInput
=
scoreEl
.
querySelector
(
'input'
)
scoreInput
.
focus
()
scoreInput
.
select
()
return
}
}
const
parmas
=
{
id
:
this
.
data
.
id
,
rules
}
updatePaperRules
(
parmas
).
then
(
res
=>
{
this
.
$message
.
success
(
'保存成功'
)
this
.
$emit
(
'update'
)
})
},
//
更新详情数据
//
选题组卷更新试题
handleUpdate
(
list
)
{
this
.
questions
=
list
}
...
...
@@ -129,4 +177,19 @@ export default {
top
:
84px
;
z-index
:
100
;
}
.score
{
display
:
flex
;
align-items
:
flex-end
;
justify-content
:
center
;
font-size
:
40px
;
line-height
:
1
;
margin-bottom
:
20px
;
color
:
#ccc
;
em
{
font-size
:
14px
;
}
}
.question-total-number
{
color
:
var
(
--
main-color
);
}
</
style
>
src/modules/paper/components/QuestionListItem.vue
浏览文件 @
01bcb2cb
<
template
>
<el-card
style=
"margin-bottom: 20px"
shadow=
"hover"
:id=
"`question_
index_$
{index
}`">
<el-card
style=
"margin-bottom: 20px"
shadow=
"hover"
:id=
"`question_
$
{data.id
}`">
<div
class=
"question-item"
>
<div
class=
"question-item-selection"
>
<slot
name=
"selection"
></slot>
...
...
@@ -9,11 +9,10 @@
<div
class=
"question-item-hd-top"
>
<div
class=
"question-index"
>
{{
index
}}
、
</div>
<div
class=
"question-type"
>
{{
questionTypeText
}}
</div>
<div
class=
"question-score"
>
<div
class=
"question-score"
:id=
"`score_$
{data.id}`"
>
<p>
分数:
</p>
<el-input-number
v-model=
"data.score"
step-strictly
:controls=
"false"
:min=
"0"
:disabled=
"disableScore || hasChildren"
...
...
src/modules/paper/components/QuestionNum.vue
浏览文件 @
01bcb2cb
<
template
>
<app-card>
<div
class=
"question-num"
>
<div
class=
"question-num-hd"
>
<slot
name=
"header"
></slot>
</div>
<div
class=
"question-num-bd"
>
<dl
v-for=
"item in questionGroups"
:key=
"item.question_type"
>
<dt>
{{
item
.
question_type_name
}}
</dt>
<dd>
<ul>
<li
:class=
"className"
v-for=
"(item, index) in list"
:key=
"index"
@
click=
"handleClick(index)"
>
<li
v-for=
"(item, index) in item.children"
:class=
"genClass(item)"
:key=
"index"
@
click=
"handleClick(item)"
>
{{
index
+
1
}}
</li>
</ul>
</dd>
</dl>
</div>
<div
class=
"question-num-ft"
>
<slot
name=
"footer"
></slot>
...
...
@@ -23,23 +36,37 @@ export default {
}
},
data
()
{
return
{
indexList
:
[],
currentIndex
:
0
// 当前点击题号
}
return
{}
},
computed
:
{
className
()
{
return
{}
questionGroups
()
{
const
map
=
{
1
:
'单选题'
,
2
:
'多选题'
,
3
:
'问答题'
,
5
:
'案例题'
,
6
:
'判断题'
,
7
:
'实操题'
,
8
:
'情景题'
}
return
this
.
list
.
reduce
((
result
,
item
)
=>
{
const
temp
=
{
question_type
:
item
.
question_type
,
question_type_name
:
map
[
item
.
question_type
],
children
:
[{
...
item
}]
}
const
index
=
result
.
findIndex
(
item2
=>
item2
.
question_type
===
item
.
question_type
)
if
(
index
!==
-
1
)
{
result
[
index
].
children
.
push
(
item
)
}
else
{
result
.
push
(
temp
)
}
return
result
},
[])
}
},
methods
:
{
handleClick
(
index
)
{
const
qItemEl
=
document
.
querySelector
(
`#question_index_
${
index
+
1
}
`
)
genClass
(
item
)
{
return
{
'is-error'
:
!
item
.
score
}
},
handleClick
(
item
)
{
const
qItemEl
=
document
.
querySelector
(
`#question_
${
item
.
id
}
`
)
const
top
=
qItemEl
.
getBoundingClientRect
().
top
window
.
scrollTo
(
0
,
top
+
document
.
documentElement
.
scrollTop
-
84
)
this
.
currentIndex
=
index
this
.
$emit
(
'indexClick'
,
`
${
index
+
1
}
`
)
}
}
}
...
...
@@ -47,6 +74,9 @@ export default {
<
style
lang=
"scss"
scoped
>
.question-num
{
display
:
flex
;
flex-direction
:
column
;
max-height
:
calc
(
100vh
-
168px
);
ul
{
display
:
flex
;
flex-wrap
:
wrap
;
...
...
@@ -61,18 +91,28 @@ export default {
color
:
#666
;
cursor
:
pointer
;
margin
:
10px
5px
;
&
:hover
{
background-color
:
#ccc
;
}
&
.is-error
{
border-color
:
var
(
--
main-color
);
}
.dotItem
{
background-color
:
rgb
(
243
,
190
,
190
);
}
}
}
.question-num-hd
{
margin-bottom
:
20px
;
border-bottom
:
1px
solid
#eee
;
}
.question-num-bd
{
flex
:
1
;
overflow-y
:
auto
;
max-height
:
calc
(
100vh
-
220px
);
}
.question-num-ft
{
margin-top
:
20px
;
position
:
sticky
;
bottom
:
0
;
background-color
:
#fff
;
padding
:
20px
0
;
text-align
:
center
;
}
</
style
>
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论