import {Component} from '@angular/core';
import {IonicPage, LoadingController, NavController, NavParams} from 'ionic-angular';
import {MineService} from "../mine/mine.service";
import {timer} from "rxjs/observable/timer";

@IonicPage()
@Component({
    selector: 'page-course',
    templateUrl: 'course.html',
})
export class CoursePage {
    navbarList = [
        {type: '2', name: '学习中'},
        {type: '1', name: '已完成'},
    ];

    page = {
        page: 1,
        pageSize: 10,
        studystate: 2,
        TotalItems: 0,
        load:false
    };

    courseList = [];

    constructor(public navCtrl: NavController, public navParams: NavParams, private mineSer: MineService,
                private loadCtrl: LoadingController) {
    }

    ionViewDidLoad() {
    }

    doRefresh(e) {
        this.page.page = 1;
        timer(1000).subscribe((res) => {
            e.complete()
        });
    }


    changeType(e) {
        this.page.page = 1;
        this.page.studystate = e.type;
        this.page.load = false;
    }
}


