Commit fc1c9fec authored by 黄奎's avatar 黄奎

页面修改

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