import { Component, Renderer, ElementRef, ViewChild } from '@angular/core';
import {NavParams, NavController, AlertController, Events, Tabs} from 'ionic-angular';

import { ContactPage } from './contact/contact';
import { HomePage } from './home/home';
import { MinePage } from './mine/mine';

import { Storage } from '@ionic/storage';

import { ModifyPasswordPage } from '../mine/person/modifyPassword/modifyPassword';
import { AppService, AppGlobal } from '../../service/appHttpService';
import {NoticePage} from "./notice/notice";

@Component({
  templateUrl: 'tabs.html'
})
export class TabsPage {
  @ViewChild('myTabs') myTabs:Tabs;

  tabRoots: Object[];

  userInfo: any;

  userid: string;

  roleflag: any;
  tabsIndex;
  role: any;
  constructor(
    public navCtrl: NavController,
    public navParams: NavParams,
    public alertCtrl: AlertController,
    public storage: Storage,
    public event: Events,
    public render: Renderer,
    public elementRef: ElementRef,
    public appService: AppService
  ) {
    this.tabRoots = [{
      root: HomePage,
      tabTitle: '首页',
      tabIconOn: 'custom-home-on',
      tabIconOff: 'custom-home-off',
        index:0
    }, {
      root: ContactPage,
      tabTitle: '通讯录',
        tabIconOn: 'custom-contact-on',
        tabIconOff: 'custom-contact-off',
        index:1
    }, {
      root: NoticePage,
      tabTitle: '消息',
      tabIconOn: 'custom-notice-on',
        tabIconOff: 'custom-notice-off',
        index:2
    }, {
      root: MinePage,
      tabTitle: '我的',
        tabIconOn: 'custom-owner-on',
        tabIconOff: 'custom-owner-off',
        index:3
    }];

    //判断是否密码为初始六个0
    // this.userInfo = this.storage.get("userLoginInfo").then((value) => {
    //   this.userInfo = value;
    //   if (this.userInfo.password == '000000') {
    //     //进入修改密码页面
    //     this.navCtrl.push("ModifyPasswordPage")
    //   }
    // });

  }


    onChange(e){
      this.tabsIndex =e;
      this.myTabs.select(e);
    }
}
