mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/learning-system-portal.git
synced 2025-12-14 13:26:44 +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){
|
||||
|
||||
@@ -1,19 +1,13 @@
|
||||
<template>
|
||||
<div>
|
||||
<div v-if="exam.show==1">
|
||||
<div style="padding: 10px; text-align: center;">
|
||||
<div v-if="showTab==1">
|
||||
<div style="padding: 10px; text-align: center;margin-top: 20px;">
|
||||
<el-button @click="openCusExam()" type="primary" >自定义考试</el-button>
|
||||
<el-button @click="openChoosePaper()" type="primary">选择已有考试</el-button>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="exam.show==2">
|
||||
<div v-if="showTab==2">
|
||||
<div style="display: flex;justify-content: flex-start;">
|
||||
<!--需求原型中没有按知识点选择
|
||||
<div>
|
||||
<el-select v-model="exam.type" style="width: 140px;" clearable placeholder="选择知识点">
|
||||
</el-select>
|
||||
</div>
|
||||
-->
|
||||
<div><el-input v-model="usePaper.keyword" maxlength="50" placeholder="名称"></el-input></div>
|
||||
<div style="padding-left: 10px;"><el-button @click="findExamPapers()" type="primary" >查询</el-button></div>
|
||||
<div style="padding-left: 10px;"><el-button @click="changeExamShow(1)" type="danger" >返回</el-button></div>
|
||||
@@ -21,7 +15,7 @@
|
||||
<div>
|
||||
<div style="text-align: center;padding-top: 10px; overflow-y: auto;">
|
||||
<el-table style="100%" height="480" :data="usePaper.list" border stripe>
|
||||
<el-table-column prop="testName" label="考试名称"></el-table-column>
|
||||
<el-table-column prop="testName" label="试卷"></el-table-column>
|
||||
<el-table-column prop="sysCreateTime" label="创建时间"></el-table-column>
|
||||
<el-table-column prop="sysCreateBy" label="创建人" width="80px" ></el-table-column>
|
||||
<el-table-column label="选择" width="60px">
|
||||
@@ -44,145 +38,109 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="exam.show==3">
|
||||
<div v-if="showTab==3">
|
||||
<div style="display: flex;justify-content: space-between;padding:5px 10px;line-height: 30px; border-bottom: 1px solid #e7e7e7;">
|
||||
<div>{{exam.paperType==1? '自定义考试':'使用独立考试试卷'}} </div>
|
||||
<div>{{examInfo.paperType==1? '自定义考试':'使用独立考试试卷'}} </div>
|
||||
<div>
|
||||
<el-checkbox v-model="exam.onlyQuestion">只显示试题</el-checkbox>
|
||||
<el-button :loading="loading" style="margin-left: 10px;" @click="saveContent(3)" type="primary" > 保 存 </el-button>
|
||||
<el-button style="margin-left: 10px;" @click="deleteContent(3)" type="danger" > 删 除 </el-button>
|
||||
<el-checkbox v-model="onlyQuestion">只显示试题</el-checkbox>
|
||||
<el-button :loading="loading" style="margin-left: 10px;" @click="saveExam()" type="primary" > 保 存 </el-button>
|
||||
<el-button style="margin-left: 10px;" @click="deleteExam()" type="danger" > 删 除 </el-button>
|
||||
</div>
|
||||
</div>
|
||||
<div style="padding-top: 10px;overflow: auto;">
|
||||
<div v-if="!exam.onlyQuestion">
|
||||
<div v-if="!onlyQuestion">
|
||||
<el-form size="small" label-width="80px">
|
||||
<!-- 课程内考虑不需要名辽
|
||||
<el-form-item label="考试名称">
|
||||
<el-input v-model="exam.info.testName" placeholder="请输入名称"></el-input>
|
||||
<el-input v-model="examInfo.testName" placeholder="请输入名称"></el-input>
|
||||
</el-form-item>
|
||||
-->
|
||||
<el-form-item label="考试时长">
|
||||
<el-col :span="8">
|
||||
<el-input size="mini" v-model="exam.info.testDuration" placeholder="20-120">
|
||||
<el-input size="mini" v-model="examInfo.testDuration" placeholder="20-120">
|
||||
<template slot="append">分钟</template>
|
||||
</el-input>
|
||||
</el-col>
|
||||
<!-- <el-col :span="9">
|
||||
<el-form-item label="尝试次数">
|
||||
<el-input-number v-model="exam.info.times" :min="0" :max="10" label="0表不限制"></el-input-number>
|
||||
</el-form-item>
|
||||
</el-col> -->
|
||||
<el-col :span="12">
|
||||
<el-form-item label="及格线">
|
||||
<el-input size="mini" placeholder="20-100" :maxlength="3" v-model="exam.info.passLine">
|
||||
<el-input size="mini" placeholder="20-100" :maxlength="3" v-model="examInfo.passLine">
|
||||
<template slot="append">%</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="显示">
|
||||
<el-col :span="10"><el-checkbox v-model="exam.info.showAnalysis">允许查看解析</el-checkbox> </el-col>
|
||||
<el-col :span="14"><el-checkbox v-model="exam.info.showAnswer">允许查看答案</el-checkbox></el-col>
|
||||
</el-form-item>
|
||||
<el-form-item label="模式">
|
||||
<el-col :span="10"><el-checkbox v-model="exam.info.randomMode">随机生成试题</el-checkbox></el-col>
|
||||
<el-col :span="14">
|
||||
<el-form-item label="数量">
|
||||
<el-input-number v-model="exam.info.qnum" :min="1" :max="10" label="数量"></el-input-number>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-form-item> -->
|
||||
<!-- <el-form-item label="试题排列">
|
||||
<el-col :span="10">
|
||||
<el-select v-model="exam.arrange">
|
||||
<el-option :value="0" label="按顺序"></el-option>
|
||||
<el-option :value="1" label="只题目乱序"></el-option>
|
||||
<el-option :value="2" label="只选项乱序"></el-option>
|
||||
<el-option :value="3" label="题目选项全乱序"></el-option>
|
||||
</el-select>
|
||||
</el-col>
|
||||
<el-col :span="14">
|
||||
<el-form-item label="评分方式">
|
||||
<el-radio-group v-model="exam.info.scoringType">
|
||||
<el-radio :label="1">最高一次</el-radio>
|
||||
<el-radio :label="2">最后一次</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-form-item> -->
|
||||
<el-form-item label="评分方式">
|
||||
<el-col :span="8">
|
||||
<el-radio-group v-model="exam.info.scoringType">
|
||||
<el-radio-group v-model="examInfo.scoringType">
|
||||
<el-radio :label="1">最高一次</el-radio>
|
||||
<el-radio :label="2">最后一次</el-radio>
|
||||
</el-radio-group>
|
||||
</el-col>
|
||||
<el-col :span="16">
|
||||
<el-form-item label="百分制">
|
||||
<el-checkbox v-model="exam.info.percentScore">实际成绩*100/实际总分</el-checkbox>
|
||||
<el-checkbox v-model="examInfo.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.info" placeholder="关于考试的说明(限255字以内)" maxlength="255"></el-input>
|
||||
<el-input type="textarea" show-word-limit v-model="examInfo.info" placeholder="关于考试的说明(限255字以内)" maxlength="255"></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
<div v-if="exam.info.paperType==1">
|
||||
<simplePaper :data="exam.paperJson"></simplePaper>
|
||||
<div v-if="examInfo.paperType==1">
|
||||
<simplePaper :data="examPaper"></simplePaper>
|
||||
</div>
|
||||
<div v-if="exam.info.paperType==2">
|
||||
<div v-if="examInfo.paperType==2">
|
||||
<div style="font-size: 20px;padding: 10px;" >试卷: {{usePaper.paperName}}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="exam.show==9">
|
||||
<div v-if="showTab==9">
|
||||
<div style="display: flex;justify-content: space-between;padding:5px 10px;line-height: 30px; border: 1px solid #e7e7e7;">
|
||||
<div>考试信息</div><div> </div>
|
||||
</div>
|
||||
<div style="padding-top: 10px;">
|
||||
<el-form size="small" label-width="80px">
|
||||
<el-form-item label="试卷类型">
|
||||
{{exam.info.paperType==1? '自定义试卷':'使用考试试卷: '+usePaper.paperName}}
|
||||
{{examInfo.paperType==1? '自定义试卷':'使用考试试卷: '+usePaper.paperName}}
|
||||
</el-form-item>
|
||||
<el-form-item label="考试时长">
|
||||
<el-col :span="6">{{exam.info.passScore}}分钟</el-col>
|
||||
<el-col :span="6">{{examInfo.passScore}}分钟</el-col>
|
||||
<el-col :span="9">
|
||||
<el-form-item label="及格线">{{exam.info.passLine}}%</el-form-item>
|
||||
<el-form-item label="及格线">{{examInfo.passLine}}%</el-form-item>
|
||||
</el-col>
|
||||
</el-form-item>
|
||||
<el-form-item label="评分方式">
|
||||
<el-col :span="6">
|
||||
<span v-if="exam.info.scoringType==1">最高一次</span>
|
||||
<span v-if="exam.info.scoringType==2">最后一次</span>
|
||||
<span v-if="examInfo.scoringType==1">最高一次</span>
|
||||
<span v-if="examInfo.scoringType==2">最后一次</span>
|
||||
</el-col>
|
||||
<el-col :span="10">
|
||||
<el-form-item label="考试成绩">
|
||||
<span v-if="exam.info.percentScore">按百分制显示</span>
|
||||
<span v-if="examInfo.percentScore">按百分制显示</span>
|
||||
<span v-else>按实际得分显示</span>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-form-item>
|
||||
<el-form-item label="考试说明">{{exam.info.info}}</el-form-item>
|
||||
<el-form-item label="考试说明">{{examInfo.info}}</el-form-item>
|
||||
|
||||
<el-form-item label="">
|
||||
<el-button type="primary" @click="changeExamShow(3)"> 修 改 </el-button>
|
||||
<el-button type="danger" @click="deleteContent(3)"> 删 除 </el-button>
|
||||
<el-button type="danger" @click="deleteExam(3)"> 删 除 </el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
</div>
|
||||
<el-dialog title="查看试卷" append-to-body :visible.sync="exam.paperShow" width="800px" custom-class="g-dialog">
|
||||
<el-dialog title="查看试卷" append-to-body :visible.sync="paperShow" width="800px" custom-class="g-dialog">
|
||||
<div>
|
||||
<img :src="`${webBaseUrl}/temp/exampaper.png`">
|
||||
</div>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="exam.paperShow= false">关闭</el-button>
|
||||
<el-button @click="paperShow= false">关闭</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import simplePaper from "@/components/Course/simpleTestPaper.vue";
|
||||
import apiCourse from '../../api/modules/course.js';
|
||||
@@ -191,6 +149,10 @@
|
||||
export default{
|
||||
components:{simplePaper},
|
||||
props:{
|
||||
courseId:{
|
||||
type: String,
|
||||
default:'',
|
||||
},
|
||||
contentId:{
|
||||
type: String,
|
||||
default:'',
|
||||
@@ -198,31 +160,34 @@
|
||||
},
|
||||
data(){
|
||||
return {
|
||||
examChange:{},
|
||||
exam:{
|
||||
show:1,
|
||||
paperShow:false,
|
||||
customerShow:false,
|
||||
has:false,
|
||||
onlyQuestion:false,
|
||||
info:{
|
||||
name:'',
|
||||
limitTimes:1,
|
||||
passScore:60,
|
||||
showJieXi:true,
|
||||
showAnswer:false,
|
||||
randomType:1,
|
||||
qorder:[],
|
||||
examTime:60,
|
||||
questions:[
|
||||
{body:'试题1',score:10},
|
||||
{body:'试题2',score:10}
|
||||
],
|
||||
|
||||
},
|
||||
findhas:{
|
||||
list:[{},{}]
|
||||
}
|
||||
loading:false,
|
||||
examChange:{}, //用于保存,检查是否改变
|
||||
showTab:0, //显示哪个
|
||||
onlyQuestion:false, //只显示问题
|
||||
paperShow:false, //查看试卷
|
||||
examPaper:{items:[]}, //试题列表的对象
|
||||
examInfo:{
|
||||
id:'',
|
||||
name:'',
|
||||
testDuration:30,
|
||||
testName:'',
|
||||
courseId:this.courseId,
|
||||
contentId:'',
|
||||
paperType:1,//默认是自定义
|
||||
paperId:'',
|
||||
arrange:0,
|
||||
qnum:0,
|
||||
times:1,
|
||||
passScore:60,
|
||||
showAnswer:false,
|
||||
showAnalysis:false,
|
||||
randomType:1,
|
||||
scoringType:1,
|
||||
passLine:60,
|
||||
randomMode:false,
|
||||
percentScore:true,//默认是百分制
|
||||
paperContent:'',
|
||||
info:''
|
||||
},
|
||||
usePaper:{ //使用考试试卷
|
||||
pageIndex:1,
|
||||
@@ -239,6 +204,8 @@
|
||||
mounted() {
|
||||
if(this.contentId){
|
||||
this.reloadExam();
|
||||
}else{
|
||||
this.showTab=1;
|
||||
}
|
||||
},
|
||||
watch:{
|
||||
@@ -250,13 +217,21 @@
|
||||
},
|
||||
methods:{
|
||||
reloadExam(){
|
||||
apiCourse.getExam(this.exam.content.id).then(res=>{
|
||||
console.log('contentId='+this.contentId);
|
||||
this.examPaper={items:[]};
|
||||
this.examInfo.id='';
|
||||
this.examInfo.paperType=1;
|
||||
this.examInfo.paperId='';
|
||||
this.examInfo.paperContent="{}";
|
||||
if(this.contentId){
|
||||
apiCourse.getExam(this.contentId).then(res=>{
|
||||
if(res.status==200){
|
||||
this.exam.info=res.result;
|
||||
this.examInfo=res.result;
|
||||
if(res.result.paperType==1){
|
||||
this.exam.paperJson=JSON.parse(res.result.paperContent);
|
||||
this.examInfo.paperContent=res.result.paperContent;
|
||||
this.examPaper=JSON.parse(res.result.paperContent);
|
||||
}else{
|
||||
apiExamPaper.detail(this.exam.info.paperId).then(rs=>{
|
||||
apiExamPaper.detail(this.examInfo.paperId).then(rs=>{
|
||||
if(rs.status==200){
|
||||
this.usePaper.paperId=rs.result.id;
|
||||
this.usePaper.paperName=rs.result.testName;
|
||||
@@ -265,32 +240,78 @@
|
||||
}
|
||||
})
|
||||
}
|
||||
this.exam.show=9;
|
||||
this.examChange = deepClone(this.exam);
|
||||
this.showTab=9;
|
||||
//this.examChange = deepClone(this.exam);
|
||||
}else if(res.status==404){
|
||||
//没有找到作业信息
|
||||
//this.exam.paperJson={items:[]};
|
||||
//this.exam.show=1;
|
||||
this.exam.info.id='';
|
||||
|
||||
}else{
|
||||
this.$message.error(res.message);
|
||||
}
|
||||
})
|
||||
}else{
|
||||
this.showTab=1;//选择状态
|
||||
}
|
||||
},
|
||||
saveExam(){//保存
|
||||
//检查是否完整
|
||||
if(this.examInfo.paperType==1){
|
||||
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.examInfo.paperContent=JSON.stringify(this.examPaper);
|
||||
}else{
|
||||
if(this.examInfo.paperId==''){
|
||||
this.$message.error("您还未选择任何试卷,请先选择试卷");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
this.$emit("save",this.examInfo);
|
||||
},
|
||||
deleteExam(){ //删除
|
||||
this.$confirm('您确认要删除此考试内容吗?', '删除提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.$emit("remove",this.examInfo);
|
||||
}).catch(() => {
|
||||
|
||||
});
|
||||
|
||||
},
|
||||
changeExamShow(idx){
|
||||
this.exam.show=idx;
|
||||
this.showTab=idx;
|
||||
},
|
||||
openCusExam(){ //自定义考试
|
||||
this.exam.show=3;
|
||||
this.exam.info.paperType=1;
|
||||
this.exam.info.paperId='';
|
||||
this.showTab=3;
|
||||
this.examInfo.paperType=1;
|
||||
this.examInfo.paperId='';
|
||||
this.usePaper.pageIndex=1;
|
||||
this.usePaper.keyword="";
|
||||
},
|
||||
openChoosePaper(){
|
||||
this.exam.show=2;
|
||||
this.exam.info.paperType=2; //选择试卷
|
||||
this.exam.info.paperId='';
|
||||
this.showTab=2;
|
||||
this.examInfo.paperType=2; //选择试卷
|
||||
this.examInfo.paperId='';
|
||||
},
|
||||
findExamPapers(){ //查询已有的考试试卷
|
||||
this.usePaper.pageIndex=1;
|
||||
@@ -320,8 +341,8 @@
|
||||
this.$message.error('此试卷无试题内容,请重新选择');
|
||||
return;
|
||||
}
|
||||
this.exam.info.paperType=2;// 选择已有试卷
|
||||
this.exam.info.paperId=epaper.id;// 选择已有试卷
|
||||
this.examInfo.paperType=2;// 选择已有试卷
|
||||
this.examInfo.paperId=epaper.id;// 选择已有试卷
|
||||
this.usePaper.paperId=epaper.id;
|
||||
this.usePaper.paperName=epaper.testName;
|
||||
//this.usePaper.paperJson= epaper.paperContent;
|
||||
@@ -329,10 +350,10 @@
|
||||
this.changeExamShow(3);
|
||||
},
|
||||
loadExamPaper(){
|
||||
if(this.exam.info.paperType!=2){
|
||||
if(this.examInfo.paperType!=2){
|
||||
return;
|
||||
}
|
||||
apiExamPaper.detail(this.exam.info.paperId).then(rs=>{
|
||||
apiExamPaper.detail(this.examInfo.paperId).then(rs=>{
|
||||
if(rs.status==200){
|
||||
this.usePaper.paperId=rs.result.id;
|
||||
this.usePaper.paperName=rs.result.testName;
|
||||
|
||||
Reference in New Issue
Block a user