| 
					
				 | 
			
			
				@@ -7,18 +7,52 @@ import { addIcons } from 'ionicons'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import { barbellOutline, personOutline, square, alarmOutline, arrowBack } from 'ionicons/icons'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import { DalleOptions, FmodeChatCompletion, MarkdownPreviewModule } from 'fmode-ng'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import { LoadingController } from '@ionic/angular'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import { AlertController } from '@ionic/angular/standalone'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import { AlertController, IonThumbnail, IonBadge, IonButton, IonButtons, IonCard, IonCardContent, IonCardHeader, IonCardSubtitle, IonCardTitle, IonCol, IonContent, IonGrid, IonHeader, IonIcon, IonImg, IonInput, IonItem, IonLabel, IonList, IonRow, IonSegment, IonSegmentButton, IonSelect, IonSelectOption, IonToolbar, IonTitle, IonSpinner, IonTextarea } from '@ionic/angular/standalone'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import { NavController } from '@ionic/angular'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import { Router } from '@angular/router'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import { CloudObject, CloudQuery, CloudUser } from 'src/lib/ncloud'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import { extractAllJsonFromString } from '../agent/agent.json'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import { IonBackButton } from '@ionic/angular/standalone'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 @Component({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   selector: 'app-test-page', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   templateUrl: './test-page.component.html', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   styleUrls: ['./test-page.component.scss'], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   standalone: true, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  imports: [IonicModule, FormsModule, CommonModule, TagInputComponent, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    // 引入fm-markdown-preview组件模块 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    MarkdownPreviewModule]  // 添加 CommonModule 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  imports: [ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    IonTextarea, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    IonSpinner, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    IonTitle, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    IonBackButton, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    MarkdownPreviewModule, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    IonSelectOption, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    IonSelect, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    IonThumbnail, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    IonCardSubtitle, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    IonImg, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    IonCard, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    IonCardTitle, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    IonCardHeader, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    IonCardContent, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    IonButtons, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    IonItem, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    IonList, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    IonIcon, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    FormsModule, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    CommonModule, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    IonHeader, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    IonToolbar, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    IonContent, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    IonSegment, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    IonSegmentButton, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    IonGrid, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    IonRow, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    IonCol, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    IonButton, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    IonLabel, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    IonBadge, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    IonInput, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    TagInputComponent 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  ]  // 添加 CommonModule 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 export class TestPageComponent implements OnInit { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   selectedTags: string[] = []; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -34,7 +68,10 @@ export class TestPageComponent implements OnInit { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   constructor(private toastController: ToastController, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private loadingController: LoadingController, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private alertController: AlertController, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    private navController: NavController) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private navController: NavController, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private router: Router, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private navCtrl: NavController 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  ) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     addIcons({ personOutline, barbellOutline, alarmOutline, square, arrowBack }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   ngOnInit() { } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -234,14 +271,15 @@ export class TestPageComponent implements OnInit { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     await alert.present(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   async savePlanToDatabase(plan: string) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    console.log('计划保存到数据库', plan); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    let currentUser = new CloudUser();  // 获取当前用户实例 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    let currentUser = new CloudUser().toPointer();  // 获取当前用户实例 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    console.log(currentUser) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    console.log('计划保存到数据库', plan); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     // 查询当前用户的所有计划 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     const cloudQuery = new CloudQuery("fitPlan"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    cloudQuery.equalTo("user", currentUser.toPointer());  // 过滤出与当前用户关联的所有计划 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    // 过滤出与当前用户关联的所有计划 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    cloudQuery.equalTo("user", currentUser) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       const userPlans = await cloudQuery.find();  // 获取当前用户的所有计划 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       console.log("找到的计划数量:", userPlans.length); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -251,8 +289,6 @@ export class TestPageComponent implements OnInit { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         await planObj.destroy();  // 删除每个计划 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         console.log("已删除计划:", planObj); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      // 保存新的计划 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       this.planArray.forEach((plan: any) => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         plan.detail = this.generatedPlan; // 添加额外的计划内容 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         console.log(plan); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -263,7 +299,7 @@ export class TestPageComponent implements OnInit { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           "srcId": plan['srcId'], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           "trainingPart": plan['trainingPart'], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           "trainingItems": plan['trainingItems'], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-          "user": currentUser.toPointer(),  // 将当前用户指针关联到计划 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          "user": currentUser,  // 将当前用户指针关联到计划 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         // 创建新的 CloudObject 实例 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         let newObject = new CloudObject("fitPlan"); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -280,9 +316,14 @@ export class TestPageComponent implements OnInit { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } catch (error) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       console.error("查询或删除计划时发生错误", error); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    this.goToPage("tab2") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   goBack() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    this.navController.back(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    this.navCtrl.back(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  goToPage(page: string) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    // 更新选中的tab 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    this.router.navigate([`/tabs/${page}`]);  // 然后再进行路由跳转 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 |