Commit fc1c9fec authored by 黄奎's avatar 黄奎

页面修改

parent d6036b62
......@@ -77,14 +77,13 @@
</div>
</div>
</template>
<template v-if="BankList&&BankList.length>0">
<div class="row">
<q-select filled option-value="QuestionTypeId" option-label="QuestionTypeName" :options="BankList" emit-value
map-options label="更多题型" class="col-6 q-pr-lg" use-input clearable v-model="MoreQuestionTypeId"
@input="changeQuestion" />
<q-checkbox v-model="templateMsg.IsSaveTemplate" label="同时保存为组卷模板" />
</div>
</template>
<div class="row">
<q-select filled option-value="QId" option-label="Name" :options="questionTypeList" emit-value map-options
label="更多题型" class="col-6 q-pr-lg" use-input clearable v-model="MoreQuestionTypeId" @input="changeQuestion" />
<q-checkbox v-model="templateMsg.IsSaveTemplate" label="同时保存为组卷模板" />
</div>
<br />
<div class="row">
<q-btn color="accent" size="sm" @click="setPaperTemplate" class="q-mr-md" label="保存"  />
......@@ -101,8 +100,6 @@
import {
queryQuestionTypeList,
queryDifficultyType,
queryQuestionCategory,
queryQuestionLevelType,
queryQuestionCategoryList
} from '../../api/question/question'
import {
......@@ -136,24 +133,76 @@
ShowBankName: "", //显示题库名称
BankList: [],
MoreQuestionTypeId: "", //更多题型
questionTypeList: [], //问题列表
}
},
created() {
this.getQuestionType();
this.getDifficultyType();
},
mounted() {
},
methods: {
//获取题型列表
getQuestionType() {
queryQuestionTypeList({}).then(res => {
if (res.Code == 1) {
this.questionTypeList = res.Data;
}
});
},
//选择添加题型
changeQuestion() {
if (this.MoreQuestionTypeId && this.MoreQuestionTypeId != '') {
//获取问题类型
var qTypeObj = this.questionTypeList.find((item) => {
return item.QId === this.MoreQuestionTypeId;
});
var newObj = {};
if (qTypeObj) {
newObj = {
ChooseNum: 0,
ChooseType: 1,
QuestionDesc: "",
QuestionScore: 0,
QuestionTypeId: qTypeObj.QId,
QuestionTypeKey: qTypeObj.Key,
QuestionTypeName: qTypeObj.Name,
QuestionTypeNum: 0,
ChooseList: [{
DifficultyType: 1,
DifficultyTypeName: "易",
DifficultyTypeCount: 0,
ChooseNum: 0
},
{
DifficultyType: 2,
DifficultyTypeName: "中",
DifficultyTypeCount: 35,
ChooseNum: 0
},
{
DifficultyType: 3,
DifficultyTypeName: "难",
DifficultyTypeCount: 36,
ChooseNum: 0
}
]
}
}
//获取题库中的题型
var chooseQuestion = this.BankList.find((item) => {
return item.QuestionTypeId === this.MoreQuestionTypeId;
});
if (chooseQuestion && chooseQuestion.QuestionTypeId > 0) {
if (!this.checkExists(chooseQuestion.QuestionTypeId)) {
this.templateMsg.TemplateData.push(chooseQuestion);
//题库中有此题型
if (chooseQuestion) {
newObj.QuestionTypeNum = chooseQuestion.QuestionTypeNum;
newObj.ChooseList = chooseQuestion.ChooseList;
}
if (newObj && newObj.QuestionTypeId > 0) {
if (!this.checkExists(newObj.QuestionTypeId)) {
this.templateMsg.TemplateData.push(newObj);
} else {
this.$q.notify({
type: 'negative',
......@@ -243,13 +292,19 @@
this.getQuestionCategoryList();
},
//获取模板数据
getTemplateData(tempArray) {
console.log("tempArray", tempArray);
getTemplateData(tempObj) {
if (tempObj) {
this.templateMsg.TemplateId = tempObj.TemplateId;
this.templateMsg.TemplateName = tempObj.TemplateName;
this.templateMsg.TemplateNum = tempObj.TemplateNum;
this.templateMsg.TemplateScore = tempObj.TemplateScore;
this.templateMsg.TemplateDifficultyType = tempObj.TemplateDifficultyType;
this.templateMsg.TemplateData = tempObj.TemplateData;
}
},
//根据模板生成试卷
setPaperTemplate() {
savePaperTemplate(this.templateMsg).then(res => {
console.log("res=>", res);
if (res.Code == 1) {
this.$q.notify({
icon: 'iconfont icon-chenggong',
......@@ -260,8 +315,7 @@
})
this.$router.push({
path: '/exam/examManagement',
query: {
}
query: {}
});
} else {
this.$q.notify({
......
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