tabs.page.ts 635 B

123456789101112131415161718192021222324
  1. import { Component } from '@angular/core';
  2. import { NavController } from '@ionic/angular';
  3. import * as Parse from "parse";
  4. @Component({
  5. selector: 'app-tabs',
  6. templateUrl: 'tabs.page.html',
  7. styleUrls: ['tabs.page.scss']
  8. })
  9. export class TabsPage {
  10. constructor(private navCtrl: NavController) {}
  11. async checkLogin() {
  12. const currentUser = Parse.User.current();
  13. if (currentUser) {
  14. // 如果已登录,跳转到“我的”界面
  15. this.navCtrl.navigateForward('/tabs/tab3');
  16. } else {
  17. // 如果未登录,跳转到“登录”界面
  18. this.navCtrl.navigateForward('/tabs/calendar');
  19. }
  20. }
  21. }