flowaaa há 5 meses atrás
pai
commit
2332f6878c

+ 3 - 3
app-angular/src/modules/user/page-add/page-add.component.html

@@ -37,7 +37,7 @@
             <ion-toolbar>
               <ion-title>请选择</ion-title>
               <ion-buttons slot="end">
-                <ion-button color="black" (click)="modal.dismiss()">完成</ion-button>
+                <ion-button color="black" (click)="dismissModal()">完成</ion-button>
               </ion-buttons>
             </ion-toolbar>
             <ion-datetime-button datetime="datetime" style="width: 100%;"></ion-datetime-button>
@@ -125,7 +125,7 @@
             <ion-toolbar>
               <ion-title>请选择</ion-title>
               <ion-buttons slot="end">
-                <ion-button (click)="modal.dismiss()">完成</ion-button>
+                <ion-button color="black" (click)="dismissModal()">完成</ion-button>
               </ion-buttons>
             </ion-toolbar>
           </ion-header>
@@ -213,7 +213,7 @@
           <ion-toolbar>
             <ion-title>重置</ion-title>
             <ion-buttons slot="end">
-              <ion-button color="black" (click)="modal.dismiss()">完成</ion-button>
+              <ion-button color="black" (click)="dismissModal()">完成</ion-button>
             </ion-buttons>
           </ion-toolbar>
           <ion-datetime-button datetime="datetime" style="width: 100%;"></ion-datetime-button>

+ 13 - 5
app-angular/src/modules/user/page-add/page-add.component.ts

@@ -1,7 +1,7 @@
 import { Component } from '@angular/core';
 import { Router } from '@angular/router';
 import * as Parse from "parse";
-import { CheckboxCustomEvent } from '@ionic/angular';
+import { CheckboxCustomEvent,ModalController } from '@ionic/angular';
 
 @Component({
   selector: 'app-page-add',
@@ -18,10 +18,13 @@ export class PageAddComponent {
   selectedImage: string | ArrayBuffer | null = null;
   canDismiss = false;
   presentingElement: Element | null = null;
+  modalController: ModalController;
 
-  constructor(
+  constructor(modalController: ModalController,
     private router: Router
-  ) {}
+
+  ) {    this.modalController = modalController;
+  }
 
   ngOnInit() {
     this.presentingElement = document.querySelector('.ion-page');
@@ -45,7 +48,9 @@ export class PageAddComponent {
       console.error('Error while saving new contact', error);
     }
   }
-
+  saveBack(){
+    this.router.navigate(['/lesson/me/add']); // 导航到联系人列表页面
+  }
   onFileSelected(event: Event) {
     const inputElement = event.target as HTMLInputElement;
     if (inputElement.files && inputElement.files[0]) {
@@ -58,7 +63,10 @@ export class PageAddComponent {
       reader.readAsDataURL(file);
     }
   }
-
+  dismissModal() {
+    this.modalController.dismiss();
+  }
+  
   onTermsChanged(event: Event) {
     const ev = event as CheckboxCustomEvent;
     this.canDismiss = ev.detail.checked;