// tab3.page.ts import { Component } from '@angular/core'; import { ModalController, NavController } from '@ionic/angular'; // import { ModalUserLoginComponent } from 'fmode-ng'; import { ModalUserEditComponent } from '../../lib/user/modal-user-edit/modal-user-edit.component'; import { CloudApi, CloudUser } from 'src/lib/ncloud'; import { IonHeader, IonToolbar, IonTitle, IonContent, IonButton, IonIcon, IonCard, IonCardHeader, IonCardTitle, IonCardSubtitle, IonCardContent, IonGrid, IonRow, IonCol, IonList, IonItem, IonLabel, IonNote, IonBadge, IonAvatar, IonText, IonButtons } from '@ionic/angular/standalone'; import { addIcons } from 'ionicons'; import { settings, time, heart, create, chatbubbles, shieldCheckmark, documentText, logIn, logOut, personAdd } from 'ionicons/icons'; @Component({ selector: 'app-tab3', templateUrl: 'tab3.page.html', styleUrls: ['tab3.page.scss'], standalone: false, // imports: [ // IonHeader, // IonToolbar, // IonTitle, // IonContent, // IonButton, // IonIcon, // IonCard, // IonCardHeader, // IonCardTitle, // IonCardSubtitle, // IonCardContent, // IonGrid, // IonRow, // IonCol, // IonList, // IonItem, // IonLabel, // IonNote, // IonBadge, // IonAvatar, // IonText, // IonButtons // ] }) export class Tab3Page { currentUser: CloudUser | undefined; constructor(private navCtrl: NavController, private modalCtrl: ModalController) { this.currentUser = new CloudUser(); addIcons({ settings, time, heart, create, chatbubbles, shieldCheckmark, documentText, logIn, logOut, personAdd }); } handleAction(type: string) { switch(type) { case 'feedback': console.log('打开意见反馈'); break; case 'privacy': console.log('打开隐私政策'); break; case 'agreement': console.log('打开用户协议'); break; } } async login() { let user : any = new CloudUser(); user = await this.currentUser?.login("0224989","123456") if(user?.id){ this.currentUser = user; } } logout() { this.currentUser?.logout(); this.currentUser = undefined; } async edit(){ const modal = await this.modalCtrl.create({ component:ModalUserEditComponent, }); modal.present(); const {data,role} = await modal.onWillDismiss(); } goToRecords() { this.navCtrl.navigateForward(["tabs","tab3","page-records"]); console.log('Navigating to page-records'); } goToCollections() { this.navCtrl.navigateForward(["tabs","tab3","page-collections"]); console.log('Navigating to page-collections'); } goToDetail(recipeId: any) { // this.navCtrl.navigateForward(["tabs", "tab1", "page-detail", recipe.objectId]); this.navCtrl.navigateForward(`/tabs/tab1/page-detail/${recipeId}`); console.log('Navigating to page-detail'); } }