import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams } from 'ionic-angular';
import {Response} from "@angular/http";
import {AppService} from "../../../service/appHttpService";
import {Badge} from "@ionic-native/badge";


@IonicPage()
@Component({
  selector: 'page-notice',
  templateUrl: 'notice.html',
})
export class NoticePage {

    noticeList;
  constructor(public navCtrl: NavController, public navParams: NavParams,
              public appService:AppService,public badge:Badge) {
  }

  ionViewDidEnter() {
      this.appService.ObserverHttpPost("/wisdomgroup/modules/message/findAllActivityForAppWithXQ",null)
          .subscribe((res: Response) => {
                  let data = res.json();
                    this.noticeList = data;
                  this.addRecodings();
              }, error => {
              }
          );
  }

    //增加阅读记录
    addRecodings(){
        this.appService.ObserverHttpGet("/wisdomgroup/modules/message/addRecodings", null)
            .subscribe((res: Response) => {
                    this.badge.clear();
                }, error => {
                }
            );
    }

}
