实现已关注处理

This commit is contained in:
weinan2087
2022-10-17 22:00:37 +08:00
parent a90f334acc
commit 87dddd9dc1

View File

@@ -117,7 +117,7 @@
</div>
<!-- 课程单元 -->
<div class="course-units" v-if="tab == 1">
<div :style="`height: ${controlHeight}px;overflow-y: auto;`">
<div class="catalog" v-if="courseInfo.type == 20">
<div v-for="(item, index) in catalogTree" :key="index" :name="index">
@@ -196,7 +196,8 @@
<div class="teacher-remark" v-html="item.authorInfo.sign"></div>
</div>
<div style="padding-top:15px">
<el-button type="primary" @click="toFollow(item)" size="small">+ 关注</el-button>
<el-button v-if="current_teacher_follow" type="primary" @click="toFollow(item)" size="small">关注</el-button>
<el-button v-if="!current_teacher_follow" type="primary" @click="toFollow(item)" size="small">+ 关注</el-button>
</div>
</div>
</div>
@@ -272,6 +273,7 @@
notePlay: null,
intTimeNote: '',
courestab: 2,//默认是课程评论
current_teacher_follow: false, // false - 已关注; true - 未关注
curCFile: {
converStatus: 4,
},
@@ -425,8 +427,10 @@
apiFollow.save(item.teacherId).then(res => {
if (res.status == 200) {
this.$message.success("关注成功!");
this.current_teacher_follow = true;
} else if(res.status == 400){
this.$message.warning(res.message);
this.current_teacher_follow = true;
}else{
this.$message.error(res.message);
}
@@ -784,6 +788,14 @@
return false;
}
});
// 检查是否已关注
apiFollow.checkFllow(item.teacherId).then(res => {
if (res.status == 200) {
this.current_teacher_follow = res.result ? true : false;
}
})
});
} else {
//console.log('加载课程信息失败:'+res.error);