import { Component } from '@angular/core' ; import { NavController , Alert , LocalStorage , Storage } from 'ionic-angular' ; import { PersonCenterPage } from '../person_center/person_center' ; import { ApplyIdentiPage } from '../apply_identi/apply_identi' ; import { TastAppealPage } from '../tast_appeal/tast_appeal' ; import { SafariViewController } from 'ionic-native' ; import { Helper } from '../helper/helper' ; import { LoginPage } from '../login/login' ; @ Component ( { templateUrl : 'build/pages/contact/contact.html' } ) export class ContactPage { img_url : string = '' ; helper : Helper ; local : Storage ; constructor ( private nav ) { this . helper = new Helper ( nav ) ; this . local = new Storage ( LocalStorage ) ; } showBaseInfo ( ) { this . nav . push ( PersonCenterPage ) ; } showApplyIdenti ( ) { this . nav . push ( ApplyIdentiPage ) ; } showTastAppeal ( ) { this . nav . push ( TastAppealPage ) ; } showAboutShunDai ( ) { this . showBrawa ( ) ; } showBrawa ( ) { SafariViewController . isAvailable ( ) . then ( ( available ) => { if ( available ) { SafariViewController . show ( { url : 'http://119.29.140.85/' , hidden : false , animated : false , transition : 'curl' , enterReaderModeIfAvailable : true , tintColor : '#ff0000' } ) . then ( ( result ) => { if ( result . event === 'opened' ) console . log ( 'Opened' ) ; else if ( result . event === 'loaded' ) console . log ( 'Loaded' ) ; else if ( result . event === 'closed' ) console . log ( 'Closed' ) ; } , ( error ) => console . error ( error ) ) ; } else { window . open ( "http://119.29.140.85/" , '_blank' , 'location=yes' ) ; } } ) ; } ionViewDidEnter ( ) { console . log ( 'sssss' ) ; let localData = JSON . stringify ( window . localStorage ) ; let localJson = eval ( "(" + localData + ")" ) ; this . img_url = 'http://119.29.140.85' + localJson . head_pic_url ; if ( localJson . head_pic_url == '' || localJson . head_pic_url == null ) { this . img_url = 'images/user_head.jpg' ; } } exit ( ) { let confirm = Alert . create ( { title : '提示' , message : '是否退出应用程序!' , buttons : [ { text : '取消' , handler : ( ) => { } } , { text : '确认' , handler : ( ) => { this . local . clear ( ) ; this . nav . setPages ( [ { page : LoginPage } ] , { animate : true } ) ; } } ] } ) ; this . nav . present ( confirm ) ; } }