mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/learning-system-portal.git
synced 2025-12-10 19:36:43 +08:00
修改关注的button,统一处理
This commit is contained in:
@@ -242,8 +242,7 @@
|
||||
<div class="teacher-remark" v-html="item.authorInfo.sign"></div>
|
||||
</div>
|
||||
<div style="padding-top:15px;width:70px;">
|
||||
<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>
|
||||
<followButton :auto="true" size="small" :aid="item.teacherId"></followButton>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -256,7 +255,7 @@
|
||||
</template>
|
||||
<script>
|
||||
import { mapGetters } from 'vuex';
|
||||
|
||||
import followButton from "@/components/Follow/button.vue";
|
||||
import portalHeader from "@/components/PortalHeader.vue";
|
||||
import portalFooter from "@/components/PortalFooter.vue";
|
||||
import comments from "@/components/Portal/comments.vue";
|
||||
@@ -311,7 +310,8 @@
|
||||
videoPlayer,
|
||||
myNote,
|
||||
noteComments,
|
||||
portalFooter
|
||||
portalFooter,
|
||||
followButton
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@@ -322,7 +322,6 @@
|
||||
notePlay: null,
|
||||
intTimeNote: '',
|
||||
courestab: 2,//默认是课程评论
|
||||
current_teacher_follow: false, // false - 已关注; true - 未关注
|
||||
curCFile: {
|
||||
converStatus: 4,
|
||||
},
|
||||
@@ -474,34 +473,6 @@
|
||||
}, 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;
|
||||
} else if(res.status == 400){
|
||||
this.$message.warning(res.message);
|
||||
this.current_teacher_follow = false;
|
||||
}else{
|
||||
this.$message.error(res.message);
|
||||
}
|
||||
})
|
||||
},
|
||||
//笔记组件触发,播放指定时间
|
||||
onPlayVideo(contentId,time){
|
||||
//这里需要根据contentId,是否切换到对应的内容的视频的时间
|
||||
@@ -922,13 +893,6 @@
|
||||
}
|
||||
});
|
||||
|
||||
// 检查是否已关注
|
||||
apiFollow.checkFllow(item.teacherId).then(res => {
|
||||
if (res.status == 200) {
|
||||
this.current_teacher_follow = res.result ? true : false;
|
||||
}
|
||||
})
|
||||
|
||||
});
|
||||
} else {
|
||||
//console.log('加载课程信息失败:'+res.error);
|
||||
|
||||
Reference in New Issue
Block a user