Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
confucius
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
罗超
confucius
Commits
e7006a19
Commit
e7006a19
authored
Jan 06, 2021
by
黄奎
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
页面修改
parent
9374f531
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
474 additions
and
59 deletions
+474
-59
questionconfig.js
src/api/question/questionconfig.js
+54
-0
app-attachment.vue
src/components/attachment/app-attachment.vue
+1
-3
question-form.vue
src/components/question/question-form.vue
+54
-52
questionpoint.vue
src/components/question/questionpoint.vue
+268
-0
multiple.vue
src/components/questiontype/multiple.vue
+48
-2
single.vue
src/components/questiontype/single.vue
+49
-2
No files found.
src/api/question/questionconfig.js
0 → 100644
View file @
e7006a19
import
request
from
'../../utils/request'
/**
* 选项配置
*/
export
function
getOptionList
()
{
var
array
=
[
'A'
,
'B'
,
'C'
,
'D'
,
'E'
,
'F'
,
'G'
,
'H'
,
'I'
,
'J'
,
'K'
,
'L'
,
'M'
,
'N'
,
'O'
,
'P'
,
'Q'
,
'R'
,
'S'
,
'T'
,
'U'
,
'V'
,
'W'
,
'X'
,
'Y'
,
'Z'
];
return
array
;
}
/**
* 选择题选项配置【单选、多选】
*/
export
function
optionListConfig
()
{
return
[{
Name
:
"A"
,
Content
:
""
,
IsAnswer
:
false
},
{
Name
:
"B"
,
Content
:
""
,
IsAnswer
:
false
},
{
Name
:
"C"
,
Content
:
""
,
IsAnswer
:
false
},
{
Name
:
"D"
,
Content
:
""
,
IsAnswer
:
false
}];
}
/**
* 创建问题
*/
export
function
CreateQuestion
(
questionKey
)
{
var
AnswerList
=
[];
switch
(
questionKey
)
{
//单选题
case
"single"
:
AnswerList
=
optionListConfig
();
break
;
//多选题
case
"multiple"
:
AnswerList
=
optionListConfig
();
break
;
//填空题
case
"fill-in"
:
break
;
}
return
AnswerList
;
}
src/components/attachment/app-attachment.vue
View file @
e7006a19
<
style
scoped
>
.app-attachment
{}
</
style
>
<
template
id=
"app-attachment"
>
<div
class=
"app-attachment"
style=
"z-index:99999"
>
...
...
@@ -156,7 +154,7 @@
methods
:
{
//选择文件
SelectAttachment
()
{
this
.
$emit
(
"selected"
,
this
.
chooseFileArray
);
this
.
$emit
(
"selected"
,
this
.
chooseFileArray
);
},
//上传附件
UploadAttachment
(
files
)
{
...
...
src/components/question/question-form.vue
View file @
e7006a19
...
...
@@ -48,7 +48,12 @@
class=
"col-6 q-pr-lg q-pb-lg"
emit-value
map-options
/>
</div>
<div
class=
"col-12"
>
知识点:
知识点:
<a
style=
"cursor:pointer;color:blue;"
@
click=
"isShowPoint=true"
>
选择知识点
</a>
<div
class=
"col"
>
<q-chip
v-for=
"(x, i) in choosePointArray"
@
remove=
"removePointTag(i)"
:key=
"i"
square
color=
"red"
class=
"q-ma-none q-mr-md"
icon=
"bookmark"
text-color=
"white"
:label=
"x.PointName"
removable
/>
</div>
</div>
</div>
</q-card-section>
...
...
@@ -59,7 +64,12 @@
@
click=
"setQuestion"
/>
</q-card-actions>
</q-card>
<!--选择知识点-->
<questionpoint
v-if=
"isShowPoint"
:CourseId=
"CourseId"
:openDialog=
"isShowPoint"
@
closed=
"closeQuestionPoint"
:multiple=
"true"
@
selected=
"getPointList"
>
</questionpoint>
</q-dialog>
</template>
<
script
>
...
...
@@ -69,13 +79,19 @@
saveQuestion
,
queryQuestionInfo
}
from
'../../api/question/question'
import
{
CreateQuestion
,
//生成问题
}
from
'../../api/question/questionconfig'
import
UeEditor
from
'../editor/UeEditor'
//知识点列表
import
questionpoint
from
'./questionpoint'
import
single
from
'../questiontype/single'
import
multiple
from
'../questiontype/multiple'
export
default
{
components
:
{
UeEditor
,
questionpoint
,
//知识点
single
,
//单选题
multiple
,
//多选题
},
...
...
@@ -117,6 +133,8 @@
secondTypeList
:
[],
//后面的题型
questionDifficultyTypeList
:
[],
//问题难易程度列表
saveCourseLoading
:
false
,
isShowPoint
:
false
,
//是否显示知识点弹窗
choosePointArray
:
[],
//知识点列表
}
},
computed
:
{
...
...
@@ -144,6 +162,24 @@
this
.
initObj
()
},
methods
:
{
//移除知识点
removePointTag
(
index
)
{
this
.
choosePointArray
.
splice
(
index
,
1
);
},
//获取知识点列表
getPointList
(
obj
)
{
if
(
obj
&&
obj
.
length
>
0
)
{
if
(
this
.
choosePointArray
&&
this
.
choosePointArray
.
length
>
0
)
{
this
.
choosePointArray
.
concat
(
obj
);
}
else
{
this
.
choosePointArray
=
obj
;
}
}
},
//关闭知识点弹窗
closeQuestionPoint
()
{
this
.
isShowPoint
=
false
;
},
//获取子组件内容
getChildData
(
obj
)
{
if
(
obj
)
{
...
...
@@ -155,48 +191,8 @@
this
.
questionObj
=
item
;
this
.
objOption
.
QuestionTypeId
=
item
.
QId
;
this
.
objOption
.
QuestionTypeKey
=
item
.
Key
;
switch
(
item
.
Key
)
{
//单选题
case
"single"
:
this
.
AnswerList
.
push
({
Name
:
"A"
,
Content
:
""
,
IsAnswer
:
false
},
{
Name
:
"B"
,
Content
:
""
,
IsAnswer
:
false
},
{
Name
:
"C"
,
Content
:
""
,
IsAnswer
:
false
},
{
Name
:
"D"
,
Content
:
""
,
IsAnswer
:
false
})
break
;
//多选题
case
"multiple"
:
this
.
AnswerList
.
push
({
Name
:
"A"
,
Content
:
""
,
IsAnswer
:
false
},
{
Name
:
"B"
,
Content
:
""
,
IsAnswer
:
false
},
{
Name
:
"C"
,
Content
:
""
,
IsAnswer
:
false
},
{
Name
:
"D"
,
Content
:
""
,
IsAnswer
:
false
})
break
;
}
var
obj
=
CreateQuestion
(
item
.
Key
);
this
.
AnswerList
=
obj
;
},
//获取题型列表
getQuestionType
()
{
...
...
@@ -218,13 +214,6 @@
}
});
},
getChild
(
obj
)
{
if
(
obj
==
""
)
{
this
.
objOption
.
CateId
=
0
;
}
else
{
this
.
objOption
.
CateId
=
obj
;
}
},
//初始化表单
initObj
()
{
this
.
objOption
.
CourseId
=
this
.
CourseId
;
...
...
@@ -246,6 +235,9 @@
this
.
AnswerList
=
res
.
Data
.
AnswerObj
;
this
.
questionObj
.
Key
=
res
.
Data
.
QuestionTypeKey
;
this
.
questionObj
.
QId
=
res
.
Data
.
QuestionTypeId
;
if
(
res
.
Data
.
QuestionPointList
&&
res
.
Data
.
QuestionPointList
.
length
>
0
)
{
this
.
choosePointArray
=
res
.
Data
.
QuestionPointList
;
}
})
this
.
optionTitle
=
"修改问题信息"
}
else
{
...
...
@@ -270,7 +262,17 @@
},
//保存问题
setQuestion
()
{
console
.
log
(
this
.
objOption
);
var
pointIds
=
""
;
if
(
this
.
choosePointArray
&&
this
.
choosePointArray
.
length
>
0
)
{
this
.
choosePointArray
.
forEach
(
item
=>
{
pointIds
+=
','
+
item
.
PointId
});
}
if
(
pointIds
!=
''
)
{
pointIds
=
pointIds
.
substring
(
1
);
}
this
.
objOption
.
Knowledge
=
pointIds
;
console
.
log
(
"setQuestion"
,
this
.
objOption
);
this
.
saveCourseLoading
=
true
;
saveQuestion
(
this
.
objOption
).
then
(
res
=>
{
this
.
saveCourseLoading
=
false
...
...
src/components/question/questionpoint.vue
0 → 100644
View file @
e7006a19
<
template
>
<div
class=
"questionpoint"
style=
"z-index:99999"
>
<el-dialog
class=
"questionpoint-dialog"
style=
"width:1000px;height:800px;margin:0 auto;"
title=
"知识点列表"
:visible
.
sync=
"dialogVisible"
@
opened=
"dialogOpened"
:close-on-click-modal=
"false"
>
<q-table
:pagination=
"msg"
:loading=
"loading"
no-data-label=
"暂无相关数据"
flat
class=
"sticky-right-column-table sticky-column-table"
separator=
"none"
:data=
"data"
:columns=
"columns"
row-key=
"PointId"
:selection=
"multiple?'multiple':'single'"
:selected
.
sync=
"selectedArray"
>
<template
v-slot:top=
"props"
>
<q-input
@
input=
"resetSearch"
clearable
standout=
"bg-primary text-white"
v-model=
"msg.PointName"
label=
"关键字"
maxlength=
"20"
@
clear=
"resetSearch"
/>
<q-space
/>
<div
class=
"page-option"
>
<q-btn
color=
"primary"
class=
"q-mr-md"
size=
"12px"
icon=
"add"
label=
"新增知识点"
@
click=
"IsShowPoint=true,clearMsg()"
>
<q-popup-proxy>
<q-banner
v-if=
"IsShowPoint"
>
<div
class=
"drop_NameDown"
style=
"margin-top:20px;"
>
<q-input
filled
stack-label
maxlength=
"100"
v-model=
"setPointObj.PointName"
:dense=
"false"
class=
"col-12 q-pr-lg q-pb-lg"
label=
"知识点名称"
/>
</div>
<q-card-actions
align=
"right"
class=
"bg-white"
style=
"margin-top:20px;"
>
<q-btn
label=
"取消"
flat
color=
"grey-10"
style=
"font-weight:400 !important"
@
click=
"IsShowPoint=false"
/>
<q-btn
label=
"确认"
color=
"accent q-px-md"
style=
"font-weight:400 !important"
@
click=
"savePoint()"
/>
</q-card-actions>
</q-banner>
</q-popup-proxy>
</q-btn>
</div>
</
template
>
<
template
v-slot:bottom
>
<q-pagination
class=
"full-width justify-end"
v-model=
"msg.pageIndex"
color=
"primary"
:max=
"pageCount"
:input=
"true"
@
input=
"changePage"
/>
</
template
>
<
template
v-slot:body-cell-optioned=
"props"
>
<q-td
:props=
"props"
>
<q-btn
flat
size=
"xs"
icon=
"edit"
color=
"accent"
style=
"font-weight:400"
label=
"重命名"
@
click=
"isShowPointEdit=true,EditPoint(props.row)"
>
<q-popup-proxy>
<q-banner
v-if=
"isShowPointEdit"
>
<div
class=
"calenderDialog"
>
<div
class=
"drop_NameDown"
style=
"margin-top:20px;"
>
<q-input
filled
stack-label
maxlength=
"100"
v-model=
"setPointObj.PointName"
:dense=
"false"
class=
"col-12 q-pr-lg q-pb-lg"
label=
"知识点名称"
/>
</div>
<q-card-actions
align=
"right"
class=
"bg-white"
>
<q-btn
label=
"取消"
flat
color=
"grey-10"
@
click=
"isShowPointEdit=false"
style=
"font-weight:400 !important"
/>
<q-btn
label=
"确认"
color=
"accent q-px-md"
style=
"font-weight:400 !important"
@
click=
"savePoint()"
/>
</q-card-actions>
</div>
</q-banner>
</q-popup-proxy>
</q-btn>
<q-btn
flat
size=
"xs"
icon=
"delete"
color=
"negative"
style=
"font-weight:400"
@
click=
"deletePoint(props.row)"
label=
"删除"
/>
</q-td>
</
template
>
</q-table>
<div
style=
"margin-top:20px;text-align:right"
>
<el-button
size=
"small"
type=
"primary"
@
click=
"SelectPoint"
>
选定
</el-button>
</div>
</el-dialog>
</div>
</template>
<
script
>
import
{
queryPointPageList
,
deleteQuestionPoint
,
//删除知识点
addQuestionPoint
,
//保存知识点
}
from
'../../api/question/question'
export
default
{
props
:
{
//是否显示弹窗
openDialog
:
{
type
:
Boolean
,
default
:
false
,
},
//课程编号
CourseId
:
{
type
:
String
,
default
:
0
,
},
//是否多选
multiple
:
{
type
:
Boolean
,
default
:
false
,
}
},
meta
:
{
title
:
"知识点"
},
components
:
{
},
watch
:
{
CourseId
:
{
handler
(
newValue
)
{
this
.
msg
.
CourseId
=
newValue
;
this
.
setPointObj
.
CourseId
=
newValue
;
},
immediate
:
true
},
openDialog
:
{
handler
(
newValue
)
{
this
.
dialogVisible
=
newValue
;
},
immediate
:
true
},
dialogVisible
(
newVal
,
oldVal
)
{
if
(
!
newVal
)
{
this
.
$emit
(
"closed"
);
}
},
},
data
()
{
return
{
dialogVisible
:
false
,
columns
:
[{
name
:
'PointName'
,
label
:
'知识点'
,
field
:
'PointName'
,
align
:
'left'
},
{
name
:
'optioned'
,
label
:
'操作'
,
field
:
'PointId'
}
],
data
:
[],
loading
:
true
,
msg
:
{
pageIndex
:
1
,
pageSize
:
5
,
rowsPerPage
:
5
,
PointName
:
""
,
CourseId
:
0
},
pageCount
:
0
,
setPointObj
:
{
PointId
:
0
,
//知识点编号
PointName
:
""
,
//知识点名称
CourseId
:
0
,
//课程编号
},
IsShowPoint
:
false
,
//是否选中新增知识点
isShowPointEdit
:
false
,
//是否显示修改
selectedArray
:
[],
}
},
created
()
{
},
mounted
()
{
this
.
currentUrl
=
this
.
$route
.
path
this
.
getQuestionPointList
()
},
methods
:
{
//重新查询
resetSearch
()
{
this
.
msg
.
pageIndex
=
1
this
.
loading
=
true
this
.
getQuestionPointList
()
},
//删除知识点
deletePoint
(
item
)
{
this
.
$q
.
dialog
({
title
:
"删除知识点"
,
message
:
"你正在进行删除知识点行为,一旦执行无法找回,是否确认执行?"
,
persistent
:
true
,
cancel
:
{
label
:
"取消"
,
flat
:
true
},
ok
:
{
label
:
"确认"
,
flat
:
true
,
focus
:
true
}
}).
onOk
(()
=>
{
deleteQuestionPoint
({
PointId
:
item
.
PointId
}).
then
(
res
=>
{
this
.
$q
.
notify
({
icon
:
'iconfont icon-chenggong'
,
color
:
'accent'
,
timeout
:
2000
,
message
:
'数据删除成功!'
,
position
:
'top'
})
this
.
getQuestionPointList
()
})
});
},
//分页改变
changePage
(
val
)
{
this
.
msg
.
Status
=
this
.
StatusTemp
?
this
.
StatusTemp
.
value
:
'-1'
this
.
msg
.
pageIndex
=
val
;
this
.
loading
=
true
this
.
getQuestionPointList
()
},
//知识点分页列表
getQuestionPointList
()
{
queryPointPageList
(
this
.
msg
).
then
(
res
=>
{
this
.
loading
=
false
this
.
data
=
res
.
Data
.
PageData
this
.
pageCount
=
res
.
Data
.
PageCount
}).
catch
(()
=>
{
this
.
loading
=
false
})
},
//编辑知识点
EditPoint
(
item
)
{
this
.
setPointObj
.
PointId
=
item
.
PointId
;
this
.
setPointObj
.
PointName
=
item
.
PointName
;
},
//保存知识点
savePoint
()
{
addQuestionPoint
(
this
.
setPointObj
).
then
(
res
=>
{
if
(
res
.
Code
==
1
)
{
this
.
$q
.
notify
({
icon
:
'iconfont icon-chenggong'
,
color
:
'accent'
,
timeout
:
2000
,
message
:
'数据保存成功!'
,
position
:
'top'
})
this
.
IsShowPoint
=
false
;
this
.
isShowPointEdit
=
false
;
this
.
clearMsg
();
this
.
getQuestionPointList
()
}
});
},
//清空数据
clearMsg
()
{
this
.
setPointObj
.
PointId
=
0
;
this
.
setPointObj
.
PointName
=
""
;
},
dialogOpened
()
{
},
//选中知识点
SelectPoint
()
{
var
tempArray
=
[];
if
(
this
.
selectedArray
&&
this
.
selectedArray
.
length
>
0
)
{
this
.
selectedArray
.
forEach
(
item
=>
{
tempArray
.
push
({
PointId
:
item
.
PointId
,
PointName
:
item
.
PointName
});
})
}
this
.
$emit
(
"selected"
,
tempArray
);
this
.
dialogVisible
=
false
;
},
},
}
</
script
>
<
style
lang=
"sass"
>
@import
url('~assets/css/table.sass');
</
style
>
src/components/questiontype/multiple.vue
View file @
e7006a19
...
...
@@ -12,11 +12,22 @@
<td>
<UeEditor
v-model=
"item.Content"
:config=
"config"
></UeEditor>
</td>
<td>
<a
style=
"cursor:pointer;"
@
click=
"deleteOpion(index)"
>
删除
</a>
</td>
</tr>
<tfoot>
<td
colspan=
"3"
>
<a
style=
"cursor:pointer;"
@
click=
"addOption()"
>
添加选项
</a>
</td>
</tfoot>
</table>
</div>
</
template
>
<
script
>
import
{
getOptionList
,
//获取选择标签【A,B,C,D....】
}
from
'../../api/question/questionconfig'
import
UeEditor
from
'../editor/UeEditor'
export
default
{
props
:
{
...
...
@@ -35,17 +46,52 @@
initialFrameWidth
:
null
,
initialFrameHeight
:
80
,
},
optionTitleList
:
[],
};
},
created
()
{
this
.
initConfig
();
},
methods
:
{
initConfig
()
{
this
.
optionTitleList
=
getOptionList
();
},
//删除选项
deleteOpion
(
index
)
{
this
.
data
.
splice
(
index
,
1
);
this
.
calcOptionTitle
();
},
//新增选项
addOption
()
{
if
(
this
.
data
.
length
<
7
)
{
this
.
data
.
push
({
Name
:
""
,
Content
:
""
,
IsAnswer
:
false
});
this
.
calcOptionTitle
()
}
else
{
this
.
$q
.
notify
({
type
:
'warning'
,
position
:
'center'
,
timeout
:
1500
,
message
:
`最多只能添加7个选项`
})
return
}
},
//重新计算选择Title[A,B,C,D....]
calcOptionTitle
()
{
if
(
this
.
data
&&
this
.
data
.
length
>
0
)
{
this
.
data
.
forEach
((
item
,
index
)
=>
{
item
.
Name
=
this
.
optionTitleList
[
index
];
})
}
},
//返回数据到父组件
returnDataToParent
()
{
this
.
$emit
(
'getChild'
,
this
.
data
);
},
},
mounted
()
{
...
...
src/components/questiontype/single.vue
View file @
e7006a19
...
...
@@ -7,16 +7,27 @@
<table
v-if=
"data&&data.length>0"
>
<tr
v-for=
"(item,index) in data"
>
<td>
<el-checkbox
v-model=
"item.IsAnswer"
@
change=
"ChangeItem(item)"
>
{{
item
.
Name
}}
</el-checkbox>
<el-checkbox
v-model=
"item.IsAnswer"
>
{{
item
.
Name
}}
</el-checkbox>
</td>
<td>
<UeEditor
v-model=
"item.Content"
:config=
"config"
></UeEditor>
</td>
<td>
<a
style=
"cursor:pointer;"
@
click=
"deleteOpion(index)"
>
删除
</a>
</td>
</tr>
<tfoot>
<td
colspan=
"3"
>
<a
style=
"cursor:pointer;"
@
click=
"addOption()"
>
添加选项
</a>
</td>
</tfoot>
</table>
</div>
</
template
>
<
script
>
import
{
getOptionList
,
//获取选择标签【A,B,C,D....】
}
from
'../../api/question/questionconfig'
import
UeEditor
from
'../editor/UeEditor'
export
default
{
props
:
{
...
...
@@ -35,12 +46,48 @@
initialFrameWidth
:
null
,
initialFrameHeight
:
80
,
},
optionTitleList
:
[],
};
},
created
()
{
this
.
initConfig
();
},
methods
:
{
initConfig
()
{
this
.
optionTitleList
=
getOptionList
();
},
//删除选项
deleteOpion
(
index
)
{
this
.
data
.
splice
(
index
,
1
);
this
.
calcOptionTitle
();
},
//新增选项
addOption
()
{
if
(
this
.
data
.
length
<
7
)
{
this
.
data
.
push
({
Name
:
""
,
Content
:
""
,
IsAnswer
:
false
});
this
.
calcOptionTitle
()
}
else
{
this
.
$q
.
notify
({
type
:
'warning'
,
position
:
'center'
,
timeout
:
1500
,
message
:
`最多只能添加7个选项`
})
return
}
},
//重新计算选择Title[A,B,C,D....]
calcOptionTitle
()
{
if
(
this
.
data
&&
this
.
data
.
length
>
0
)
{
this
.
data
.
forEach
((
item
,
index
)
=>
{
item
.
Name
=
this
.
optionTitleList
[
index
];
})
}
},
//返回数据到父组件
returnDataToParent
()
{
this
.
$emit
(
'getChild'
,
this
.
data
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment