置顶提示错误问题 还有首页置顶不生效问题

This commit is contained in:
lmj
2022-06-01 18:52:50 +08:00
parent d48afecd2e
commit fe77c6156c
2 changed files with 51 additions and 5 deletions

View File

@@ -371,16 +371,29 @@ export default {
topOrder:true,
pageIndex: pageIndex
};
let isTopList = [];
let data = [];
apiCoursePortal.pageList(course).then(res => {
if (res.status == 200 && res.result.list.length > 0) {
let courseIds = [];
res.result.list.forEach(item => {
item.authorInfo = { aid: '', name: '', orgInfo: '', avatar: '', code: '' ,sex:null};
courseIds.push(item.id);
console.log(item.isTop)
if(item.isTop == true) {
isTopList.push(item);
console.log(isTopList)
}else{
data.push(item);
}
});
this.loadCouserTeacher(res.result.list, courseIds);
this.courseList.list = res.result.list;
this.courseList.list.push(...isTopList,...data);
this.couname = res.result.list.name;
if (res.result.count - pageIndex * num < 8) {
this.pageIndex = 0;
}
@@ -391,6 +404,7 @@ export default {
}
});
// apiCourse.list({orderType,num,device:1}).then(res => {
// if(res.status==200){
// if(res.result.length>0){

View File

@@ -407,6 +407,9 @@ export default {
title:row.name,//课程的名称,
top:!row.isTop,// top 是否置顶}
}
console.log(row.isTop);
if(row.isTop == false){
// console.log('fa')
this.$confirm('此操作将置顶此课程, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
@@ -426,9 +429,38 @@ export default {
}).catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
message: '置顶失败'
});
});
}else if(row.isTop == true){
this.$confirm('此操作将取消置顶此课程, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
apiCourse.setTop(params).then(res=>{
if(res.status === 200 && res.result === true) {
this.$message.success('取消成功!')
this.searchData();
} else {
this.$message({
type: 'error',
message: res.message
});
}
})
}).catch(() => {
this.$message({
type: 'info',
message: '取消置顶失败'
});
});
}
},
// 复制