This commit is contained in:
zhaofang
2022-10-19 19:10:43 +08:00
parent ee7d4554b4
commit 467e697720
7 changed files with 38 additions and 13 deletions

View File

@@ -196,8 +196,8 @@
<div class="teacher-remark" v-html="item.authorInfo.sign"></div>
</div>
<div style="padding-top:15px">
<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>
<el-button v-if="current_teacher_follow" v-loading="loading" type="primary" @click="cancelFollow(item)" size="small">已关注</el-button>
<el-button v-if="!current_teacher_follow" v-loading="loading" type="primary" @click="toFollow(item)" size="small">+ 关注</el-button>
</div>
</div>
</div>
@@ -268,6 +268,7 @@
},
data() {
return {
loading:false,
controlHeight:400,//左边控制区域的内容高度
timer: '',
notePlay: null,
@@ -422,9 +423,23 @@
}, 1000*60);
},
// 取消关注
cancelFollow(item) {
this.loading = true;
apiFollow.remove(item.teacherId).then(res=>{
this.loading = false;
if(res.status == 200) {
this.current_teacher_follow = false;
} else {
this.$message.error(res.message);
}
})
},
//关注功能
toFollow(item) {
this.loading = true;
apiFollow.save(item.teacherId).then(res => {
this.loading = false;
if (res.status == 200) {
this.$message.success("关注成功!");
this.current_teacher_follow = true;