自动报名

This commit is contained in:
daihh
2022-10-30 17:45:01 +08:00
parent 6470e488b5
commit 40d29343be
4 changed files with 73 additions and 79 deletions

View File

@@ -66,6 +66,9 @@ const countSignup = function(courseId) {
return ajax.post('/xboe/school/study/signup/count-by-course',{courseId});
}
const studyIndex = function(courseId) {
return ajax.get('/xboe/school/study/course/studyIndex?cid='+courseId+'&addView=true');
}
/**
* 课程学习根据课程id来获取,
@@ -374,6 +377,7 @@ export default {
deleteSignup,
importSignup,
countSignup,
studyIndex,
studyInfo,
studyVideoTime,
lastStudy,

View File

@@ -52,12 +52,12 @@
</div>
</a>
<div class="last-study-info">
<div class="one-line-ellipsis">
<router-link :to="'/course/studyindex?id='+lastStudy.courseId" >最近学习{{lastStudy.courseName}} </router-link>
<div class="one-line-ellipsis" style="color: #000000;">
<router-link :to="'/course/studyindex?id='+lastStudy.courseId" >最近学习 {{lastStudy.courseName}} </router-link>
</div>
<div class="tobe-icon">
<!-- <div class="tobe-icon">
<img :src="`${webBaseUrl}/images/homeWu/Pending.png`" alt="">
</div>
</div> -->
</div>
<ul class="personal-ul">
<li>
@@ -1063,7 +1063,7 @@
}
}
.case-inter-orgin{
// width: 45%;

View File

@@ -85,6 +85,7 @@
<div class="course-card-favorite">
<interactBar :type="1" nodeWidth="20px" :data="cinfo" :courseExclusive="true" :comments="false" :praises="false" :shares="false" :views="false"></interactBar>
</div>
<!-- <a :href="toCourseDetail(cinfo)"> -->
<a :href="toCourseDetail(cinfo)">
<div class="course-image-box">
<course-image :course="cinfo"></course-image>
@@ -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 "";

View File

@@ -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() {
//记录课件学习信息