Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
C
center-qa
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
EzijingWeb
center-qa
Commits
e527f099
提交
e527f099
authored
2月 28, 2022
作者:
王鹏飞
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
updates
上级
15bafdeb
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
16 个修改的文件
包含
395 行增加
和
232 行删除
+395
-232
style.scss
src/assets/theme/style.scss
+4
-0
AppList.vue
src/components/base/AppList.vue
+1
-1
QuestionTypeCascader.vue
src/components/base/QuestionTypeCascader.vue
+9
-6
api.js
src/modules/paper/api.js
+8
-2
AddPaper.vue
src/modules/paper/components/AddPaper.vue
+86
-122
AutomaticPaper.vue
src/modules/paper/components/AutomaticPaper.vue
+0
-0
BatchSetting.vue
src/modules/paper/components/BatchSetting.vue
+29
-10
PaperQuestions.vue
src/modules/paper/components/PaperQuestions.vue
+49
-14
QuestionList.vue
src/modules/paper/components/QuestionList.vue
+2
-2
QuestionListItem.vue
src/modules/paper/components/QuestionListItem.vue
+64
-46
QuestionNum.vue
src/modules/paper/components/QuestionNum.vue
+1
-5
QuestionSelect.vue
src/modules/paper/components/QuestionSelect.vue
+119
-3
index.js
src/modules/paper/index.js
+2
-2
Detail.vue
src/modules/paper/views/Detail.vue
+0
-0
List.vue
src/modules/paper/views/List.vue
+8
-5
Update.vue
src/modules/paper/views/Update.vue
+13
-14
没有找到文件。
src/assets/theme/style.scss
浏览文件 @
e527f099
$--color-primary
:
#c01c40
;
$--color-primary
:
#c01c40
;
$--color-info
:
#3c4043
;
$--color-info
:
#3c4043
;
// border
// border
$--border-radius-small
:
8px
!
default
;
$--border-radius-small
:
8px
!
default
;
// checkbox
$--checkbox-border-radius
:
2px
!
default
;
// dialog
// dialog
$--message-close-size
:
20px
!
default
;
$--message-close-size
:
20px
!
default
;
...
...
src/components/base/AppList.vue
浏览文件 @
e527f099
...
@@ -143,7 +143,7 @@ export default {
...
@@ -143,7 +143,7 @@ export default {
return
return
}
}
// 参数设置
// 参数设置
let
params
=
this
.
params
let
params
=
{
...
this
.
params
}
// 翻页参数设置
// 翻页参数设置
if
(
this
.
hasPagination
)
{
if
(
this
.
hasPagination
)
{
params
.
page
=
this
.
page
.
currentPage
.
toString
()
params
.
page
=
this
.
page
.
currentPage
.
toString
()
...
...
src/components/base/QuestionTypeCascader.vue
浏览文件 @
e527f099
...
@@ -13,17 +13,20 @@ import { getQuestionCategory } from '@/api/base.js'
...
@@ -13,17 +13,20 @@ import { getQuestionCategory } from '@/api/base.js'
export
default
{
export
default
{
data
()
{
data
()
{
return
{
return
{
options
:
[],
options
:
[]
defaultProps
:
{
label
:
'category_name'
,
value
:
'id'
,
checkStrictly
:
true
}
}
}
},
},
computed
:
{
computed
:
{
activeProject
()
{
activeProject
()
{
return
this
.
$store
.
state
.
activeProject
||
{}
return
this
.
$store
.
state
.
activeProject
||
{}
},
defaultProps
()
{
return
{
label
:
'category_name'
,
value
:
'id'
,
checkStrictly
:
true
,
multiple
:
this
.
$attrs
.
multiple
||
false
}
}
}
},
},
beforeMount
()
{
beforeMount
()
{
...
...
src/modules/paper/api.js
浏览文件 @
e527f099
...
@@ -57,16 +57,22 @@ export function updatePaperRules(data) {
...
@@ -57,16 +57,22 @@ export function updatePaperRules(data) {
return
httpRequest
.
post
(
`/api/qbs/admin/v1/question-paper/rules/
${
data
.
id
}
`
,
data
)
return
httpRequest
.
post
(
`/api/qbs/admin/v1/question-paper/rules/
${
data
.
id
}
`
,
data
)
}
}
/**
* 搜索试题数量--自动组卷
*/
export
function
getQuestionCount
(
params
)
{
return
httpRequest
.
get
(
'/api/qbs/admin/v1/question/search/count'
,
{
params
})
}
/**
/**
* 获取试卷分类
* 获取试卷分类
*/
*/
export
function
getPaperCategory
(
params
)
{
export
function
getPaperCategory
(
params
)
{
return
httpRequest
.
get
(
`/api/qbs/admin/v1/question-category/tree/
${
params
.
project_prefix
}
`
,
{
params
})
return
httpRequest
.
get
(
`/api/qbs/admin/v1/question-category/tree/
${
params
.
project_prefix
}
`
,
{
params
})
}
}
/**
/**
* 获取知识点/标签
* 获取知识点/标签
*/
*/
export
function
getKnowledge
(
params
)
{
export
function
getKnowledge
(
params
)
{
return
httpRequest
.
get
(
'/admin/v1/knowledge-point/search/x1'
,
{
params
})
return
httpRequest
.
get
(
'/a
pi/a
dmin/v1/knowledge-point/search/x1'
,
{
params
})
}
}
src/modules/paper/components/AddPaper.vue
浏览文件 @
e527f099
...
@@ -3,8 +3,10 @@
...
@@ -3,8 +3,10 @@
<div
style=
"margin: 0 20px"
>
<div
style=
"margin: 0 20px"
>
<!-- 选题组卷添加试卷第一步 -->
<!-- 选题组卷添加试卷第一步 -->
<div
v-show=
"step === 1"
>
<div
v-show=
"step === 1"
>
<app-list
v-bind=
"tableOptions"
ref=
"list"
@
selection-change=
"handleSelectionChange"
></app-list>
<question-select
@
selection-change=
"handleSelectionChange"
></question-select>
<el-button
type=
"primary"
class=
"nextStep"
@
click=
"nextStep"
>
下一步
</el-button>
<div
class=
"buttons"
>
<el-button
type=
"primary"
@
click=
"nextStep"
>
下一步
</el-button>
</div>
</div>
</div>
<!-- 选题组卷添加试卷第二步 -->
<!-- 选题组卷添加试卷第二步 -->
<div
v-show=
"step === 2"
>
<div
v-show=
"step === 2"
>
...
@@ -19,136 +21,65 @@
...
@@ -19,136 +21,65 @@
<el-form-item
label=
"此次试卷总分:"
>
{{
data
.
paper_total_score
}}
</el-form-item>
<el-form-item
label=
"此次试卷总分:"
>
{{
data
.
paper_total_score
}}
</el-form-item>
<el-form-item
label=
"已设置试题总分:"
>
{{
addedQuestionsScore
}}
</el-form-item>
<el-form-item
label=
"已设置试题总分:"
>
{{
addedQuestionsScore
}}
</el-form-item>
<el-divider></el-divider>
<el-divider></el-divider>
<el-form-item
<template
v-if=
"setMethod === 1"
>
:label=
"item.question_type_name + ':'"
<el-form-item
v-for=
"(item, index) in questionTypeGroups"
:label=
"item.question_type_name + ':'"
:key=
"index"
:key=
"index"
>
v-for=
"(item, index) in questionTypeGroups"
<span>
数量:
{{
item
.
total
}}
</span>
<span
style=
"margin-left: 20px"
>
分值:
<el-input
v-model=
"item.score"
style=
"width: 100px"
></el-input>
{{
item
.
score
}}
</span
>
>
<!--
<template
v-if=
"canBatchSetting(item.question_type)"
>
<ul>
<el-button
type=
"primary"
class=
"settingScore"
@
click=
"batchSetting"
>
批量设置分数
</el-button>
<li>
数量:
{{
item
.
total
}}
</li>
</
template
>
<li>
分值:
{{
item
.
score
}}
</li>
<
template
v-else
>
<li>
<span
class=
"settingScore"
>
此题型只能在试卷详情页面逐一设置
</span>
<template
v-if=
"canBatchSetting(item.question_type)"
>
</
template
>
-->
<el-button
type=
"primary"
class=
"settingScore"
@
click=
"showBatchSetting(item)"
</el-form-item>
>
批量设置分数
</el-button
<el-button
type=
"primary"
@
click=
"prevStep"
>
上一步
</el-button>
>
<el-button
type=
"primary"
style=
"margin-left: 20px"
@
click=
"handleSubmit"
>
保存
</el-button>
</
template
>
<
template
v-else
>
<span
class=
"settingScore"
>
此题型只能在试卷详情页面逐一设置
</span>
</
template
>
</li>
</ul>
</el-form-item>
</template>
</el-form>
</el-form>
<div
class=
"buttons"
>
<el-button
type=
"primary"
@
click=
"prevStep"
>
上一步
</el-button>
<el-button
type=
"primary"
style=
"margin-left: 20px"
@
click=
"handleSave"
>
保存
</el-button>
</div>
</div>
</div>
<BatchSetting
:visible
.
sync=
"visible"
/>
<BatchSetting
:visible
.
sync=
"visible"
:data=
"questionTypeGroups[batchSettingQuestionType]"
@
update=
"handleUpdateScore"
v-if=
"visible"
/>
</div>
</div>
</el-drawer>
</el-drawer>
</template>
</template>
<
script
>
<
script
>
import
QuestionSelect
from
'./QuestionSelect.vue'
import
BatchSetting
from
'./BatchSetting.vue'
import
BatchSetting
from
'./BatchSetting.vue'
import
{
getQuestionList
,
batchGetQuestionList
,
updatePaperRules
}
from
'../api.js'
import
{
batchGetQuestionList
,
updatePaperRules
}
from
'../api.js'
export
default
{
export
default
{
props
:
{
props
:
{
data
:
{
type
:
Object
,
default
:
()
=>
({})
}
data
:
{
type
:
Object
,
default
:
()
=>
({})
}
},
},
components
:
{
BatchSetting
},
components
:
{
QuestionSelect
,
BatchSetting
},
data
()
{
data
()
{
return
{
return
{
visible
:
false
,
multipleSelection
:
[],
// 选择的试题,不包含子题
multipleSelection
:
[],
// 选择项
setMethod
:
1
,
// 设置方式
setMethod
:
1
,
// 设置方式
step
:
1
,
step
:
1
,
questions
:
[],
// 试题列表
questions
:
[],
// 选择的完整试题列表
questionTypeGroups
:
{}
// 试题类型组
questionTypeGroups
:
{},
// 试题类型组
visible
:
false
,
batchSettingQuestionType
:
null
// 批量设置试题类型
}
}
},
},
computed
:
{
computed
:
{
tableOptions
()
{
return
{
remote
:
{
httpRequest
:
getQuestionList
,
params
:
{
question_type
:
''
,
question_title
:
''
,
question_difficulty
:
''
,
question_category
:
''
}
},
filters
:
[
{
type
:
'select'
,
prop
:
'question_type'
,
placeholder
:
'请选择题目类型'
,
options
:
[
{
label
:
'单选题'
,
value
:
'1'
},
{
label
:
'多选题'
,
value
:
'2'
},
{
label
:
'问答题'
,
value
:
'3'
},
{
label
:
'案例题'
,
value
:
'5'
},
{
label
:
'判断题'
,
value
:
'6'
},
{
label
:
'实操题'
,
value
:
'7'
},
{
label
:
'情景题'
,
value
:
'8'
}
],
label
:
'题目类型'
},
{
type
:
'select'
,
prop
:
'question_difficulty'
,
placeholder
:
'请选择题目难度等级'
,
options
:
[
{
label
:
'易'
,
value
:
'1'
},
{
label
:
'中'
,
value
:
'2'
},
{
label
:
'难'
,
value
:
'3'
}
],
label
:
'难度等级'
},
{
type
:
'input'
,
prop
:
'question_category'
,
placeholder
:
'请选择试题分类'
,
options
:
this
.
staffList
,
label
:
'试题分类'
},
{
type
:
'input'
,
prop
:
'question_title'
,
label
:
'题目标题'
,
placeholder
:
'请输入题目标题'
},
{
type
:
'input'
,
prop
:
'name4'
,
label
:
'题干内容'
,
placeholder
:
'请输入题干内容'
},
{
type
:
'input'
,
prop
:
'name5'
,
label
:
'知识点'
,
placeholder
:
'请输入知识点'
}
],
columns
:
[
{
type
:
'selection'
},
{
type
:
'index'
,
label
:
'序号'
},
{
label
:
'题目类型'
,
prop
:
'question_type'
,
computed
:
({
row
})
=>
{
const
map
=
{
1
:
'单选题'
,
2
:
'多选题'
,
3
:
'问答题'
,
5
:
'案例题'
,
6
:
'判断题'
,
7
:
'实操题'
,
8
:
'情景题'
}
return
map
[
row
.
question_type
]
||
row
.
question_type
}
},
{
label
:
'试卷分类'
,
prop
:
'question_category.category_name'
},
{
label
:
'题目标题'
,
prop
:
'question_title'
},
{
label
:
'知识点'
,
prop
:
'knowledge_point.title'
},
{
label
:
'难度等级'
,
prop
:
'question_difficulty'
,
computed
:
({
row
})
=>
{
const
map
=
{
1
:
'易'
,
2
:
'中'
,
3
:
'难'
}
return
map
[
row
.
question_difficulty
]
||
row
.
question_difficulty
}
},
{
label
:
'更新人'
,
prop
:
'operator.realname'
}
]
}
},
// 已添加的试题
// 已添加的试题
addedQuestions
()
{
addedQuestions
()
{
return
this
.
data
.
questions
||
[]
return
this
.
data
.
questions
||
[]
...
@@ -161,8 +92,8 @@ export default {
...
@@ -161,8 +92,8 @@ export default {
}
}
},
},
methods
:
{
methods
:
{
handleSelectionChange
(
val
)
{
handleSelectionChange
(
val
ue
)
{
this
.
multipleSelection
=
val
this
.
multipleSelection
=
val
ue
},
},
// 下一步
// 下一步
nextStep
()
{
nextStep
()
{
...
@@ -193,7 +124,7 @@ export default {
...
@@ -193,7 +124,7 @@ export default {
total
:
1
,
total
:
1
,
question_type
:
item
.
question_type
,
question_type
:
item
.
question_type
,
question_type_name
:
map
[
item
.
question_type
],
question_type_name
:
map
[
item
.
question_type
],
score
:
''
,
score
:
'
0
'
,
questions
:
[
item
]
questions
:
[
item
]
}
}
}
}
...
@@ -205,18 +136,44 @@ export default {
...
@@ -205,18 +136,44 @@ export default {
canBatchSetting
(
value
)
{
canBatchSetting
(
value
)
{
return
[
1
,
2
,
6
].
includes
(
value
)
return
[
1
,
2
,
6
].
includes
(
value
)
},
},
batchSetting
()
{
// 批量设置分数
showBatchSetting
(
data
)
{
this
.
visible
=
true
this
.
visible
=
true
this
.
batchSettingQuestionType
=
data
.
question_type
},
handleUpdateScore
(
data
)
{
const
{
question_type
:
questionType
,
score
}
=
data
this
.
questionTypeGroups
[
questionType
].
score
=
score
},
},
// 保存
// 保存
handleSave
()
{
// 批量设置分数
if
(
this
.
setMethod
===
1
)
{
this
.
questions
=
this
.
questions
.
map
(
item
=>
{
return
{
...
item
,
score
:
this
.
questionTypeGroups
[
item
.
question_type
].
score
}
})
}
// 合并已添加和选择的试题,新的替换旧的
const
questionList
=
this
.
addedQuestions
.
reduce
((
result
,
item
)
=>
{
if
(
!
result
.
find
(
item2
=>
item2
.
id
===
item
.
id
))
{
result
.
unshift
(
item
)
}
return
result
},
this
.
questions
)
// 更新详情页的试题
this
.
$emit
(
'update'
,
questionList
)
// 关闭弹框
this
.
$emit
(
'update:visible'
,
false
)
},
// 保存,更新试卷规则
handleSubmit
()
{
handleSubmit
()
{
const
rules
=
[]
const
rules
=
[]
Object
.
values
(
this
.
questionTypeGroups
).
forEach
(
item
=>
{
Object
.
values
(
this
.
questionTypeGroups
).
forEach
(
item
=>
{
item
.
questions
.
forEach
(
question
=>
{
item
.
questions
.
forEach
(
question
=>
{
rules
.
push
({
id
:
question
.
id
,
score
:
item
.
score
||
0
})
rules
.
push
({
id
:
question
.
id
,
score
:
item
.
score
})
if
(
item
.
children
&&
item
.
children
.
length
)
{
if
(
item
.
children
&&
item
.
children
.
length
)
{
item
.
children
.
forEach
(
question
=>
{
item
.
children
.
forEach
(
question
=>
{
rules
.
push
({
id
:
question
.
id
,
score
:
item
.
score
||
0
})
rules
.
push
({
id
:
question
.
id
,
score
:
item
.
score
})
})
})
}
}
})
})
...
@@ -232,13 +189,20 @@ export default {
...
@@ -232,13 +189,20 @@ export default {
}
}
</
script
>
</
script
>
<
style
lang=
"scss"
scoped
>
<
style
lang=
"scss"
scoped
>
.
nextStep
{
.
buttons
{
position
:
absolute
;
position
:
absolute
;
left
:
50%
;
left
:
50%
;
bottom
:
1
0px
;
bottom
:
3
0px
;
transform
:
translateX
(
-50%
);
transform
:
translateX
(
-50%
);
text-align
:
center
;
}
}
.settingScore
{
ul
{
margin-left
:
120px
;
display
:
flex
;
li
{
margin-right
:
20px
;
min-width
:
140px
;
line-height
:
32px
;
color
:
#606266
;
}
}
}
</
style
>
</
style
>
src/modules/paper/components/AutomaticPaper.vue
浏览文件 @
e527f099
差异被折叠。
点击展开。
src/modules/paper/components/BatchSetting.vue
浏览文件 @
e527f099
<
template
>
<
template
>
<el-dialog
title=
"批量设置分数"
v-bind=
"$attrs"
v-on=
"$listeners"
append-to-body
width=
"400px"
>
<el-dialog
<el-form>
title=
"批量设置分数"
<el-form-item>
单选题
</el-form-item>
v-bind=
"$attrs"
<el-form-item>
数量:8
</el-form-item>
v-on=
"$listeners"
<el-form-item
label=
"每道试题分值"
>
<el-input></el-input></el-form-item>
append-to-body
:close-on-click-modal=
"false"
width=
"400px"
>
<el-form
:model=
"form"
:rules=
"rules"
ref=
"form"
>
<el-form-item
label=
"单选题"
></el-form-item>
<el-form-item
label=
"数量"
>
8
</el-form-item>
<el-form-item
label=
"每道试题分值"
prop=
"score"
><el-input
v-model=
"form.score"
></el-input></el-form-item>
<el-form-item>
<el-form-item>
<el-button
type=
"primary"
@
click=
"
saveSetting
"
>
保存
</el-button>
<el-button
type=
"primary"
@
click=
"
handleSubmit
"
>
保存
</el-button>
</el-form-item>
</el-form-item>
</el-form>
</el-form>
</el-dialog>
</el-dialog>
...
@@ -13,12 +20,24 @@
...
@@ -13,12 +20,24 @@
<
script
>
<
script
>
export
default
{
export
default
{
props
:
{
data
:
{
type
:
Object
,
default
:
()
=>
({})
}
},
data
()
{
return
{
form
:
{
score
:
'0'
},
rules
:
{
score
:
[{
required
:
true
,
message
:
'请输入试题分值'
,
trigger
:
'blur'
}]
}
}
},
methods
:
{
methods
:
{
saveSetting
()
{
handleSubmit
()
{
this
.
$emit
(
'update:visible'
,
false
)
this
.
$refs
.
form
.
validate
().
then
(()
=>
{
this
.
$emit
(
'update'
,
Object
.
assign
({},
this
.
data
,
this
.
form
))
this
.
$emit
(
'update:visible'
,
false
)
})
}
}
}
}
}
}
</
script
>
</
script
>
<
style
></
style
>
src/modules/paper/components/PaperQuestions.vue
浏览文件 @
e527f099
...
@@ -5,20 +5,27 @@
...
@@ -5,20 +5,27 @@
<el-col
:span=
"18"
>
<el-col
:span=
"18"
>
<app-card
title=
"试题列表"
>
<app-card
title=
"试题列表"
>
<template
#
header-aside
>
<template
#
header-aside
>
<el-button
type=
"primary"
@
click=
"handleAdd"
>
添加试题
</el-button>
<template
v-if=
"data.paper_type === 1"
>
<el-button
type=
"primary"
@
click=
"handleRemove"
>
删除选中试题
</el-button>
<el-button
type=
"primary"
@
click=
"showSelectQuestion"
>
添加试题
</el-button>
<el-button
type=
"primary"
:disabled=
"!multipleSelection.length"
@
click=
"handleRemove"
>
删除选中试题
</el-button
>
</
template
>
<
template
v-if=
"data.paper_type === 2"
>
<el-button
type=
"primary"
@
click=
"showSelectQuestion"
>
自动组卷
</el-button>
</
template
>
</template>
</template>
<question-list
:list=
"questions"
>
<question-list
:list=
"questions"
:disableScore=
"data.paper_type === 2"
style=
"margin-top: 20px"
>
<
template
v-slot:selection=
"item"
>
<
template
v-slot:selection=
"item"
v-if=
"data.paper_type === 1"
>
<el-checkbox
@
change=
"handleSelectionChange(arguments[0], item)"
></el-checkbox>
<el-checkbox
@
change=
"handleSelectionChange(arguments[0], item)"
></el-checkbox>
</
template
>
</
template
>
</question-list>
</question-list>
</app-card>
</app-card>
</el-col>
</el-col>
<!-- 试题序号 -->
<!-- 试题序号 -->
<el-col
:span=
"6"
>
<el-col
:span=
"6"
ref=
"questionNumWrapper"
>
<question-num
:list=
"questions"
>
<question-num
:list=
"questions"
ref=
"questionNum"
:style=
"`position:relative;top:${top}px`"
>
<
template
#
footer
>
<
template
#
footer
v-if=
"data.paper_type === 1"
>
<el-button
type=
"primary"
@
click=
"handleSubmit"
>
保存试卷
</el-button>
<el-button
type=
"primary"
@
click=
"handleSubmit"
>
保存试卷
</el-button>
</
template
>
</
template
>
</question-num>
</question-num>
...
@@ -26,11 +33,11 @@
...
@@ -26,11 +33,11 @@
</el-row>
</el-row>
<!-- 选题组卷 -->
<!-- 选题组卷 -->
<
template
v-if=
"data.paper_type === 1"
>
<
template
v-if=
"data.paper_type === 1"
>
<addPaper
:visible
.
sync=
"visible"
:data=
"data"
@
update=
"hand
el
Update"
v-if=
"visible"
/>
<addPaper
:visible
.
sync=
"visible"
:data=
"data"
@
update=
"hand
le
Update"
v-if=
"visible"
/>
</
template
>
</
template
>
<!-- 自动组卷 -->
<!-- 自动组卷 -->
<
template
v-if=
"data.paper_type === 2"
>
<
template
v-if=
"data.paper_type === 2"
>
<AutomaticPaper
:visible
.
sync=
"visible"
:data=
"data"
@
update=
"
handelUpdate
"
v-if=
"visible"
/>
<AutomaticPaper
:visible
.
sync=
"visible"
:data=
"data"
@
update=
"
$emit('update')
"
v-if=
"visible"
/>
</
template
>
</
template
>
</div>
</div>
</template>
</template>
...
@@ -50,7 +57,8 @@ export default {
...
@@ -50,7 +57,8 @@ export default {
return
{
return
{
visible
:
false
,
visible
:
false
,
questions
:
[],
questions
:
[],
multipleSelection
:
[]
// 选择项
multipleSelection
:
[],
// 选择项
top
:
0
}
}
},
},
watch
:
{
watch
:
{
...
@@ -59,12 +67,29 @@ export default {
...
@@ -59,12 +67,29 @@ export default {
handler
(
data
)
{
handler
(
data
)
{
this
.
questions
=
data
.
questions
||
[]
this
.
questions
=
data
.
questions
||
[]
}
}
},
'$route.query.select'
:
{
immediate
:
true
,
handler
(
value
)
{
value
&&
this
.
showSelectQuestion
()
}
}
}
},
},
computed
:
{},
mounted
()
{
const
questionNumWrapper
=
this
.
$refs
.
questionNumWrapper
.
$el
const
parentTop
=
questionNumWrapper
.
getBoundingClientRect
().
top
document
.
addEventListener
(
'scroll'
,
()
=>
{
const
scrollTop
=
document
.
documentElement
.
scrollTop
||
document
.
body
.
scrollTop
if
(
scrollTop
>
parentTop
)
{
this
.
top
=
scrollTop
-
parentTop
+
84
}
else
{
this
.
top
=
0
}
})
},
methods
:
{
methods
:
{
// 增加试题
// 增加试题
handleAdd
()
{
showSelectQuestion
()
{
this
.
visible
=
true
this
.
visible
=
true
},
},
handleSelectionChange
(
checked
,
data
)
{
handleSelectionChange
(
checked
,
data
)
{
...
@@ -95,9 +120,19 @@ export default {
...
@@ -95,9 +120,19 @@ export default {
})
})
},
},
// 更新详情数据
// 更新详情数据
handelUpdate
()
{
handleUpdate
(
list
)
{
this
.
$emit
(
'update'
)
this
.
questions
=
list
// this.$emit('update')
}
}
}
}
}
}
</
script
>
</
script
>
<
style
lang=
"scss"
scoped
>
.fixed
{
position
:
relative
;
top
:
64px
;
right
:
0
;
z-index
:
100
;
}
</
style
>
src/modules/paper/components/QuestionList.vue
浏览文件 @
e527f099
<
template
>
<
template
>
<div
class=
"question-list"
>
<div
class=
"question-list"
>
<template
v-for=
"(item, index) in list"
>
<template
v-for=
"(item, index) in list"
>
<question-list-item
:data=
"item"
:index=
"index + 1"
:key=
"item.id"
v-on=
"$listeners"
>
<question-list-item
:data=
"item"
:index=
"index + 1"
:key=
"item.id"
v-
bind=
"$attrs"
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-on=
"$listeners"
>
<question-list
:list=
"item.children"
:key=
"item.id"
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
>
...
...
src/modules/paper/components/QuestionListItem.vue
浏览文件 @
e527f099
<
template
>
<
template
>
<el-card
style=
"margin-bottom: 20px"
shadow=
"hover"
>
<el-card
style=
"margin-bottom: 20px"
shadow=
"hover"
>
<div
class=
"question-item"
>
<div
class=
"question-item"
>
<div
class=
"question-item-hd"
>
<div
class=
"question-item-selection"
>
<div
class=
"question-item-hd-top"
>
<slot
name=
"selection"
></slot>
<slot
name=
"selection"
></slot>
</div>
<div
class=
"question-index"
>
{{
index
}}
、
</div>
<div
class=
"question-item-main"
>
<div
class=
"question-type"
>
{{
questionTypeText
}}
</div>
<div
class=
"question-item-hd"
>
<div
class=
"question-score"
>
<div
class=
"question-item-hd-top"
>
<p>
分数:
</p>
<div
class=
"question-index"
>
{{
index
}}
、
</div>
<el-input
v-model=
"data.score"
style=
"width: 100px"
></el-input>
<div
class=
"question-type"
>
{{
questionTypeText
}}
</div>
<div
class=
"question-score"
>
<p>
分数:
</p>
<el-input
v-model=
"data.score"
:disabled=
"disableScore"
style=
"width: 100px"
></el-input>
</div>
</div>
</div>
<!-- 题干 -->
<div
class=
"question-title"
v-html=
"data.question_content"
></div>
</div>
</div>
<!-- 题干 -->
<slot>
<div
class=
"question-title"
v-html=
"data.question_content"
></div>
<div
class=
"question-item-bd"
>
<!-- 单选题 -->
<template
v-if=
"questionType === 1"
>
<el-radio-group
:disabled=
"disabled"
:value=
"data.question_answer"
>
<div
class=
"question-item-option"
v-for=
"item in data.question_options"
:key=
"item.id"
>
<el-radio
:label=
"item.id"
>
{{
item
.
option
}}
</el-radio>
</div>
</el-radio-group>
</
template
>
<!-- 多选题 -->
<
template
v-if=
"questionType === 2"
>
<el-checkbox-group
:disabled=
"disabled"
:value=
"data.question_answer"
>
<div
class=
"question-item-option"
v-for=
"item in data.question_options"
:key=
"item.id"
>
<el-checkbox
:label=
"item.id"
>
{{
item
.
option
}}
</el-checkbox>
</div>
</el-checkbox-group>
</
template
>
<!-- 问答题 -->
<
template
v-if=
"questionType === 3"
>
<v-editor></v-editor>
</
template
>
<!-- 判断题 -->
<
template
v-if=
"questionType === 6"
>
<el-radio-group
:disabled=
"disabled"
:value=
"data.question_answer"
>
<div
class=
"question-item-option"
v-for=
"item in data.question_options"
:key=
"item.id"
>
<el-radio
:label=
"item.id"
>
{{
item
.
option
}}
</el-radio>
</div>
</el-radio-group>
</
template
>
</div>
</slot>
<div
class=
"question-item-ft"
></div>
</div>
</div>
<slot>
<div
class=
"question-item-bd"
>
<!-- 单选题 -->
<template
v-if=
"questionType === 1"
>
<el-radio-group
:disabled=
"disabled"
:value=
"data.question_answer[0]"
>
<div
class=
"question-item-option"
v-for=
"item in data.question_options"
:key=
"item.id"
>
<el-radio
:label=
"item.id"
>
{{
item
.
option
}}
</el-radio>
</div>
</el-radio-group>
</
template
>
<!-- 多选题 -->
<
template
v-if=
"questionType === 2"
>
<el-checkbox-group
:disabled=
"disabled"
:value=
"data.question_answer"
>
<div
class=
"question-item-option"
v-for=
"item in data.question_options"
:key=
"item.id"
>
<el-checkbox
:label=
"item.id"
>
{{
item
.
option
}}
</el-checkbox>
</div>
</el-checkbox-group>
</
template
>
<!-- 问答题 -->
<
template
v-if=
"questionType === 3"
>
<v-editor></v-editor>
</
template
>
<!-- 判断题 -->
<
template
v-if=
"questionType === 6"
>
<el-radio-group
:disabled=
"disabled"
:value=
"data.question_answer"
>
<div
class=
"question-item-option"
v-for=
"item in data.question_options"
:key=
"item.id"
>
<el-radio
:label=
"item.id"
>
{{
item
.
option
}}
</el-radio>
</div>
</el-radio-group>
</
template
>
</div>
</slot>
<div
class=
"question-item-ft"
></div>
</div>
</div>
</el-card>
</el-card>
</template>
</template>
...
@@ -57,7 +61,8 @@ export default {
...
@@ -57,7 +61,8 @@ export default {
props
:
{
props
:
{
index
:
{
type
:
Number
,
default
:
1
},
index
:
{
type
:
Number
,
default
:
1
},
disabled
:
{
type
:
Boolean
,
default
:
false
},
disabled
:
{
type
:
Boolean
,
default
:
false
},
data
:
{
type
:
Object
,
default
:
()
=>
({})
}
data
:
{
type
:
Object
,
default
:
()
=>
({})
},
disableScore
:
{
type
:
Boolean
,
default
:
false
}
},
},
components
:
{
VEditor
},
components
:
{
VEditor
},
data
()
{
data
()
{
...
@@ -69,7 +74,7 @@ export default {
...
@@ -69,7 +74,7 @@ export default {
data
:
{
data
:
{
immediate
:
true
,
immediate
:
true
,
handler
(
data
)
{
handler
(
data
)
{
this
.
question
=
this
.
genQuestion
(
data
)
//
this.question = this.genQuestion(data)
}
}
}
}
},
},
...
@@ -100,10 +105,23 @@ export default {
...
@@ -100,10 +105,23 @@ export default {
</
script
>
</
script
>
<
style
lang=
"scss"
scoped
>
<
style
lang=
"scss"
scoped
>
.question-item
{
display
:
flex
;
}
.question-item-selection
{
margin-right
:
10px
;
padding-top
:
3px
;
}
.question-item-selection
:empty
{
margin
:
0
;
}
.question-item-main
{
flex
:
1
;
}
.question-item-hd-top
{
.question-item-hd-top
{
display
:
flex
;
display
:
flex
;
align-items
:
center
;
.question-index
{
.question-index
{
margin-left
:
10px
;
color
:
#c01c40
;
color
:
#c01c40
;
}
}
.question-type
{
.question-type
{
...
...
src/modules/paper/components/QuestionNum.vue
浏览文件 @
e527f099
<
template
>
<
template
>
<app-card
class=
"fixed"
>
<app-card>
<div
class=
"question-num"
>
<div
class=
"question-num"
>
<div
class=
"question-num-bd"
>
<div
class=
"question-num-bd"
>
<ul>
<ul>
...
@@ -43,10 +43,6 @@ export default {
...
@@ -43,10 +43,6 @@ export default {
</
script
>
</
script
>
<
style
lang=
"scss"
scoped
>
<
style
lang=
"scss"
scoped
>
.fixed
{
position
:
sticky
;
top
:
0
;
}
.question-num
{
.question-num
{
ul
{
ul
{
display
:
flex
;
display
:
flex
;
...
...
src/modules/paper/components/QuestionSelect.vue
浏览文件 @
e527f099
<
template
>
<
template
>
<app-list
v-bind=
"tableOptions"
ref=
"list"
style=
"padding-left: 30px"
>
</app-list>
<app-list
v-bind=
"tableOptions"
ref=
"list"
v-on=
"$listeners"
>
<template
v-slot:filter-permission=
"
{ params }">
<el-radio-group
v-model=
"params.permission"
@
change=
"refetchList"
>
<el-radio
label=
"1"
>
我的题库
</el-radio>
<el-radio
label=
"2"
>
公共题库
</el-radio>
</el-radio-group>
</
template
>
<
template
v-slot:filter-category=
"{ params }"
>
<question-type-cascader
v-model=
"params.question_category"
@
change=
"refetchList"
></question-type-cascader>
</
template
>
</app-list>
</template>
</template>
<
script
>
<
script
>
import
{
getQuestionList
}
from
'../api.js'
import
QuestionTypeCascader
from
'@/components/base/QuestionTypeCascader.vue'
export
default
{
export
default
{
props
:
{
data
:
{
type
:
Object
,
default
:
()
=>
({})
}
},
props
:
{
data
:
{
type
:
Object
,
default
:
()
=>
({})
}
},
components
:
{
QuestionTypeCascader
},
data
()
{
data
()
{
return
{}
return
{}
},
computed
:
{
tableOptions
()
{
return
{
limit
:
10
,
remote
:
{
httpRequest
:
getQuestionList
,
params
:
{
permission
:
'1'
,
question_type
:
''
,
question_title
:
''
,
question_difficulty
:
''
,
question_category
:
''
}
},
filters
:
[
{
prop
:
'permission'
,
label
:
'题库范围'
,
slots
:
'filter-permission'
},
{
type
:
'select'
,
prop
:
'question_type'
,
placeholder
:
'请选择题目类型'
,
options
:
[
{
label
:
'单选题'
,
value
:
'1'
},
{
label
:
'多选题'
,
value
:
'2'
},
{
label
:
'问答题'
,
value
:
'3'
},
{
label
:
'案例题'
,
value
:
'5'
},
{
label
:
'判断题'
,
value
:
'6'
},
{
label
:
'实操题'
,
value
:
'7'
},
{
label
:
'情景题'
,
value
:
'8'
}
],
label
:
'题目类型'
},
{
type
:
'select'
,
prop
:
'question_difficulty'
,
placeholder
:
'请选择题目难度等级'
,
options
:
[
{
label
:
'易'
,
value
:
'1'
},
{
label
:
'中'
,
value
:
'2'
},
{
label
:
'难'
,
value
:
'3'
}
],
label
:
'难度等级'
},
{
prop
:
'question_category'
,
label
:
'试题分类'
,
slots
:
'filter-category'
},
{
type
:
'input'
,
prop
:
'question_title'
,
label
:
'题目标题'
,
placeholder
:
'请输入题目标题'
},
{
type
:
'input'
,
prop
:
'name4'
,
label
:
'题干内容'
,
placeholder
:
'请输入题干内容'
},
{
type
:
'input'
,
prop
:
'name5'
,
label
:
'知识点'
,
placeholder
:
'请输入知识点'
}
],
columns
:
[
{
type
:
'selection'
},
{
type
:
'index'
,
label
:
'序号'
},
{
label
:
'题目类型'
,
prop
:
'question_type'
,
computed
:
({
row
})
=>
{
const
map
=
{
1
:
'单选题'
,
2
:
'多选题'
,
3
:
'问答题'
,
5
:
'案例题'
,
6
:
'判断题'
,
7
:
'实操题'
,
8
:
'情景题'
}
return
map
[
row
.
question_type
]
||
row
.
question_type
}
},
{
label
:
'试卷分类'
,
prop
:
'question_category.category_name'
},
{
label
:
'题目标题'
,
prop
:
'question_title'
},
{
label
:
'知识点'
,
prop
:
'knowledge_point.title'
},
{
label
:
'难度等级'
,
prop
:
'question_difficulty'
,
computed
:
({
row
})
=>
{
const
map
=
{
1
:
'易'
,
2
:
'中'
,
3
:
'难'
}
return
map
[
row
.
question_difficulty
]
||
row
.
question_difficulty
}
},
{
label
:
'更新人'
,
prop
:
'operator.realname'
}
]
}
}
},
methods
:
{
// 刷新列表
refetchList
()
{
// 刷新列表
this
.
$refs
.
list
.
refetch
()
}
}
}
}
}
</
script
>
</
script
>
<
style
></
style
>
src/modules/paper/index.js
浏览文件 @
e527f099
...
@@ -15,13 +15,13 @@ const routes = [
...
@@ -15,13 +15,13 @@ const routes = [
{
{
name
:
'createPaper'
,
name
:
'createPaper'
,
path
:
'create'
,
path
:
'create'
,
component
:
()
=>
import
(
'./views/
NewPaper
.vue'
),
component
:
()
=>
import
(
'./views/
Update
.vue'
),
meta
:
{
title
:
'新建试卷'
}
meta
:
{
title
:
'新建试卷'
}
},
},
{
{
name
:
'editPaper'
,
name
:
'editPaper'
,
path
:
'update/:id'
,
path
:
'update/:id'
,
component
:
()
=>
import
(
'./views/
NewPaper
.vue'
),
component
:
()
=>
import
(
'./views/
Update
.vue'
),
meta
:
{
title
:
'编辑试卷'
},
meta
:
{
title
:
'编辑试卷'
},
props
:
true
props
:
true
},
},
...
...
src/modules/paper/views/Detail.vue
浏览文件 @
e527f099
差异被折叠。
点击展开。
src/modules/paper/views/List.vue
浏览文件 @
e527f099
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
>
>
</div>
</div>
<template
v-slot:filter-category=
"
{ params }">
<template
v-slot:filter-category=
"
{ params }">
<question-type-cascader
v-model=
"params.paper_category"
></question-type-cascader>
<question-type-cascader
v-model=
"params.paper_category"
@
change=
"refetchList"
></question-type-cascader>
</
template
>
</
template
>
<
template
v-slot:table-x=
"{ row }"
>
<
template
v-slot:table-x=
"{ row }"
>
<el-button
type=
"text"
@
click=
"handleUpdate(row)"
>
编辑
</el-button>
<el-button
type=
"text"
@
click=
"handleUpdate(row)"
>
编辑
</el-button>
...
@@ -74,10 +74,8 @@ export default {
...
@@ -74,10 +74,8 @@ export default {
placeholder
:
'请输入试卷标签'
,
placeholder
:
'请输入试卷标签'
,
label
:
'标签:'
label
:
'标签:'
},
},
{
{
type
:
'select'
,
prop
:
'paper_category'
,
prop
:
'paperType'
,
label
:
'试卷分类:'
,
label
:
'试卷分类:'
,
slots
:
'filter-category'
slots
:
'filter-category'
}
}
...
@@ -146,8 +144,13 @@ export default {
...
@@ -146,8 +144,13 @@ export default {
batchDeletePaper
(
ids
)
{
batchDeletePaper
(
ids
)
{
batchDeletePaper
({
ids
}).
then
(
res
=>
{
batchDeletePaper
({
ids
}).
then
(
res
=>
{
// 刷新列表
// 刷新列表
this
.
$refs
.
list
.
refetch
()
this
.
refetchList
()
})
})
},
// 刷新列表
refetchList
()
{
// 刷新列表
this
.
$refs
.
list
.
refetch
()
}
}
}
}
}
}
...
...
src/modules/paper/views/
NewPaper
.vue
→
src/modules/paper/views/
Update
.vue
浏览文件 @
e527f099
...
@@ -172,14 +172,6 @@ export default {
...
@@ -172,14 +172,6 @@ export default {
questionSelectVisible
:
false
questionSelectVisible
:
false
}
}
},
},
watch
:
{
'$route.query.select'
:
{
immediate
:
true
,
handler
(
value
)
{
value
&&
this
.
showSelectQuestion
()
}
}
},
computed
:
{
computed
:
{
isEdit
()
{
isEdit
()
{
return
!!
this
.
id
return
!!
this
.
id
...
@@ -194,15 +186,21 @@ export default {
...
@@ -194,15 +186,21 @@ export default {
methods
:
{
methods
:
{
// 取消
// 取消
handleCancel
()
{
handleCancel
()
{
this
.
$router
.
replace
(
'/paper/list'
)
this
.
$router
.
back
(
)
},
},
// 保存
// 保存
handleSubmit
()
{
handleSubmit
()
{
this
.
$refs
.
form
.
validate
().
then
(()
=>
{
this
.
$refs
.
form
.
validate
().
then
(()
=>
{
// 保存成功回到列表
// 保存成功回到列表
this
.
createPaper
().
then
(
res
=>
{
if
(
this
.
isEdit
)
{
this
.
$router
.
replace
(
'/paper/list'
)
this
.
updatePaper
().
then
(
res
=>
{
})
this
.
$router
.
back
()
})
}
else
{
this
.
createPaper
().
then
(
res
=>
{
this
.
$router
.
replace
(
'/paper/list'
)
})
}
})
})
},
},
// 保存并选择试题
// 保存并选择试题
...
@@ -214,7 +212,7 @@ export default {
...
@@ -214,7 +212,7 @@ export default {
})
})
}
else
{
}
else
{
this
.
createPaper
(
res
=>
{
this
.
createPaper
(
res
=>
{
this
.
$router
.
replace
({
path
:
'/paper/
update
/'
+
res
.
data
.
id
,
query
:
{
select
:
true
}
})
this
.
$router
.
replace
({
path
:
'/paper/
detail
/'
+
res
.
data
.
id
,
query
:
{
select
:
true
}
})
})
})
}
}
})
})
...
@@ -247,7 +245,8 @@ export default {
...
@@ -247,7 +245,8 @@ export default {
// 获取试卷详情
// 获取试卷详情
getDetail
()
{
getDetail
()
{
getPaper
({
id
:
this
.
id
}).
then
(
res
=>
{
getPaper
({
id
:
this
.
id
}).
then
(
res
=>
{
this
.
form
=
Object
.
assign
({},
this
.
form
,
res
.
data
)
const
data
=
res
.
data
this
.
form
=
Object
.
assign
({},
this
.
form
,
data
,
{
paper_category
:
data
.
paper_category
.
id
})
})
})
}
}
}
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论