import { Component } from '@angular/core' ; import { NavController , ViewController } from 'ionic-angular' ; import { ChoseImgPage } from '../chose_img/chose_img' ; import { EditInfoPage } from '../edit_info/edit_info' ; import { AddressPage } from '../address/address' ; import { Helper } from '../helper/helper' ; import { EditSchoolPage } from '../edit_info/editschool' ; @ Component ( { templateUrl : 'build/pages/person_center/person_center.html' } ) export class PersonCenterPage { username : string = '' ; school : string = '' ; address : string = '' ; img_url : string = '' ; phone : string = '' ; helper : Helper ; constructor ( private nav , private viewCtrl ) { this . helper = new Helper ( nav ) ; } goBack ( ) { this . nav . pop ( ) ; } showChoseImgPage ( ) { this . nav . push ( ChoseImgPage ) ; } showEditInfoPage ( editType ) { this . nav . push ( EditInfoPage , { 'editType' : editType } ) ; } showAddressPage ( ) { this . nav . push ( AddressPage ) ; } ionViewDidEnter ( ) { let localData = JSON . stringify ( window . localStorage ) ; let localJson = eval ( "(" + localData + ")" ) ; this . address = localJson . floor_address ; this . phone = localJson . phone ; this . username = localJson . nick ; this . school = localJson . school_name ; this . img_url = 'http://119.29.140.85' + localJson . head_pic_url ; if ( this . username == '' || this . username == null ) { this . username = '未设置' ; } if ( this . address == '' || this . address == null ) { this . address = '未设置' ; } if ( this . phone == '' || this . phone == null ) { this . phone = '未设置' ; } if ( this . school == '' || this . school == null ) { this . school = '未设置' ; } if ( localJson . head_pic_url == '' || localJson . head_pic_url == null ) { this . img_url = 'images/user_head.jpg' ; } } updataPhone ( ) { this . helper . presentConfirm ( '暂不支持变更手机号码' ) ; } showEditSchoolPage ( ) { this . nav . push ( EditSchoolPage ) ; } ionViewWillEnter ( ) { this . viewCtrl . setBackButtonText ( '返回' ) ; let localData = JSON . stringify ( window . localStorage ) ; let localJson = eval ( "(" + localData + ")" ) ; this . img_url = 'http://119.29.140.85' + localJson . head_pic_url ; } }