Newer
Older
import {Component} from '@angular/core';
import {App, NavController, AlertController, NavParams} from 'ionic-angular';
import {LoginPage} from '../../login/login';
import {AppGlobal, AppService} from '../../../service/http.service';
import {PersonInfoPage} from '../../mine/person/personInfo/personInfo';
import {MyActivityListPage} from '../../mine/myActivityList/myActivityList';
import {MyReportPage} from '../../mine/myReport/myReport';
import {OperationListPage} from '../../mine/operation-list/operation-list';
import {VersionPage} from '../../version/version';
import {Response} from '@angular/http';
import {Storage} from '@ionic/storage';
import {AppVersion} from '@ionic-native/app-version';
import {AppUpdateService} from "../../../service/appUpdate.service";
import {MyDutyPage} from "../../mine/my-duty/my-duty";
import {MySurveyPage} from "../../home/mySurvey/my-survey/my-survey";
import {EmitService} from "../../../provide/emit.service";
import {NoticePage} from "../notice/notice";
@Component({
selector: 'page-mine',
templateUrl: 'mine.html',
})
export class MinePage {
orgName: '';
gender: object;
version: string = '';
isLatest: boolean = true;
picture: string = AppGlobal.picture;
constructor(public navCtrl: NavController,
private appCtrl: App,
private alertCtrl: AlertController,
public navParams: NavParams,
public storage: Storage,public app:App,
private appUpdateService: AppUpdateService,
private appVersion: AppVersion) {
// 接收发射过来的数据
this.emitSer.eventEmit.subscribe((value: any) => {
if(!isNaN(value)){
this.noReadNum = value;
}
});
}
ionViewWillEnter() {
this.user = this.storage.get("user").then((value) => {
this.user = value;
this.picUrl = this.user.userDetail.user.picUrl;
console.log(value)
this.getversion();
this.tabSer.getUserIntegral().subscribe(
(res)=>{
this.mineInfo = res.data;
}
)
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
getOrgName(id, callback?): any {
this.appService.ObserverHttpPost("/wisdomgroup/app/getOrgName", {"userid": id})
.toPromise()
.then(res => {
var data = res.json();
callback(data == null ? "[]" : data);
})
.catch(error => {
});
}
personInfo() {
this.navCtrl.push("PersonInfoPage");
}
//我的活动
myActivityList() {
this.navCtrl.push("MyActivityListPage");
}
//我的报备
myReport() {
this.navCtrl.push("MyReportPage");
}
//操作记录
myOperationList() {
this.navCtrl.push("OperationListPage");
}
//我的问卷
mySurvey() {
this.navCtrl.push('MySurveyPage');
}
//后台退出
logoutApp() {
this.appService.ObserverHttpGet("/wisdomgroup/app/logout", null)
.subscribe((res: Response) => {
let data = res.json();
}, error => {
}
);
}
//获取最新版本信息
getversion() {
//检测是否需要更新
this.appVersion.getVersionNumber().then((version: string) => {
this.version = version;
this.appUpdateService.compariVersion().subscribe(data => {
if (data.code == 200) {
if (data.latestVersion != null && data.latestVersion != version) {
this.isLatest = false;
}
}
});
}).catch(err => {
});
}
goSet() {
// this.app.getRootNav().push('VersionPage');
this.navCtrl.push('VersionPage');
//消息提醒页面
goToNotice(){
this.navCtrl.push(NoticePage);
}