作业提交studyitemid赋值

This commit is contained in:
zhangsir
2024-08-05 15:03:44 +08:00
parent c0833c56d8
commit c1a0fe988f
2 changed files with 10 additions and 4 deletions

View File

@@ -37,7 +37,7 @@
</div> </div>
</div> </div>
<div style="text-align: center;padding-bottom: 10px;"> <div style="text-align: center;padding-bottom: 10px;">
<el-button type="primary" @click="submitHomework()">{{records.length>0?'重新提交':'提交'}}</el-button> <el-button type="primary" :disabled="isSubmit" @click="submitHomework()">{{records.length>0?'重新提交':'提交'}}</el-button>
</div> </div>
</div> </div>
<div v-show="showRecord"><!--作业提交记录--> <div v-show="showRecord"><!--作业提交记录-->
@@ -87,10 +87,12 @@ export default {
has:true, has:true,
info:{}, info:{},
studyItemId:'', studyItemId:'',
studyItemIdOnce: '',
filePath:'', filePath:'',
answer:'', answer:'',
close:false, close:false,
records:[],//作业记录 records:[],//作业记录
isSubmit:false,
}; };
}, },
mounted() { mounted() {
@@ -135,6 +137,9 @@ export default {
apiCourseStudy.myHomeworkList(params).then(rs=>{ apiCourseStudy.myHomeworkList(params).then(rs=>{
if(rs.status==200){ if(rs.status==200){
this.records=rs.result; this.records=rs.result;
if(rs.result.length>0){
this.studyItemIdOnce = rs.result[rs.result.length - 1].id;
}
} }
}) })
}, },
@@ -171,9 +176,9 @@ export default {
return; return;
} }
} }
this.isSubmit = true
let pamars = { let pamars = {
studyItemId: this.studyItemId,//学习内容记录id, studyItemId: this.studyItemId || this.studyItemIdOnce,//学习内容记录id,
studyId: this.studyId,//学习id, studyId: this.studyId,//学习id,
courseId: this.content.courseId,//课程id, courseId: this.content.courseId,//课程id,
contentId: this.content.id,//内容id, contentId: this.content.id,//内容id,
@@ -185,6 +190,7 @@ export default {
score: 0 score: 0
} }
apiCourseStudy.saveHomework(pamars).then(res=>{ apiCourseStudy.saveHomework(pamars).then(res=>{
this.isSubmit = false
if(res.status==200){ if(res.status==200){
this.$message.success("作业已提交"); this.$message.success("作业已提交");
this.filePath=''; this.filePath='';

View File

@@ -1049,7 +1049,7 @@
this.cwareChange.curriculumData = deepClone(this.cware.curriculumData) this.cwareChange.curriculumData = deepClone(this.cware.curriculumData)
} }
}else if(index==2){ }else if(index==2){
this.homework.content.contentName = this.homework.info.name this.homework.content.contentName = this.homework.info.name || '作业'
postData.content=this.homework.content; postData.content=this.homework.content;
postData.homework=this.homework.info; postData.homework=this.homework.info;
this.homeworkChange = deepClone(this.homework) this.homeworkChange = deepClone(this.homework)