fix: exam/papercreate.vuw 抽卷考试

This commit is contained in:
zty 2024-06-25 13:57:30 +08:00
parent 09b52b2a7e
commit 6f62895a2a
2 changed files with 66 additions and 3 deletions

View File

@ -10,7 +10,29 @@
<el-form-item label="时间限制" prop="limit"> <el-form-item label="时间限制" prop="limit">
<el-input-number v-model="Form.limit" :min="0"></el-input-number>分钟 <el-input-number v-model="Form.limit" :min="0"></el-input-number>分钟
</el-form-item> </el-form-item>
<el-form-item label="试卷信息"> <el-form-item label="试卷模式" prop="paper_types">
<el-select v-model="Form.paper_types" style="width:100%" clearable>
<el-option
label = "押题"
value = 'true'>
</el-option>
<el-option
label = '抽考'
value= 'false'>
</el-option>
</el-select>
</el-form-item>
<el-form-item label="题目类型" prop="category" v-if="Form.paper_types==='false'">
<el-select v-model="Form.category" multiple placeholder = "请选择题目分类">
<el-option
v-for="item in type_list"
:key = "item.id"
:label = "item.name"
:value = "item.id">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="试卷信息" v-if="Form.paper_types==='true'">
<div> <div>
单选题 单选题
<span style="color:darkred;font-weight:bold">{{Form.danxuan_count}} </span> <span style="color:darkred;font-weight:bold">{{Form.danxuan_count}} </span>
@ -34,6 +56,31 @@
<span style="color:darkred;font-weight:bold">{{Form.total_score}}</span> <span style="color:darkred;font-weight:bold">{{Form.total_score}}</span>
</div> </div>
</el-form-item> </el-form-item>
<el-form-item label="试卷信息" v-if="Form.paper_types==='false'">
<div>
单选题
<el-input-number style="width:30%" v-model="Form.danxuan_count" :min="0"></el-input-number>
每道
<el-input-number style="width:30%" v-model="Form.danxuan_score" :min="0" ></el-input-number>
</div>
<div>
多选题
<el-input-number style="width:30%" v-model="Form.duoxuan_count" :min="0"></el-input-number>
每道
<el-input-number style="width:30%" v-model="Form.duoxuan_score" :min="0" ></el-input-number>
</div>
<div>
判断题
<el-input-number style="width:30%" v-model="Form.panduan_count" :min="0"></el-input-number>
每道
<el-input-number style="width:30%" v-model="Form.panduan_score" :min="0" ></el-input-number>
</div>
<div>
总分数
<!-- <el-input-number style="width:30%" v-model="Form.total_score" :min="0" ></el-input-number> -->
<span style="color:darkred;font-weight: bold;">{{ totalScore }}</span>
</div>
</el-form-item>
<el-form-item label="及格分数" prop="pass_score"> <el-form-item label="及格分数" prop="pass_score">
<el-input-number v-model="Form.pass_score" :min="0"></el-input-number> <el-input-number v-model="Form.pass_score" :min="0"></el-input-number>
</el-form-item> </el-form-item>
@ -45,7 +92,7 @@
</el-card> </el-card>
</el-col> </el-col>
<el-col :span="16"> <el-col :span="16">
<el-card header="试题信息"> <el-card header="试题信息" v-if="Form.paper_types==='true'">
<!-- <div> --> <!-- <div> -->
<div style="display: flex;"> <div style="display: flex;">
<el-button type="primary" @click="handleChoose" icon="el-icon-plus" style="margin-right: 10px;">选择试题</el-button> <el-button type="primary" @click="handleChoose" icon="el-icon-plus" style="margin-right: 10px;">选择试题</el-button>
@ -131,7 +178,9 @@
name: "", name: "",
// workscope: null, // workscope: null,
limit: 60, limit: 60,
paper_types:"",
total_score: 0, total_score: 0,
category:[],
pass_score: 60, pass_score: 60,
questions_: [], questions_: [],
danxuan_score: 2, danxuan_score: 2,
@ -172,6 +221,15 @@
watch: { watch: {
questions: "calScore" questions: "calScore"
}, },
computed:{
totalScore(){
return(
this.Form.danxuan_score * this.Form.danxuan_count +
this.Form.duoxuan_score * this.Form.duoxuan_count +
this.Form.panduan_score * this.Form.panduan_count
);
},
},
created() { created() {
this.getQuestioncat(); this.getQuestioncat();
}, },
@ -222,6 +280,11 @@
this.$refs[formName].validate(valid => { this.$refs[formName].validate(valid => {
if (valid) { if (valid) {
this.submitLoding = true; this.submitLoding = true;
if (this.Form.paper_types == 'false'){
this.Form.paper_types = '抽考';
this.Form.total_score = this.totalScore;
}else{this.Form.paper_types = '押题'};
createPaper(this.Form).then(response => { createPaper(this.Form).then(response => {
this.submitLoding = false; this.submitLoding = false;
this.$message({ this.$message({

View File

@ -520,7 +520,7 @@ export default {
updateUser(this.user.id, this.user).then((res) => { updateUser(this.user.id, this.user).then((res) => {
if (res.code >= 200) { if (res.code >= 200) {
this.getList(); this.getList();
this.dialogVisible = true; this.dialogVisible = false;
this.impForm.file = '' this.impForm.file = ''
this.$message.success("成功"); this.$message.success("成功");
}; };