<template>
    <div>
        <WaterfallFlow
                :videoList="VideoList"
                @load="GetMyList"
                :options="{
                                    isLoading:loading,
                                    finished:finished,
                                }"
                @click="jumpTo"
        ></WaterfallFlow>
    </div>
</template>

<script>
    import WaterfallFlow from '@/components/WaterfallFlow.vue';
    export default {
        name: "MyPayVideo",
        components: {WaterfallFlow},
        data(){
            return{
                pageSize: 10,
                pageIndex:1,
                loading: false,
                finished: false,
                VideoList:[],
            }
        },
        created() {

        },
        methods:{

            // 获取我购买的视频列表
            GetMyList() {
                var obj = {
                    typeid: '',
                    name: '',
                    doctorid: '',
                    status: -1,
                    pageIndex: this.pageIndex,
                    pageSize: this.pageSize,
                }
                this.loading = true;
                this.$http.GetMyList(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>
