Newer
Older
import { Component} from '@angular/core';
import { IonicPage, NavController, NavParams} from 'ionic-angular';
import { Response } from '@angular/http';
import { AppService } from '../../service/appHttpService';
import { AnnouncementViewPage } from '../announcementView/announcementView';
@IonicPage()
@Component({
selector: 'page-announcement',
templateUrl: 'announcement.html'
})
export class AnnouncementPage {
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
constructor(
public navCtrl: NavController,
public navParams: NavParams,
public appService: AppService
) {
}
ionViewWillEnter() {
//加载通知公告
this.getAllNoticeAboutMe();
this.addRecodings();
}
goView(id, isRead) {
if (!isRead) {
this.createRecording(id);
}
this.navCtrl.push("AnnouncementViewPage", {
id: id
});
}
//获取所有关于我的通知公告
getAllNoticeAboutMe() {
this.appService.ObserverHttpPost("/wisdomgroup/modules/notice/getAllNotice", null)
.subscribe((res: Response) => {
let data = res.json();
console.log(data);
this.allNotice = data;
}, error => {
this.appService.alert('网络异常!');
}
);
}
//如果是未读状态,增加阅读记录
createRecording(id) {
this.appService.ObserverHttpPost("/wisdomgroup/modules/notice/createRecording", { id: id })
.subscribe((res: Response) => {
}, error => {
this.appService.alert('网络异常!');
}
);
}
goBack(){
this.navCtrl.popToRoot();
}
//增加阅读记录
addRecodings(){
this.appService.ObserverHttpGet("/wisdomgroup/modules/notice/addRecodings", null)
.subscribe((res: Response) => {
}, error => {
this.appService.alert('网络异常!');
}
);
}
}