import {Component} from '@angular/core';
import {IonicPage, NavController, NavParams, ViewController} from 'ionic-angular';
import {AppGlobal, AppService} from "../../../service/appHttpService";

@Component({
    selector: 'page-person-list',
    templateUrl: 'person-list.html',
})
export class PersonListPage {

    picture: string = AppGlobal.picture;
    perList;
    name = '';

    constructor(public navCtrl: NavController, public navParams: NavParams,
                public appService: AppService, public viewCtrl: ViewController) {
    }

    ionViewDidLoad() {
        this.getList();
    }

    getList() {
        const data = {
            name: this.name,
            pageNumber: 1,
            pageSize: 100,
        };
        this.appService.ObserverHttpNoForm('/wisdomgroup/app/getUserByName', data)
            .subscribe((res) => {
                this.perList = res.json().list;
            })
    }

    dismiss() {
        this.viewCtrl.dismiss();
    }

    sure(item) {
        this.viewCtrl.dismiss(item);
    }

}
