课程目录内容的一个过滤

This commit is contained in:
daihh
2022-10-27 17:56:44 +08:00
parent 4720fe6753
commit bc34262086

View File

@@ -1050,11 +1050,19 @@
}); });
this.sectionList = rs.result.sections; this.sectionList = rs.result.sections;
}else if(rs.result.course.type==10){ //无目录课程 }else if(rs.result.course.type==10){ //无目录课程
rs.result.contents.forEach(c => { //如果是多个的话,就需要过滤一下
let indexNum=0;
let delIndexs=[];
rs.result.contents.forEach((c,cidx) => {
c.status = 0; // c.status = 0; //
c.studyItemId = ''; c.studyItemId = '';
c.lastStudyTime = 0; c.lastStudyTime = 0;
if(c.sortIndex==2){ if(c.sortIndex==1){
indexNum++;
if(indexNum>1){
delIndexs.push(cidx);
}
}else if(c.sortIndex==2){
c.contentName='作业'; c.contentName='作业';
}else if(c.sortIndex==3){ }else if(c.sortIndex==3){
c.contentName='考试'; c.contentName='考试';
@@ -1062,6 +1070,11 @@
c.contentName='评估'; c.contentName='评估';
} }
}); });
if(delIndexs.length>0){
delIndexs.forEach(delIdx=>{
rs.result.contents.splice(delIdx,1);
})
}
} }
this.courseInfo = rs.result.course; this.courseInfo = rs.result.course;