课程进度条

This commit is contained in:
zhaofang
2022-10-22 15:30:06 +08:00
parent 3f3d30923b
commit d048b7d899
3 changed files with 33 additions and 40 deletions

View File

@@ -130,7 +130,6 @@
},
watch:{
'$route' (to, from) { //监听路由是否变化
//console.log(from,'from')
if(to.params.id != from.params.id){
this.pageId = to.params.id;
let urlPre=window.location.protocol+'//'+window.location.host;
@@ -189,8 +188,6 @@
let ids = res.result.list.map(item=>item.contentId);
const noReapetIds = [...new Set(ids)];
res.result.list.forEach(item=>{
item.lastTime = '';
item.progress = null;
item.info = {};
item.authorInfo = {
aid: "",
@@ -205,9 +202,8 @@
this.getAllList(res.result.list)
}
if(this.activeName == 1){
this.cousrePageList = res.result.list
this.getCourse(noReapetIds,res.result.list);
this.getCourseProgress(noReapetIds,res.result.list);
this.cousrePageList = res.result.list
this.getCourse(noReapetIds,res.result.list);
}
if(this.activeName == 2) {
this.articlePageList = res.result.list;
@@ -305,21 +301,6 @@
return val1 < val2 ? rev * -1 : rev * 1;
};
},
getCourseProgress(ids,list) {
apiCourseStudy.ids(ids).then((res)=>{
console.log(res,'res');
// list.forEach((item, index) => {
// res.result.some(con => {
// if (con.id == item.contentId) {
// item.info = con;
// return true;
// } else {
// return false;
// }
// });
// });
})
},
getAnswer(ids,list){
if(ids.length == 0){
return
@@ -465,11 +446,19 @@
});
},
getCourse(ids,list) {
apiCourse.ids(ids).then(res=>{
let aid = {}
let params = {
ids:ids,
// aid:[this.pageId]
}
if(this.pageId != this.userInfo.aid) {
params.aid = this.pageId
}
apiCourseStudy.ids(params).then(res=>{
if(res.status == 200) {
list.forEach((item, index) => {
res.result.some(con => {
if (con.id == item.contentId) {
if (con.courseId == item.contentId) {
item.info = con;
return true;
} else {
@@ -477,7 +466,6 @@
}
});
});
// this.getArticleUserData(list);
}
})
},