Commit c06ba0b5 authored by 黄奎's avatar 黄奎

新增插件

parent e7421412
...@@ -46,9 +46,28 @@ export function CreateQuestion(questionKey) { ...@@ -46,9 +46,28 @@ export function CreateQuestion(questionKey) {
break; break;
//填空题 //填空题
case "fill-in": case "fill-in":
AnswerList.push({
Content: ""
})
break;
//判断题
case "judge":
AnswerList.push({
Name: "A",
Content: "",
IsAnswer: true
}, {
Name: "B",
Content: "",
IsAnswer: false
})
break;
//简答题
case "short-answer":
// AnswerList.push({
// Content: ""
// })
break; break;
} }
return AnswerList; return AnswerList;
} }
...@@ -36,6 +36,15 @@ ...@@ -36,6 +36,15 @@
<single v-if="questionObj.Key=='single'" :questionData="AnswerList" @getChild="getChildData"></single> <single v-if="questionObj.Key=='single'" :questionData="AnswerList" @getChild="getChildData"></single>
<!--多选题--> <!--多选题-->
<multiple v-if="questionObj.Key=='multiple'" :questionData="AnswerList" @getChild="getChildData"></multiple> <multiple v-if="questionObj.Key=='multiple'" :questionData="AnswerList" @getChild="getChildData"></multiple>
<!--填空题-->
<fill-in v-if="questionObj.Key=='fill-in'" :questionData="AnswerList" @getChild="getChildData"
:setOption="objOption"></fill-in>
<!--判断题-->
<judge v-if="questionObj.Key=='judge'" :questionData="AnswerList" @getChild="getChildData"></judge>
<!--简答题、名词解释、论述题-->
<short-answer
v-if="questionObj.Key=='short-answer'||questionObj.Key=='noun-explanation'||questionObj.Key=='essay-question'"
:setOption="objOption"> </short-answer>
<br /> <br />
<div class="col-12"> <div class="col-12">
答案解析<UeEditor v-model="objOption.AnswerParse" :config="config" ref="AnswerParse"></UeEditor> 答案解析<UeEditor v-model="objOption.AnswerParse" :config="config" ref="AnswerParse"></UeEditor>
...@@ -49,7 +58,6 @@ ...@@ -49,7 +58,6 @@
</div> </div>
<div class="col-12"> <div class="col-12">
知识点: <a style="cursor:pointer;color:blue;" @click="isShowPoint=true">选择知识点</a> 知识点: <a style="cursor:pointer;color:blue;" @click="isShowPoint=true">选择知识点</a>
<div class="col"> <div class="col">
<q-chip v-for="(x, i) in choosePointArray" @remove="removePointTag(i)" :key="i" square color="red" <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 /> class="q-ma-none q-mr-md" icon="bookmark" text-color="white" :label="x.PointName" removable />
...@@ -88,12 +96,18 @@ ...@@ -88,12 +96,18 @@
import single from '../questiontype/single' import single from '../questiontype/single'
import multiple from '../questiontype/multiple' import multiple from '../questiontype/multiple'
import fillIn from '../questiontype/fill-in'
import judge from '../questiontype/judge'
import shortAnswer from '../questiontype/short-answer'
export default { export default {
components: { components: {
UeEditor, UeEditor,
questionpoint, //知识点 questionpoint, //知识点
single, //单选题 single, //单选题
multiple, //多选题 multiple, //多选题
fillIn, //填空题
judge, //判断题
shortAnswer, //简答题
}, },
props: { props: {
setingObj: { setingObj: {
...@@ -124,7 +138,7 @@ ...@@ -124,7 +138,7 @@
IsUpdateJobExam: 0, //是否同步修改引用此题目的作业和考试(1-是) IsUpdateJobExam: 0, //是否同步修改引用此题目的作业和考试(1-是)
SortNum: 0, //排序 SortNum: 0, //排序
Answer: "", //问题JSON Answer: "", //问题JSON
Score: 0, //分数 IsMutex: 0, //填空题(答案顺序打乱也判正确)
}, },
AnswerList: [], AnswerList: [],
optionTitle: "", optionTitle: "",
...@@ -201,7 +215,7 @@ ...@@ -201,7 +215,7 @@
var tempArray = res.Data; var tempArray = res.Data;
if (tempArray && tempArray.length > 0) { if (tempArray && tempArray.length > 0) {
this.firstTypeList = tempArray.slice(0, 5); this.firstTypeList = tempArray.slice(0, 5);
this.secondTypeList = tempArray.slice(6); this.secondTypeList = tempArray.slice(5);
} }
} }
}); });
...@@ -231,7 +245,7 @@ ...@@ -231,7 +245,7 @@
this.objOption.IsUpdateJobExam = res.Data.IsUpdateJobExam; this.objOption.IsUpdateJobExam = res.Data.IsUpdateJobExam;
this.objOption.SortNum = res.Data.SortNum; this.objOption.SortNum = res.Data.SortNum;
this.objOption.Answer = res.Data.Answer; this.objOption.Answer = res.Data.Answer;
this.objOption.Score = res.Data.Score; this.objOption.IsMutex = res.Data.IsMutex;
this.AnswerList = res.Data.AnswerObj; this.AnswerList = res.Data.AnswerObj;
this.questionObj.Key = res.Data.QuestionTypeKey; this.questionObj.Key = res.Data.QuestionTypeKey;
this.questionObj.QId = res.Data.QuestionTypeId; this.questionObj.QId = res.Data.QuestionTypeId;
...@@ -252,7 +266,7 @@ ...@@ -252,7 +266,7 @@
this.objOption.IsUpdateJobExam = 0; this.objOption.IsUpdateJobExam = 0;
this.objOption.SortNum = 0; this.objOption.SortNum = 0;
this.objOption.Answer = ''; this.objOption.Answer = '';
this.objOption.Score = 0; this.objOption.IsMutex = 0;
} }
}, },
//关闭弹窗 //关闭弹窗
......
<!--填空题-->
<style>
</style>
<template>
<div class="fillInQuestion">
<table v-if="data&&data.length>0">
<tr v-for="(item,index) in data">
<td>
{{index+1}}</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>
<tr>
<td colspan="3">
<a style="cursor:pointer;" @click="addOption()">添加选项</a>
</td>
</tr>
<tr>
<td colspan="3">
<el-checkbox v-model="setOption.IsMutex" :true-label="1" :false-label="0">答案顺序打乱也判正确</el-checkbox>
<br />
1. 一个空有多种答案时请用";"隔开。如:水;H2O
<br />
2. 若试题答案是数字,可设置范围,两个数字之间用"-"。如:1-9,学生填写1到9之间的数字都算正确(包括1和9)
</td>
</tr>
</tfoot>
</table>
</div>
</template>
<script>
import UeEditor from '../editor/UeEditor'
export default {
props: {
questionData: {
type: Array,
},
setOption: {
type: Object,
}
},
components: {
UeEditor
},
data() {
return {
data: this.questionData,
config: {
initialFrameWidth: null,
initialFrameHeight: 80,
},
};
},
created() {},
methods: {
//删除选项
deleteOpion(index) {
this.data.splice(index, 1);
this.calcOptionTitle();
},
//新增选项
addOption() {
this.data.push({
Content: "",
});
},
//返回数据到父组件
returnDataToParent() {
this.$emit('getChild', this.data);
},
},
mounted() {
},
watch: {
data: {
handler(newValue) {
this.returnDataToParent();
},
deep: true
},
}
};
</script>
<!--判断题-->
<style>
</style>
<template>
<div class="judgeQuestion">
<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>
</td>
<td>
<UeEditor v-model="item.Content" :config="config"></UeEditor>
</td>
</tr>
</table>
</div>
</template>
<script>
import UeEditor from '../editor/UeEditor'
export default {
props: {
questionData: {
type: Array,
},
setOption: {
type: Object,
}
},
components: {
UeEditor
},
data() {
return {
data: this.questionData,
config: {
initialFrameWidth: null,
initialFrameHeight: 80,
},
};
},
created() {},
methods: {
//返回数据到父组件
returnDataToParent() {
this.$emit('getChild', this.data);
},
ChangeItem(item) {
if (this.data && this.data.length > 0) {
this.data.forEach(item => {
item.IsAnswer = false;
})
}
item.IsAnswer = true;
},
},
mounted() {
},
watch: {
data: {
handler(newValue) {
this.returnDataToParent();
},
deep: true
},
}
};
</script>
...@@ -17,9 +17,11 @@ ...@@ -17,9 +17,11 @@
</td> </td>
</tr> </tr>
<tfoot> <tfoot>
<td colspan="3"> <tr>
<a style="cursor:pointer;" @click="addOption()">添加选项</a> <td colspan="3">
</td> <a style="cursor:pointer;" @click="addOption()">添加选项</a>
</td>
</tr>
</tfoot> </tfoot>
</table> </table>
</div> </div>
...@@ -40,7 +42,6 @@ ...@@ -40,7 +42,6 @@
}, },
data() { data() {
return { return {
choicImg: false,
data: this.questionData, data: this.questionData,
config: { config: {
initialFrameWidth: null, initialFrameWidth: null,
......
<!--简答题-->
<style>
</style>
<template>
<div class="shortAnswerQuestion">
<br/>
<UeEditor v-model="setOption.Answer" :config="config"></UeEditor>
</div>
</template>
<script>
import UeEditor from '../editor/UeEditor'
export default {
props: {
setOption: {
type: Object,
}
},
components: {
UeEditor
},
data() {
return {
config: {
initialFrameWidth: null,
initialFrameHeight: 80,
},
};
},
created() {},
methods: {
},
mounted() {
},
};
</script>
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<table v-if="data&&data.length>0"> <table v-if="data&&data.length>0">
<tr v-for="(item,index) in data"> <tr v-for="(item,index) in data">
<td> <td>
<el-checkbox v-model="item.IsAnswer">{{item.Name}}</el-checkbox> <el-checkbox v-model="item.IsAnswer" @change="ChangeItem(item)">{{item.Name}}</el-checkbox>
</td> </td>
<td> <td>
<UeEditor v-model="item.Content" :config="config"></UeEditor> <UeEditor v-model="item.Content" :config="config"></UeEditor>
...@@ -17,9 +17,11 @@ ...@@ -17,9 +17,11 @@
</td> </td>
</tr> </tr>
<tfoot> <tfoot>
<td colspan="3"> <tr>
<a style="cursor:pointer;" @click="addOption()">添加选项</a> <td colspan="3">
</td> <a style="cursor:pointer;" @click="addOption()">添加选项</a>
</td>
</tr>
</tfoot> </tfoot>
</table> </table>
</div> </div>
...@@ -40,7 +42,6 @@ ...@@ -40,7 +42,6 @@
}, },
data() { data() {
return { return {
choicImg: false,
data: this.questionData, data: this.questionData,
config: { config: {
initialFrameWidth: null, initialFrameWidth: null,
......
...@@ -153,29 +153,44 @@ ...@@ -153,29 +153,44 @@
} }
}); });
}, },
//更新问题状态 //删除问题
setQuestionStatus(item) { setQuestionStatus(item) {
deleteQuestion({ this.$q.dialog({
QuestionId: item.QuestionId title: "删除问题",
}).then(res => { message: "你正在进行删除问题行为,一旦执行无法找回,是否确认执行?",
if (res.Code == 1) { persistent: true,
this.$q.notify({ cancel: {
icon: 'iconfont icon-chenggong', label: "取消",
color: 'accent', flat: true
timeout: 2000, },
message: '设置成功!', ok: {
position: 'top' label: "确认",
}) flat: true,
this.getQuestionList(); focus: true
} else {
this.$q.notify({
icon: 'iconfont icon-chenggong',
color: 'accent',
timeout: 2000,
message: res.Message,
position: 'top'
})
} }
}).onOk(() => {
deleteQuestion({
QuestionId: item.QuestionId
}).then(res => {
if (res.Code == 1) {
this.$q.notify({
icon: 'iconfont icon-chenggong',
color: 'accent',
timeout: 2000,
message: '删除成功!',
position: 'top'
})
this.getQuestionList();
} else {
this.$q.notify({
icon: 'iconfont icon-chenggong',
color: 'accent',
timeout: 2000,
message: res.Message,
position: 'top'
})
}
});
}); });
}, },
//翻页 //翻页
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment