|
@@ -1,15 +1,106 @@
|
|
|
import { Component, OnInit } from '@angular/core';
|
|
|
+import {
|
|
|
+ IonButton,
|
|
|
+ IonCard,
|
|
|
+ IonCardHeader,
|
|
|
+ IonCardSubtitle,
|
|
|
+ IonCardTitle,
|
|
|
+ IonCol,
|
|
|
+ IonContent,
|
|
|
+ IonGrid,
|
|
|
+ IonHeader,
|
|
|
+ IonInput,
|
|
|
+ IonItem,
|
|
|
+ IonList,
|
|
|
+ IonRow,
|
|
|
+ IonTextarea,
|
|
|
+ IonTitle,
|
|
|
+ IonToolbar,
|
|
|
+} from '@ionic/angular/standalone';
|
|
|
|
|
|
@Component({
|
|
|
selector: 'app-aiplan-page',
|
|
|
templateUrl: './aiplan-page.component.html',
|
|
|
styleUrls: ['./aiplan-page.component.scss'],
|
|
|
standalone: true,
|
|
|
+ imports: [
|
|
|
+ IonHeader,
|
|
|
+ IonTitle,
|
|
|
+ IonToolbar,
|
|
|
+ IonCard,
|
|
|
+ IonContent,
|
|
|
+ IonList,
|
|
|
+ IonItem,
|
|
|
+ IonInput,
|
|
|
+ IonCardHeader,
|
|
|
+ IonCardTitle,
|
|
|
+ IonCardSubtitle,
|
|
|
+ IonTextarea,
|
|
|
+ IonButton,
|
|
|
+ IonGrid,
|
|
|
+ IonRow,
|
|
|
+ IonCol,
|
|
|
+ ],
|
|
|
})
|
|
|
-export class AiplanPageComponent implements OnInit {
|
|
|
-
|
|
|
- constructor() { }
|
|
|
+export class AiplanPageComponent implements OnInit {
|
|
|
+ constructor() {}
|
|
|
|
|
|
ngOnInit() {}
|
|
|
|
|
|
+ trainingType: string = '';
|
|
|
+ weight: number = NaN;
|
|
|
+ trainingTime: number = NaN;
|
|
|
+ trainingIntensity: string = '';
|
|
|
+ trainingSite: string = '';
|
|
|
+ needs: string = '';
|
|
|
+ reset() {
|
|
|
+ // 重置表单数据(有问题)
|
|
|
+ // this.trainingType = '';
|
|
|
+ // this.weight = NaN;
|
|
|
+ // this.trainingTime = NaN;
|
|
|
+ // this.trainingIntensity = '';
|
|
|
+ // this.trainingSite = '';
|
|
|
+ // this.needs = '';
|
|
|
+
|
|
|
+ // 重置表单数据(无错误)
|
|
|
+ let ipts = document.querySelectorAll('ion-input');
|
|
|
+ let textarea = document.querySelectorAll('ion-textarea');
|
|
|
+ ipts.forEach((ipt) => {
|
|
|
+ ipt.value = '';
|
|
|
+ });
|
|
|
+ textarea.forEach((text) => {
|
|
|
+ text.value = '';
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ submit() {
|
|
|
+ // 提交表单数据
|
|
|
+ // let data = {
|
|
|
+ // trainingType: this.trainingType,
|
|
|
+ // weight: this.weight,
|
|
|
+ // trainingTime: this.trainingTime,
|
|
|
+ // trainingIntensity: this.trainingIntensity,
|
|
|
+ // trainingSite: this.trainingSite,
|
|
|
+ // needs: this.needs,
|
|
|
+ // };
|
|
|
+ let ipts = document.querySelectorAll('ion-input');
|
|
|
+ let textarea = document.querySelectorAll('ion-textarea');
|
|
|
+ let userinputs = '';
|
|
|
+ ipts.forEach((ipt) => {
|
|
|
+ userinputs += ipt.value + ' ';
|
|
|
+ });
|
|
|
+ textarea.forEach((text) => {
|
|
|
+ userinputs += text.value + ' ';
|
|
|
+ });
|
|
|
+ let userinputlist = userinputs.split(' ');
|
|
|
+ let data = {
|
|
|
+ trainingType: userinputlist[0],
|
|
|
+ weight: userinputlist[1],
|
|
|
+ trainingTime: userinputlist[2],
|
|
|
+ trainingIntensity: userinputlist[3],
|
|
|
+ trainingSite: userinputlist[4],
|
|
|
+ needs: userinputlist[5],
|
|
|
+ };
|
|
|
+ console.log(data);
|
|
|
+ }
|
|
|
}
|