Skip to content
tabs.ts 2.2 KiB
Newer Older
wangqinghua's avatar
wangqinghua committed
import { Component, Renderer, ElementRef, ViewChild } from '@angular/core';
import {NavParams, NavController, AlertController, Events, Tabs, Platform} from 'ionic-angular';
wangqinghua's avatar
wangqinghua committed

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

import { Storage } from '@ionic/storage';
import { AppService, AppGlobal } from '../../service/appHttpService';
wangqinghua's avatar
wangqinghua committed
import {NoticePage} from "./notice/notice";
import {BackButtonService} from "../../service/backButton.service";
wangqinghua's avatar
wangqinghua committed

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

  tabRoots: Object[];

  userInfo: any;

  userid: string;

  roleflag: any;
wangqinghua's avatar
wangqinghua committed
  tabsIndex;
wangqinghua's avatar
wangqinghua committed
  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,
    private backButtonService:BackButtonService,
    public platform:Platform,
wangqinghua's avatar
wangqinghua committed
  ) {
    this.tabRoots = [{
      root: HomePage,
      tabTitle: '首页',
wangqinghua's avatar
wangqinghua committed
      tabIconOn: 'custom-home-on',
      tabIconOff: 'custom-home-off',
        index:0
wangqinghua's avatar
wangqinghua committed
    }, {
      root: ContactPage,
      tabTitle: '通讯录',
wangqinghua's avatar
wangqinghua committed
        tabIconOn: 'custom-contact-on',
        tabIconOff: 'custom-contact-off',
        index:1
wangqinghua's avatar
wangqinghua committed
    }, {
wangqinghua's avatar
wangqinghua committed
      root: NoticePage,
      tabTitle: '消息',
wangqinghua's avatar
wangqinghua committed
      tabIconOn: 'custom-notice-on',
        tabIconOff: 'custom-notice-off',
        index:2
wangqinghua's avatar
wangqinghua committed
    }, {
      root: MinePage,
      tabTitle: '我的',
wangqinghua's avatar
wangqinghua committed
        tabIconOn: 'custom-owner-on',
        tabIconOff: 'custom-owner-off',
        index:3
wangqinghua's avatar
wangqinghua committed
    }];

      this.platform.ready().then(() => {
          this.backButtonService.registerBackButtonAction(this.myTabs);
      });

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

  }

wangqinghua's avatar
wangqinghua committed

    onChange(e){
      this.tabsIndex =e;
wangqinghua's avatar
wangqinghua committed
      this.myTabs.select(e);
wangqinghua's avatar
wangqinghua committed
    }
wangqinghua's avatar
wangqinghua committed
}