Skip to content
personInfo.ts 1.93 KiB
Newer Older
wangqinghua's avatar
wangqinghua committed
import {Component} from '@angular/core';
import {IonicPage, NavController, ToastController} from 'ionic-angular';
wangqinghua's avatar
wangqinghua committed

wangqinghua's avatar
wangqinghua committed
import {ModifyPasswordPage} from "../../modifyPassword/modifyPassword";
import {Storage} from '@ionic/storage';
import {AppGlobal, AppService} from "../../../service/appHttpService";
import {EditPersonInfoPage} from '../editPersonInfo/editPersonInfo';
wangqinghua's avatar
wangqinghua committed

@IonicPage()
@Component({
wangqinghua's avatar
wangqinghua committed
    selector: 'page-personInfo',
    templateUrl: 'personInfo.html'
wangqinghua's avatar
wangqinghua committed
})

export class PersonInfoPage {
wangqinghua's avatar
wangqinghua committed
    orgName = '';
    user: any;
    gender: object;
    //userInfo: object ;
    userid: '';
    picture: string = AppGlobal.picture;
wangqinghua's avatar
wangqinghua committed

wangqinghua's avatar
wangqinghua committed
    constructor(public navCtrl: NavController,
                public storage: Storage,
                public appService: AppService,
                public toast: ToastController) {
wangqinghua's avatar
wangqinghua committed

wangqinghua's avatar
wangqinghua committed
    }
wangqinghua's avatar
wangqinghua committed

wangqinghua's avatar
wangqinghua committed
    //ionViewDidLoad():void{
    ionViewWillEnter(): void {
        this.user = this.storage.get("user").then((value) => {
            this.user = value;
            console.log(this.user);
            console.log("id1:" + this.user.id);
            this.gender = this.user.userDetail.user.gender;
            console.log("gender:" + this.gender);
            this.getOrgName(this.user.id, result => {
                let data = result;
                this.orgName = data["orgName"];
            });
        });
    }
wangqinghua's avatar
wangqinghua committed

wangqinghua's avatar
wangqinghua committed
    modifyPwd() {
        this.navCtrl.push("ModifyPasswordPage")
    }

    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 => {
            });
    }

    //不同的code代表修改不同的数据,1房间,2座机,3邮箱
    edit(code) {
        this.navCtrl.push("EditPersonInfoPage", {code: code});
    }

    goBack() {
        this.navCtrl.popToRoot();
    }
wangqinghua's avatar
wangqinghua committed

}