import {Component, EventEmitter, Input, Output} from '@angular/core';
import {AppService} from "../../app/app.service";
import {EmitService} from "../../core/emit.service";
import {ModalController, NavController} from "ionic-angular";
import {FileService} from "../../core/file.service";
import {CommonService} from "../../core/common.service";
import {timer} from "rxjs/observable/timer";
import {DownloadFileProvider} from "../../providers/download-file/download-file";

/**
 * 树结构
 * 组件嵌套
 */

@Component({
    selector: 'tree-list',
    templateUrl: 'tree-list.html'
})
export class TreeListComponent {
    @Input() treeList = [];
    @Input() IsBuy = [];
    @Input() TeachTypeName;
    @Output() fileData = new EventEmitter<any>();

    isSign = false;
    nowTime;

    constructor(private appSer: AppService, private eventSer: EmitService, private modalCtrl: ModalController,
                private fileSer: FileService, private commonSer: CommonService,
                private navCtrl: NavController,
                private downloadPro: DownloadFileProvider) {
        timer(10).subscribe(
            (res) => {
                this.treeList.forEach(e => e.show = true);
            }
        )
        this.nowTime = new Date().getTime();

    }

    openPDF(file) {

    }

    //文件处理
    handle(file, event) {

    }

    getTime(time) {
        return new Date(time).getTime();
    }

    //下载文件
    downLoad(file, e) {

    }

    getMore(e) {
        e.show = !e.show;
    }

}
