<!--我的收藏-->
<template>
    <div>
        <WaterfallFlow
                :videoList="VideoList"
                @load="GetCollectionList"
                :options="{
                                    isLoading:loading,
                                    finished:finished,
                                }"
                @click="jumpTo"
        ></WaterfallFlow>
    </div>
</template>

<script>
    import WaterfallFlow from '@/components/WaterfallFlow.vue';
    export default {
        name: "MyCollection",
        components: {WaterfallFlow},
        data(){
            return{
                pageSize: 10,
                pageIndex:1,
                loading: false,
                finished: false,
                VideoList:[]
            }
        },
        created() {
        },
        methods:{
            // 获取收藏视频列表
            GetCollectionList() {
                var obj = {
                    name: '',
                    pageIndex: this.pageIndex,
                    pageSize: this.pageSize,
                }
                this.loading = true;
                this.$http.GetCollectionList(obj).then(({data}) => {
                    this.loading = false;
                    if (data.IsSuccess) {
                        this.VideoList = data.ResultObject.concat(this.VideoList);
                        this.pageIndex++;
                        if (data.ResultObject.length < this.pageSize) {
                            this.finished = true;
                        }
                    } else {
                        this.$toast(data.ResultMsg)
                    }
                })
            },

            // 点击视频跳转
            jumpTo(id) {
                this.$router.push({ name: "healthCourse", query: { id } });
            },
        }
    }
</script>

<style scoped>

</style>
