mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/learning-system-portal.git
synced 2025-12-10 19:36:43 +08:00
自动报名
This commit is contained in:
@@ -1023,16 +1023,16 @@
|
||||
},
|
||||
loadData() {
|
||||
let $this=this;
|
||||
apiCoursePortal.detail(this.courseId, false).then(rs => {
|
||||
apiStudy.studyIndex(this.courseId).then(rs => {
|
||||
if (rs.status == 200) {
|
||||
if(rs.result.contents.length==0){
|
||||
$this.$message.error('课程内容已删除或课程已不再使用');
|
||||
return;
|
||||
}
|
||||
// if(!rs.result.course.enabled){
|
||||
// $this.$message.error('十分抱歉,此课程已停用,如需使用,请联系管理员。');
|
||||
// return;
|
||||
// }
|
||||
if(!rs.result.course.enabled){
|
||||
$this.$message.error('十分抱歉,此课程已停用,如需使用,请联系管理员。');
|
||||
return;
|
||||
}
|
||||
//设置必须的字段
|
||||
if(rs.result.contents.length==1){
|
||||
$this.tab=2;
|
||||
@@ -1105,81 +1105,61 @@
|
||||
//处理内容的名称
|
||||
this.totalContent = rs.result.contents.length;
|
||||
//加载学习的数据
|
||||
this.loadStudyData();
|
||||
//this.loadStudyData();
|
||||
this.loadStudyData(rs.result);
|
||||
|
||||
} else {
|
||||
this.$message.error(rs.message);
|
||||
}
|
||||
});
|
||||
},
|
||||
loadStudyData() {
|
||||
let $this = this;
|
||||
apiStudy.studyInfo(this.courseId).then(res => {
|
||||
if (res.status == 200) {
|
||||
if (res.result.signup) {
|
||||
this.loadScorePraiseAndTrample();
|
||||
this.studyId = res.result.studyId;
|
||||
//对已学习的内容进行比对,重要的字段, 学习内容id,在后缀的
|
||||
let playIndex = -1;
|
||||
this.contentList.forEach((con, conIdx) => {
|
||||
res.result.contents.forEach((scon, sconIdx) => {
|
||||
if (scon.contentId == con.id) {
|
||||
//定位显示的内容
|
||||
if ($this.initContentId != '' && $this.initContentId == scon.contentId) {
|
||||
//定位当前学习的内容,是上一次学习的内容
|
||||
playIndex = conIdx;
|
||||
} else {
|
||||
if (sconIdx == 0 && con.contentType < 52) {
|
||||
playIndex = conIdx;
|
||||
}
|
||||
}
|
||||
//console.log(scon.contentId,con.id);
|
||||
con.lastStudyTime = scon.lastStudyTime;
|
||||
//以下判断是为了兼容之前的问题,学习状态
|
||||
if (scon.status) {
|
||||
con.status = scon.status;
|
||||
} else {
|
||||
con.status = 9;
|
||||
}
|
||||
con.studyItemId = scon.id; //这个就是学习内容(条目)的id
|
||||
//console.log(scon.id,"scon.id");
|
||||
//console.log(con,"scon.id");
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
if (this.courseInfo.type == 10) {
|
||||
///console.log(this.contentList[0],'ccccc11111')
|
||||
this.showRes(this.contentList[0]);
|
||||
loadStudyData(result) {
|
||||
let $this=this;
|
||||
this.loadScorePraiseAndTrample();
|
||||
this.studyId = result.studyId;
|
||||
//对已学习的内容进行比对,重要的字段, 学习内容id,在后缀的
|
||||
let playIndex = -1;
|
||||
this.contentList.forEach((con, conIdx) => {
|
||||
result.contentStudys.forEach((scon, sconIdx) => {
|
||||
if (scon.contentId == con.id) {
|
||||
//定位显示的内容
|
||||
if ($this.initContentId != '' && $this.initContentId == scon.contentId) {
|
||||
//定位当前学习的内容,是上一次学习的内容
|
||||
playIndex = conIdx;
|
||||
} else {
|
||||
//如果没有,就定位第一项内容
|
||||
if (playIndex === -1) {
|
||||
// this.showRes(this.contentList[0]);
|
||||
//console.log(this.catalogTree,'ccccc22222')
|
||||
this.showRes(this.catalogTree[0].children[0])
|
||||
} else {
|
||||
//console.log(this.contentList[0],'ccccc3333')
|
||||
this.showRes(this.contentList[playIndex]);
|
||||
if (sconIdx == 0 && con.contentType < 52) {
|
||||
playIndex = conIdx;
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
if(!$this.courseInfo.enabled || $this.courseInfo.deleted){
|
||||
$this.$message.error('十分抱歉,此课程已停用,如需使用,请联系管理员。');
|
||||
location.href = this.webBaseUrl + '/course/detail?id=' + this.courseId;
|
||||
}else{
|
||||
this.$message.error('您还未报名');
|
||||
// if (this.courseInfo.type == 10) {
|
||||
// location.href = this.webBaseUrl + '/course/micro?id=' + this.courseId;
|
||||
// } else {
|
||||
location.href = this.webBaseUrl + '/course/detail?id=' + this.courseId;
|
||||
// }
|
||||
//console.log(scon.contentId,con.id);
|
||||
con.lastStudyTime = scon.lastStudyTime;
|
||||
//以下判断是为了兼容之前的问题,学习状态
|
||||
if (scon.status) {
|
||||
con.status = scon.status;
|
||||
} else {
|
||||
con.status = 9;
|
||||
}
|
||||
|
||||
con.studyItemId = scon.id; //这个就是学习内容(条目)的id
|
||||
//console.log(scon.id,"scon.id");
|
||||
//console.log(con,"scon.id");
|
||||
}
|
||||
} else {
|
||||
this.$message.error(res.message);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
if (this.courseInfo.type == 10) {
|
||||
///console.log(this.contentList[0],'ccccc11111')
|
||||
this.showRes(this.contentList[0]);
|
||||
} else {
|
||||
//如果没有,就定位第一项内容
|
||||
if (playIndex === -1) {
|
||||
// this.showRes(this.contentList[0]);
|
||||
//console.log(this.catalogTree,'ccccc22222')
|
||||
this.showRes(this.catalogTree[0].children[0])
|
||||
} else {
|
||||
//console.log(this.contentList[0],'ccccc3333')
|
||||
this.showRes(this.contentList[playIndex]);
|
||||
}
|
||||
}
|
||||
},
|
||||
saveStudyInfo() {
|
||||
//记录课件学习信息
|
||||
|
||||
Reference in New Issue
Block a user