mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/learning-system-portal.git
synced 2025-12-19 15:56:45 +08:00
提交考试调整
This commit is contained in:
@@ -151,56 +151,16 @@
|
||||
</div>
|
||||
<!--考试-->
|
||||
<div v-if="content.contentType==61">
|
||||
<course-exam :contentId="content.id"></course-exam>
|
||||
<!-- <div style="display: flex;justify-content:space-between">
|
||||
<div>
|
||||
<el-input maxlength="50" @change="updateName" v-model="content.contentName" placeholder="内容的名称(限50字以内)"></el-input>
|
||||
</div>
|
||||
<div>
|
||||
<el-checkbox style="margin-right: 10px;" v-model="onlyQuestion">只显示试题</el-checkbox>
|
||||
<el-button type="primary" @click="saveData()" >保存</el-button>
|
||||
<el-button type="danger" @click="toReChoose()" >重新选择</el-button>
|
||||
</div>
|
||||
</div>
|
||||
<div style="padding-top: 10px;overflow: auto;">
|
||||
<div v-if="!onlyQuestion">
|
||||
<el-form size="small" label-width="80px">
|
||||
<el-form-item label="考试时长">
|
||||
<el-col :span="6">
|
||||
<el-input v-model="exam.testDuration" placeholder="20-120">
|
||||
<template slot="append">分钟</template>
|
||||
</el-input>
|
||||
</el-col>
|
||||
<el-col :span="9">
|
||||
<el-form-item label="及格线">
|
||||
<el-input placeholder="20-120" v-model="exam.passLine">
|
||||
<template slot="append">%</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-form-item>
|
||||
<el-form-item label="评分方式">
|
||||
<el-col :span="8">
|
||||
<el-radio-group v-model="exam.scoringType">
|
||||
<el-radio :label="1">最高一次</el-radio>
|
||||
<el-radio :label="2">最后一次</el-radio>
|
||||
</el-radio-group>
|
||||
</el-col>
|
||||
<el-col :span="15">
|
||||
<el-form-item label="百分制">
|
||||
<el-checkbox v-model="exam.percentScore">按百分制显示成绩(实际成绩*100/实际总分)</el-checkbox>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-form-item>
|
||||
<el-form-item label="考试说明">
|
||||
<el-input type="textarea" show-word-limit v-model="exam.info" placeholder="关于考试的说明(限255字以内)" maxlength="255"></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div style="display: flex;justify-content:space-between;padding-bottom: 10px;">
|
||||
<div>
|
||||
<el-input maxlength="50" @change="updateName" v-model="content.contentName" placeholder="内容的名称(限50字以内)"></el-input>
|
||||
</div>
|
||||
<div>
|
||||
<simplePaper :data="examPaper" ></simplePaper>
|
||||
</div>
|
||||
</div> -->
|
||||
<el-button type="danger" @click="toReChoose()" >重新选择</el-button>
|
||||
</div>
|
||||
</div>
|
||||
<course-exam ref="comExam" :courseId="course.id" :contentId="content.id" @remove="deleteExam" @save="saveExam"></course-exam>
|
||||
|
||||
</div>
|
||||
<!--作业-->
|
||||
<div v-if="content.contentType==60">
|
||||
@@ -297,7 +257,6 @@
|
||||
import chooseCourseFile from '@/components/Course/chooseCourseFile.vue'
|
||||
import courseHomework from '@/components/Course/courseHomework.vue'
|
||||
import courseExam from '@/components/Course/courseExam.vue'
|
||||
import simplePaper from "@/components/Course/simpleTestPaper.vue";
|
||||
import WxEditor from "@/components/Editor/indexCourse.vue";
|
||||
import fileUpload from '@/components/FileUpload/index.vue';
|
||||
import apiCourse from '../../api/modules/course.js';
|
||||
@@ -333,7 +292,7 @@
|
||||
default:1
|
||||
}
|
||||
},
|
||||
components:{chooseCourseFile,WxEditor,courseHomework,courseExam,simplePaper,fileUpload,pdfPreview,audioPlayer,videoPlayer},
|
||||
components:{chooseCourseFile,WxEditor,courseHomework,courseExam,fileUpload,pdfPreview,audioPlayer,videoPlayer},
|
||||
// inject: [ "informationDetails" ],
|
||||
data(){
|
||||
return {
|
||||
@@ -369,29 +328,6 @@
|
||||
},
|
||||
homework:{courseId: '', name:'', content:'', file:'', deadTime: '', submitMode: 3},
|
||||
homeworkChange:{},
|
||||
exam:{
|
||||
courseId:'',
|
||||
contentId:'',
|
||||
testName:this.course.name,
|
||||
testDuration:30,
|
||||
showAnalysis:false,
|
||||
showAnswer:false,
|
||||
times:1,
|
||||
qnum:0,//试题数量,只是模式是随机生成试题时才会有
|
||||
arrange:0,
|
||||
scoringType:1,
|
||||
passLine:60,
|
||||
randomMode:false,
|
||||
percentScore:true,//默认是百分制
|
||||
paperType:1,//自定义试卷
|
||||
paperId:'',//试卷的id,只有paperType为2的时间才会有值
|
||||
info:'',//考试说明
|
||||
paperContent:'',//试题的json字符串
|
||||
},
|
||||
examChange:{},
|
||||
onlyQuestion:true,
|
||||
examPaperChange:{},
|
||||
examPaper:{items:[]},
|
||||
assess:{
|
||||
countType:'权重配置',
|
||||
countText:'(问题1)*80%+(问题2)*10%+(问题3)*10%',
|
||||
@@ -443,8 +379,8 @@
|
||||
//作业
|
||||
this.loadHomeworkInfo();
|
||||
}else if(newVal.contentType==61){
|
||||
//考试
|
||||
this.loadExamInfo();
|
||||
//考试,已经移到组件中
|
||||
//this.loadExamInfo();
|
||||
}else if(newVal.contentType==62){
|
||||
//评估
|
||||
this.loadAssessInfo();
|
||||
@@ -470,14 +406,6 @@
|
||||
this.curPdfPath='';
|
||||
this.scormUrl='';
|
||||
this.curCFile={};
|
||||
this.exam.contentId='';
|
||||
this.exam.paperContent='';
|
||||
this.exam.info='';
|
||||
this.exam.id='';//一定要重置id
|
||||
this.exam.qnum='';
|
||||
this.exam.paperId='';
|
||||
this.exam.passLine=60;
|
||||
this.examPaper={items:[]};
|
||||
this.curriculumData={
|
||||
url:'',
|
||||
isDrag:true,
|
||||
@@ -533,20 +461,6 @@
|
||||
}
|
||||
})
|
||||
},
|
||||
loadExamInfo(){
|
||||
apiCourse.getExam(this.content.id).then(res=>{
|
||||
if(res.status==200){
|
||||
this.exam=res.result;
|
||||
this.examPaper=JSON.parse(res.result.paperContent);
|
||||
this.examChange = deepClone(res.result);
|
||||
this.examPaperChange = deepClone(JSON.parse(res.result.paperContent));
|
||||
}else if(res.status==404){
|
||||
//没有找到作业信息
|
||||
}else{
|
||||
this.$message.error(res.message);
|
||||
}
|
||||
})
|
||||
},
|
||||
loadAssessInfo(){
|
||||
if(this.content.content!='' && this.content.content.length>10){
|
||||
this.assess=JSON.parse(this.content.content);
|
||||
@@ -596,31 +510,7 @@
|
||||
if(this.content.contentType==60){
|
||||
jsonData.homework=this.homework;
|
||||
}else if(this.content.contentType==61){
|
||||
//检查内容的完整性
|
||||
if(this.examPaper.items.length==0){
|
||||
this.$message.error("您还没有添加考试的试题");
|
||||
return;
|
||||
}
|
||||
let pass=true;
|
||||
this.examPaper.items.forEach(qitem=>{
|
||||
if(qitem.options.length==0){
|
||||
pass=false;
|
||||
}else{
|
||||
let hasAnswer=qitem.options.some(opt=>{
|
||||
return opt.answer;
|
||||
});
|
||||
if(!hasAnswer){
|
||||
pass=false;
|
||||
}
|
||||
}
|
||||
});
|
||||
if(!pass){
|
||||
this.$message.error("试卷试题请填写完整,每个试题必须要有答案");
|
||||
return;
|
||||
}
|
||||
|
||||
this.exam.paperContent=JSON.stringify(this.examPaper);
|
||||
jsonData.exam=this.exam;
|
||||
//考试保存已经独立出去,不在这里处理了
|
||||
|
||||
}else if(this.content.contentType==62){
|
||||
this.content.content=JSON.stringify(this.assess);
|
||||
@@ -635,6 +525,47 @@
|
||||
}
|
||||
})
|
||||
},
|
||||
saveExam(examInfo){
|
||||
console.log('保存考试配置');
|
||||
//这里只是61考试
|
||||
this.content.courseId=this.course.id;
|
||||
this.content.sortIndex=this.addOrder;
|
||||
let jsonData={
|
||||
content:this.content,
|
||||
exam:examInfo
|
||||
}
|
||||
apiCourse.saveContent(jsonData).then(rs=>{
|
||||
if(rs.status === 200) {
|
||||
this.$message.success('保存成功!');
|
||||
this.$refs.comExam.reloadExam();
|
||||
// this.content=rs.result.content;
|
||||
this.$emit('save',rs.result.content);
|
||||
}else{
|
||||
this.$message.error(rs.message)
|
||||
}
|
||||
})
|
||||
},
|
||||
deleteExam(examInfo){
|
||||
if(this.content.id==''){
|
||||
this.content.contentType=0;
|
||||
this.content.content='';
|
||||
return;
|
||||
}
|
||||
let params={
|
||||
id:this.content.id,
|
||||
ctype:this.content.contentType,
|
||||
erasable:this.course.erasable
|
||||
}
|
||||
apiCourse.delContent(params).then(rs=>{
|
||||
if(rs.status === 200) {
|
||||
this.$message.success('删除成功!');
|
||||
this.$emit('remove');
|
||||
this.$refs.comExam.reloadExam();
|
||||
}else{
|
||||
this.$message.error(rs.message)
|
||||
}
|
||||
})
|
||||
},
|
||||
delData(id){
|
||||
//需要调用外部方法完成
|
||||
if(this.content.id==''){
|
||||
@@ -654,6 +585,7 @@
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
toReChoose(){
|
||||
let $this=this;
|
||||
if(this.content.id.length>1){
|
||||
|
||||
Reference in New Issue
Block a user