|
@@ -1,8 +1,9 @@
|
|
-// test-page.component.ts
|
|
|
|
import { Component, OnInit } from '@angular/core';
|
|
import { Component, OnInit } from '@angular/core';
|
|
import { IonicModule } from '@ionic/angular';
|
|
import { IonicModule } from '@ionic/angular';
|
|
import { FormsModule } from '@angular/forms';
|
|
import { FormsModule } from '@angular/forms';
|
|
import { TagInputComponent } from '../tag-input/tag-input.component';
|
|
import { TagInputComponent } from '../tag-input/tag-input.component';
|
|
|
|
+import { addIcons } from 'ionicons';
|
|
|
|
+import { barbellOutline, personOutline, square, alarmOutline } from 'ionicons/icons';
|
|
|
|
|
|
@Component({
|
|
@Component({
|
|
selector: 'app-test-page',
|
|
selector: 'app-test-page',
|
|
@@ -12,34 +13,58 @@ import { TagInputComponent } from '../tag-input/tag-input.component';
|
|
imports: [IonicModule, FormsModule, TagInputComponent] // 导入必要的模块
|
|
imports: [IonicModule, FormsModule, TagInputComponent] // 导入必要的模块
|
|
})
|
|
})
|
|
export class TestPageComponent implements OnInit {
|
|
export class TestPageComponent implements OnInit {
|
|
-
|
|
|
|
selectedTags: string[] = []; // 用来存储选择的标签
|
|
selectedTags: string[] = []; // 用来存储选择的标签
|
|
exercisePreference: string = ''; // 锻炼方式偏好
|
|
exercisePreference: string = ''; // 锻炼方式偏好
|
|
workoutFrequency: string = ''; // 每周锻炼频率
|
|
workoutFrequency: string = ''; // 每周锻炼频率
|
|
height: number | null = null; // 身高
|
|
height: number | null = null; // 身高
|
|
weight: number | null = null; // 体重
|
|
weight: number | null = null; // 体重
|
|
age: number | null = null; // 年龄
|
|
age: number | null = null; // 年龄
|
|
|
|
+ goalDescription: string = ''; // 目标描述,用来绑定文本域内容
|
|
|
|
|
|
- constructor() { }
|
|
|
|
|
|
+ constructor() {
|
|
|
|
+ addIcons({ personOutline, barbellOutline, alarmOutline, square });
|
|
|
|
+ }
|
|
|
|
|
|
ngOnInit() { }
|
|
ngOnInit() { }
|
|
|
|
|
|
- // 处理标签变化事件
|
|
|
|
onTagsChanged(tags: string[]) {
|
|
onTagsChanged(tags: string[]) {
|
|
this.selectedTags = tags;
|
|
this.selectedTags = tags;
|
|
console.log('当前标签:', this.selectedTags);
|
|
console.log('当前标签:', this.selectedTags);
|
|
}
|
|
}
|
|
|
|
|
|
- // 生成健身计划的按钮点击处理
|
|
|
|
|
|
+ onGoalDescriptionChange(event: any) {
|
|
|
|
+ this.goalDescription = event.detail.value;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ onExercisePreferenceChange(event: any) {
|
|
|
|
+ this.exercisePreference = event.detail.value;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ onWorkoutFrequencyChange(event: any) {
|
|
|
|
+ this.workoutFrequency = event.detail.value;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ onHeightChange(event: any) {
|
|
|
|
+ this.height = event.detail.value;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ onWeightChange(event: any) {
|
|
|
|
+ this.weight = event.detail.value;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ onAgeChange(event: any) {
|
|
|
|
+ this.age = event.detail.value;
|
|
|
|
+ }
|
|
|
|
+
|
|
generatePlan() {
|
|
generatePlan() {
|
|
- // 这里可以处理生成计划的逻辑
|
|
|
|
console.log('生成健身计划', {
|
|
console.log('生成健身计划', {
|
|
tags: this.selectedTags,
|
|
tags: this.selectedTags,
|
|
exercisePreference: this.exercisePreference,
|
|
exercisePreference: this.exercisePreference,
|
|
workoutFrequency: this.workoutFrequency,
|
|
workoutFrequency: this.workoutFrequency,
|
|
height: this.height,
|
|
height: this.height,
|
|
weight: this.weight,
|
|
weight: this.weight,
|
|
- age: this.age
|
|
|
|
|
|
+ age: this.age,
|
|
|
|
+ goalDescription: this.goalDescription
|
|
});
|
|
});
|
|
}
|
|
}
|
|
}
|
|
}
|