import {Component} from '@angular/core';
import {IonicPage, NavController, NavParams} from 'ionic-angular';
import {NewsService} from "./news.service";
import * as Mock from "mockjs";
import {DealPage} from "../deal/deal";
import {DoSupervisePage} from "../home/do-supervise/do-supervise";
import {DealDetailPage} from "../deal/deal-detail/deal-detail";

@IonicPage()
@Component({
    selector: 'page-news',
    templateUrl: 'news.html',
})
export class NewsPage {
    newList = [];

    constructor(public navCtrl: NavController, public navParams: NavParams,
                private newSer: NewsService) {
    }

    ionViewDidLoad() {
        this.getList();
    }

    getList() {
        const data = {
            page:1,
            limit:10
        };
        this.newSer.noticeSearch(data).subscribe(
            (res) => {
                this.newList = res.page.list.notice;
            }
        )
    }

    goDetail(item) {
        if (item.title == "督办提醒") {
            this.navCtrl.push(DealDetailPage, {"type": "db", "item": item});
        }
        if (item.title == "待办提醒") {
            this.navCtrl.push(DealDetailPage, {"item": item});
        }
    }

}
