课程进度条

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

@@ -13,20 +13,18 @@
<div style="width:254px"> <div style="width:254px">
<course-image width="254px" height="144px" :course="item.info"></course-image> <course-image width="254px" height="144px" :course="item.info"></course-image>
</div> </div>
<!-- <img style="width:254px;height:144px" src="/images/list-img.png" alt=""> -->
<div class="data-cen"> <div class="data-cen">
<h6 class="course-tit portal-title-tow">{{item.info.name || item.contentInfo}} <span class="score-info">{{toScore(item.info.score)}}</span> </h6> <h6 class="course-tit portal-title-tow">{{item.info.name || item.contentInfo}} <span class="score-info">{{toScore(item.info.lastScore)}}</span> </h6>
<p class="title-info">{{item.info.summary}}</p> <p class="title-info">{{item.info.summary}}</p>
<div class="pro-line"> <div>当前进度</div> <div style="width:200px"><el-progress :percentage="50"></el-progress></div></div> <div class="pro-line"> <div>当前进度</div> <div style="width:200px"><el-progress :percentage="item.info.progress"></el-progress></div></div>
<p class="portal-time">最新一次学习时间{{item.eventTime}}</p> <p class="portal-time">最新一次学习时间{{item.info.lastTime}}</p>
</div> </div>
<div style="width:150px"> <div style="width:150px">
<div class="follow-hide pointer" style="text-align: right;" v-if="!isDynamic && personal && !item.hidden" @click="emitHide(item.id)"> <div class="follow-hide pointer" style="text-align: right;" v-if="!isDynamic && personal && !item.hidden" @click="emitHide(item.id)">
<svg-icon style="margin-right: 10px;font-size:22px;padding-top: 4px;" icon-class="eyes"></svg-icon>隐藏 <svg-icon style="margin-right: 10px;font-size:22px;padding-top: 4px;" icon-class="eyes"></svg-icon>隐藏
</div> </div>
<div class="btn-right"> <div class="btn-right" v-if="!(personal && item.info.progress == 100)">
<el-button class="btn" type="primary" @click="jumpDetail(item.info)">{{pageId == userInfo.aid || isFollow? '继续学习' : '我也去学'}}</el-button> <el-button class="btn" type="primary" @click="jumpDetail(item.info)">{{isFollow ? '我也去学':pageId == userInfo.aid? '继续学习' : '我也去学'}}</el-button>
</div> </div>
</div> </div>
</div> </div>

View File

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

View File

@@ -85,6 +85,7 @@
import apiStat from "@/api/phase2/stat.js" import apiStat from "@/api/phase2/stat.js"
import apiArticle from '@/api/modules/article.js' import apiArticle from '@/api/modules/article.js'
import apiCases from '@/api/modules/cases.js' import apiCases from '@/api/modules/cases.js'
import apiCourseStudy from '@/api/modules/courseStudy.js'
import apiQa from '@/api/modules/qa.js' import apiQa from '@/api/modules/qa.js'
import apiCourse from '@/api/modules/course.js' import apiCourse from '@/api/modules/course.js'
import apiNote from '@/api/phase2/note.js' import apiNote from '@/api/phase2/note.js'
@@ -117,7 +118,7 @@
personal:true, personal:true,
orgData:[], orgData:[],
Profess:[], Profess:[],
ids:[], followIds:[],
} }
}, },
computed: { computed: {
@@ -126,7 +127,7 @@
created() { created() {
apiFollow.list().then(res=>{ apiFollow.list().then(res=>{
if(res.status == 200) { if(res.status == 200) {
this.ids = res.result.map(item=>item.followId); this.followIds = res.result.map(item=>item.followId);
this.getList() this.getList()
} }
}) })
@@ -160,19 +161,21 @@
this.page.pageIndex = val; this.page.pageIndex = val;
this.getList(); this.getList();
}, },
getList(ids) { getList() {
let data = { let data = {
pageIndex:this.page.pageIndex, pageIndex:this.page.pageIndex,
pageSize:this.page.pageSize, pageSize:this.page.pageSize,
contentType:this.activeName == 0? '':this.activeName,//内容类型 contentType:this.activeName == 0? '':this.activeName,//内容类型
aids:this.ids // 数组 aids:this.followIds // 数组
} }
apiStat.userDynamicfollows(data).then(res=>{ apiStat.userDynamicfollows(data).then(res=>{
if(res.status == 200) { if(res.status == 200) {
this.page.count = res.result.count; this.page.count = res.result.count;
let ids = res.result.list.map(item=>item.contentId); let ids = res.result.list.map(item=>item.contentId);
let aids = [];
const noReapetIds = [...new Set(ids)]; const noReapetIds = [...new Set(ids)];
res.result.list.forEach(item=>{ res.result.list.forEach(item=>{
aids.push(item.aid);
item.info = {}; item.info = {};
item.authorInfo = { item.authorInfo = {
aid: "", aid: "",
@@ -187,8 +190,9 @@
this.getAllList(res.result.list) this.getAllList(res.result.list)
} }
if(this.activeName == 1){ if(this.activeName == 1){
this.cousrePageList = res.result.list const noReapetAids = [...new Set(aids)];
this.getCourse(noReapetIds,res.result.list); this.cousrePageList = res.result.list;
this.getCourse(noReapetIds,res.result.list);
} }
if(this.activeName == 2) { if(this.activeName == 2) {
this.articlePageList = res.result.list; this.articlePageList = res.result.list;
@@ -197,7 +201,6 @@
if(this.activeName == 3) { if(this.activeName == 3) {
this.casePageList = res.result.list; this.casePageList = res.result.list;
this.getCase(noReapetIds,res.result.list); this.getCase(noReapetIds,res.result.list);
console.log(this.casePageList,'this.casePageList');
} }
if(this.activeName == 6) { // 笔记 if(this.activeName == 6) { // 笔记
this.getNote(noReapetIds,res.result.list); this.getNote(noReapetIds,res.result.list);
@@ -429,11 +432,15 @@
}); });
}, },
getCourse(ids,list) { getCourse(ids,list) {
apiCourse.ids(ids).then(res=>{ let params = {
ids:ids,
aids:this.followIds
}
apiCourseStudy.followIds(params).then(res=>{
if(res.status == 200) { if(res.status == 200) {
list.forEach((item, index) => { list.forEach((item, index) => {
res.result.some(con => { res.result.some(con => {
if (con.id == item.contentId) { if (item.contentId == con.courseId && item.aid == con.aid) {
item.info = con; item.info = con;
return true; return true;
} else { } else {