mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/learning-system-portal.git
synced 2025-12-12 04:16:45 +08:00
置顶提示错误问题 还有首页置顶不生效问题
This commit is contained in:
@@ -71,7 +71,7 @@
|
|||||||
<div class="course-author-left" >
|
<div class="course-author-left" >
|
||||||
{{ course.authorInfo.name }}
|
{{ course.authorInfo.name }}
|
||||||
</div>
|
</div>
|
||||||
<div style="flex:1; text-align: center; ">
|
<div style="flex:1; text-align: center; ">
|
||||||
<span class="study-num">{{ course.studys }}人学习</span>
|
<span class="study-num">{{ course.studys }}人学习</span>
|
||||||
</div>
|
</div>
|
||||||
<div style="padding-left:15px">
|
<div style="padding-left:15px">
|
||||||
@@ -371,16 +371,29 @@ export default {
|
|||||||
topOrder:true,
|
topOrder:true,
|
||||||
pageIndex: pageIndex
|
pageIndex: pageIndex
|
||||||
};
|
};
|
||||||
|
let isTopList = [];
|
||||||
|
let data = [];
|
||||||
apiCoursePortal.pageList(course).then(res => {
|
apiCoursePortal.pageList(course).then(res => {
|
||||||
if (res.status == 200 && res.result.list.length > 0) {
|
if (res.status == 200 && res.result.list.length > 0) {
|
||||||
let courseIds = [];
|
let courseIds = [];
|
||||||
res.result.list.forEach(item => {
|
res.result.list.forEach(item => {
|
||||||
item.authorInfo = { aid: '', name: '', orgInfo: '', avatar: '', code: '' ,sex:null};
|
item.authorInfo = { aid: '', name: '', orgInfo: '', avatar: '', code: '' ,sex:null};
|
||||||
courseIds.push(item.id);
|
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.loadCouserTeacher(res.result.list, courseIds);
|
||||||
this.courseList.list = res.result.list;
|
this.courseList.list.push(...isTopList,...data);
|
||||||
this.couname = res.result.list.name;
|
this.couname = res.result.list.name;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (res.result.count - pageIndex * num < 8) {
|
if (res.result.count - pageIndex * num < 8) {
|
||||||
this.pageIndex = 0;
|
this.pageIndex = 0;
|
||||||
}
|
}
|
||||||
@@ -390,6 +403,7 @@ export default {
|
|||||||
console.log('加载课程信息失败:' + res.error);
|
console.log('加载课程信息失败:' + res.error);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
// apiCourse.list({orderType,num,device:1}).then(res => {
|
// apiCourse.list({orderType,num,device:1}).then(res => {
|
||||||
// if(res.status==200){
|
// if(res.status==200){
|
||||||
|
|||||||
@@ -402,12 +402,15 @@ export default {
|
|||||||
},
|
},
|
||||||
// 置顶
|
// 置顶
|
||||||
setTop(row) {
|
setTop(row) {
|
||||||
let params = {
|
let params = {
|
||||||
ids: row.id,//课程id,多个使用逗号分隔,
|
ids: row.id,//课程id,多个使用逗号分隔,
|
||||||
title:row.name,//课程的名称,
|
title:row.name,//课程的名称,
|
||||||
top:!row.isTop,// top 是否置顶}
|
top:!row.isTop,// top 是否置顶}
|
||||||
}
|
}
|
||||||
this.$confirm('此操作将置顶此课程, 是否继续?', '提示', {
|
console.log(row.isTop);
|
||||||
|
if(row.isTop == false){
|
||||||
|
// console.log('fa')
|
||||||
|
this.$confirm('此操作将置顶此课程, 是否继续?', '提示', {
|
||||||
confirmButtonText: '确定',
|
confirmButtonText: '确定',
|
||||||
cancelButtonText: '取消',
|
cancelButtonText: '取消',
|
||||||
type: 'warning'
|
type: 'warning'
|
||||||
@@ -426,9 +429,38 @@ export default {
|
|||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
this.$message({
|
this.$message({
|
||||||
type: 'info',
|
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: '取消置顶失败'
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
// 复制
|
// 复制
|
||||||
|
|||||||
Reference in New Issue
Block a user