@@ -291,6 +292,7 @@ import portalFloatTools from "@/components/PortalFloatTools.vue";
import authorInfo from "@/components/Portal/authorInfo.vue";
import courseItem from "@/components/Portal/course/courseItem.vue";
import apiCoursePortal from "@/api/modules/coursePortal.js";
+import apiCourseStudy from "@/api/modules/courseStudy.js";
import courseForm from "@/components/Course/courseForm.vue";
import apiType from "@/api/modules/type.js";
import apiCourse from "@/api/modules/coursePortal.js";
@@ -536,16 +538,24 @@ export default {
});
},
toCourseDetail(item) {
+ let $this=this;
if (item.source == 1) {
return `${this.webBaseUrl}/course/boeframe?id=${item.id}&type=${item.type}`;
//此处使用window.open有问题
//window.open(`${this.webBaseUrl}/course/boeframe?id=${item.id}&type=${item.type}`);
} else {
- // if (item.type == 10) {
- // return this.webBaseUrl + "/course/micro?id=" + item.id;
- // } else if (item.type == 20) {
- return this.webBaseUrl + "/course/detail?id=" + item.id;
- // }
+ if (item.type == 10) {
+ return this.webBaseUrl + "/course/studyindex?id=" + item.id;
+ } else if (item.type == 20) {
+ // apiCourseStudy.hasSignup(item.id).then(rs=>{
+ // if(rs.status==200){
+ // return $this.webBaseUrl + "/course/studyindex?id=" + item.id;
+ // }else{
+ // return $this.webBaseUrl + "/course/detail?id=" + item.id;
+ // }
+ // })
+ return $this.webBaseUrl + "/course/detail?id=" + item.id;
+ }
}
return "";
diff --git a/src/views/study/coursenew.vue b/src/views/study/coursenew.vue
index 99e7e074..430f0a3a 100644
--- a/src/views/study/coursenew.vue
+++ b/src/views/study/coursenew.vue
@@ -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() {
//记录课件学习信息