Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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
78
79
80
81
import {Component} from '@angular/core';
import {IonicPage, NavController, NavParams} from 'ionic-angular';
import {Response} from '@angular/http';
import {AppGlobal, AppService} from '../../../../service/http.service';
import {AnnouncementViewPage} from '../announcementView/announcementView';
@IonicPage()
@Component({
selector: 'page-announcement',
templateUrl: 'announcement.html'
})
export class AnnouncementPage {
allNotice = [];
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();
data.forEach(event=>{
if(event.title.length > 14){
event.title = event.title.substring(0,14) +"...";
}
let src = event.noticeContent.split('src="');
event.noticeContent = src.join('src="' + AppGlobal.pictureNotice);
});
this.allNotice = data;
}, error => {
}
);
}
//如果是未读状态,增加阅读记录
createRecording(id) {
this.appService.ObserverHttpPost("/wisdomgroup/modules/notice/createRecording", {id: id})
.subscribe((res: Response) => {
}, error => {
}
);
}
goBack() {
this.navCtrl.popToRoot();
}
//增加阅读记录
addRecodings() {
this.appService.ObserverHttpGet("/wisdomgroup/modules/notice/addRecodings", null)
.subscribe((res: Response) => {
}, error => {
}
);
}
}