| 
					
				 | 
			
			
				@@ -4,10 +4,12 @@ import { IonTextarea } from '@ionic/angular/standalone'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   ModalController, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   IonHeader,IonNote,IonChip, IonToolbar, IonTitle, IonButtons, IonButton, IonIcon, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  IonContent, IonCard, IonCardHeader, IonCardTitle, IonCardSubtitle, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  IonContent, IonCard, IonCardHeader, IonCardTitle, IonCardSubtitle,IonModal, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   IonCardContent, IonProgressBar, IonGrid, IonRow, IonCol, IonListHeader, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  IonLabel, IonList, IonItem, IonAvatar, IonBadge, IonFab, IonFabButton,IonSkeletonText 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  IonLabel, IonList, IonItem, IonAvatar, IonBadge, IonFab, IonFabButton,IonSkeletonText, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  IonInput,IonSelect, IonSelectOption 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } from '@ionic/angular/standalone'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import { FormsModule,ReactiveFormsModule } from '@angular/forms';  // 新增这行 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import { addIcons } from 'ionicons'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   notificationsOutline, calendarNumber, checkmarkCircle, ellipseOutline, 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -28,15 +30,29 @@ import { CloudObject, CloudQuery, CloudUser } from 'src/lib/ncloud'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   standalone: true, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   imports: [ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     CommonModule, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    FormsModule, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    ReactiveFormsModule,  // 新增这行 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     // IonTextarea, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     IonNote,IonChip, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     IonHeader, IonToolbar, IonTitle, IonButtons, IonButton, IonIcon, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    IonContent, IonCard, IonCardHeader, IonCardTitle, IonCardSubtitle, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    IonContent, IonCard, IonCardHeader, IonCardTitle, IonCardSubtitle,IonModal, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     IonCardContent, IonProgressBar, IonGrid, IonRow, IonCol, IonListHeader, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    IonLabel, IonList, IonItem, IonAvatar, IonBadge, IonFab, IonFabButton,IonSkeletonText 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    IonLabel, IonList, IonItem, IonAvatar, IonBadge, IonFab, IonFabButton,IonSkeletonText, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    IonInput,IonSelect, IonSelectOption,IonTextarea 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   ] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 export class Tab2Page { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+   // 添加这些新属性 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  isCreateModalOpen = false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  newPlan = { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    name: '', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    description: '', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    duration: '4', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    difficulty: '初级', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    goals: [] as string[], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    daysPerWeek: '3' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   openConsult(chatId?:string){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     localStorage.setItem("company","E4KpGvTEto") 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -335,5 +351,60 @@ export class Tab2Page { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   createNewPlan() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     console.log('创建新计划'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    this.isCreateModalOpen = true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    // 重置表单 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    this.newPlan = { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      name: '', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      description: '', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      duration: '4', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      difficulty: '初级', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      goals: [], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      daysPerWeek: '3' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    closeCreateModal() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    this.isCreateModalOpen = false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  async saveNewPlan() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    if (!this.newPlan.name.trim()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      console.error('计划名称不能为空'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    if (!this.currentUser?.id) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      console.error('用户未登录'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      const plan = new CloudObject('TrainingPlan'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+       
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      // 设置训练日安排 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      const schedule: Record<string, boolean> = {}; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      const days = ['monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sunday']; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      for (let i = 0; i < parseInt(this.newPlan.daysPerWeek); i++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        schedule[days[i]] = true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      plan.set({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        planName: this.newPlan.name, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        description: this.newPlan.description, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        durationInWeeks: parseInt(this.newPlan.duration), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        difficultyLevel: this.newPlan.difficulty, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        fitnessGoals: this.newPlan.goals, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        schedule: schedule, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        user: this.currentUser.toPointer(), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        isPublic: false 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      await plan.save(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      console.log('新计划创建成功:', plan.id); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+       
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      // 刷新计划列表 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      await this.loadTrainingPlans(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      this.isCreateModalOpen = false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } catch (error) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      console.error('保存计划失败:', error); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 |