Commit 826ac2ec authored by zhengke's avatar zhengke

修改

parent 11dd04c3
......@@ -23,17 +23,19 @@
<template>
<div class="page-body">
组卷题库(<span style="color:red;">*</span>): {{ShowBankName}} <br />
<a style="cursor:pointer;color:blue;margin:10px 0 10px 0;display:inline-block;" @click="showQuestionBank">选择题库</a> <br />
<a style="cursor:pointer;color:blue;margin-bottom:10px;display:inline-block;" @click="showExamTemplate">选择模板</a> <br />
<a style="cursor:pointer;color:blue;margin:10px 0 10px 0;display:inline-block;" @click="showQuestionBank">选择题库</a>
<br />
<a style="cursor:pointer;color:blue;margin-bottom:10px;display:inline-block;" @click="showExamTemplate">选择模板</a>
<br />
<div class="row">
<q-input filled stack-label maxlength="100" :dense="false" v-model="templateMsg.TemplateName"
class="col-6 q-pb-lg q-pr-lg" label="试卷标题" />
<q-input filled stack-label maxlength="5" :dense="false" v-model="templateMsg.TemplateScore" class="col-6 q-pb-lg"
<q-input filled stack-label maxlength="5" @keyup.native="checkInteger(templateMsg,'TemplateScore')" :dense="false" v-model="templateMsg.TemplateScore" class="col-6 q-pb-lg"
label="满分" />
</div>
<div class="row">
<q-input filled stack-label maxlength="5" :dense="false" v-model="templateMsg.TemplateNum"
class="col-6 q-pb-lg q-pr-lg" label="随机组卷数量" />
<q-input filled stack-label maxlength="5" :dense="false" ref="TemplateNum" v-model="templateMsg.TemplateNum"
class="col-6 q-pb-lg q-pr-lg" label="随机组卷数量" @keyup.native="checkInteger(templateMsg,'TemplateNum')" :rules="[val => !!val || '请填写随机组卷数量']" />
<q-select filled option-value="Id" option-label="Name" :options="questionDifficultyTypeList" emit-value
map-options label="难易程度" class="col-6" use-input clearable v-model="templateMsg.TemplateDifficultyType" />
</div>
......@@ -46,7 +48,7 @@
<div style="padding:0 20px 10px 20px;">
<div class="row">
<q-input filled stack-label maxlength="5" :dense="false" v-model="item.QuestionScore"
class="col-6 q-pb-lg q-pr-lg" label="总分" />
class="col-6 q-pb-lg q-pr-lg" label="总分" @keyup.native="checkInteger(item,'QuestionScore')" />
<q-input filled stack-label maxlength="100" :dense="false" v-model="item.QuestionDesc" class="col-6 q-pb-lg"
label="题型说明" />
</div>
......@@ -54,7 +56,7 @@
<q-radio v-model="item.ChooseType" :val="1" label="从题库选题" />
<template v-if="item.ChooseType==1">
<span style="position:relative;top:2px;">{{item.QuestionTypeNum}} 道 抽
<el-input style="width:100px;" size="small" v-model="item.ChooseNum" maxlength="5"></el-input>
<el-input style="width:100px;" size="small" :disabled="item.QuestionTypeNum<=0" v-model="item.ChooseNum" @keyup.native="checkInteger(item,'ChooseNum')" maxlength="5"></el-input>
&nbsp;&nbsp;</span>
</template>
</span>
......@@ -65,7 +67,7 @@
<div style="margin:0 0 20px 40px;" v-for="(subItem,subIndex) in item.ChooseList" :key="subIndex">
{{subItem.DifficultyTypeName}} (共
{{subItem.DifficultyTypeCount}} 道) 抽
<el-input style="width:100px;" size="small" v-model="subItem.ChooseNum" maxlength="5"></el-input>
<el-input style="width:100px;" size="small" :disabled="subItem.DifficultyTypeCount<=0" @keyup.native="checkInteger(subItem,'ChooseNum')" v-model="subItem.ChooseNum" maxlength="5"></el-input>
&nbsp;&nbsp;
</div>
</template>
......@@ -339,27 +341,50 @@
},
//根据模板生成试卷
setPaperTemplate() {
savePaperTemplate(this.templateMsg).then(res => {
if (res.Code == 1) {
this.$q.notify({
icon: 'iconfont icon-chenggong',
color: 'accent',
timeout: 2000,
message: '创建试卷成功!',
position: 'top'
})
this.$router.push({
path: '/exam/examManagement',
query: {}
});
} else {
this.$refs.TemplateNum.validate()
if (!this.$refs.TemplateNum.hasError) {
let TotalNum = 0;
for(let i=0;i<this.templateMsg.TemplateData.length;i++){
if(this.templateMsg.TemplateData[i].ChooseType==1&&this.templateMsg.TemplateData[i].ChooseNum==''){
this.$q.notify({
type: 'negative',
position: "top",
message: `请填写第${i+1}题的抽取数`
})
return
}
TotalNum += parseInt(this.templateMsg.TemplateData[i].QuestionScore);
}
if(TotalNum>this.templateMsg.TemplateScore){
this.$q.notify({
type: 'negative',
position: "top",
message: `操作失败!`
message: `题目总分之和大于满分`
})
return
}
});
savePaperTemplate(this.templateMsg).then(res => {
if (res.Code == 1) {
this.$q.notify({
icon: 'iconfont icon-chenggong',
color: 'accent',
timeout: 2000,
message: '创建试卷成功!',
position: 'top'
})
this.$router.push({
path: '/exam/examManagement',
query: {}
});
} else {
this.$q.notify({
type: 'negative',
position: "top",
message: `操作失败!`
})
}
});
}
}
}
}
......
......@@ -53,7 +53,7 @@
<q-list>
<q-item clickable v-close-popup @click="CreatePaper()">
<q-item-section>
<q-item-label>自动组卷</q-item-label>
<q-item-label>智能组卷</q-item-label>
</q-item-section>
</q-item>
<q-item clickable v-close-popup @click="goExameEdit(null)">
......
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