1、在Tabspage需要转向登录tab添加事件
@ViewChild(‘myTabs’) tabRef: Tabs;
constructor(public http:HttpSerProvider,
public modalCtrl:ModalController,
public params:NavParams) {
this.lgSuccess=params.get("lgSuccess");
}
ionViewDidLoad() {
//登录成功跳转个人中心
if(this.lgSuccess=="1"){
this.tabRef.select(3);
}
}
changeTabUser(){
if(!this.http.isLogin()){
this.tabRef.select(this.tabIndex); //切换之前所在的tab
console.log("no login");
let modal = this.modalCtrl.create('LoginPage');
modal.present();
}
}
2、登录成功后处理
self.http.toast("登录成功",function () {
self.viewCtrl.dismiss(false);
self.appCtrl.getRootNavs()[0].push(TabsPage,{"lgSuccess":"1"});
});