| 
														
															@@ -19,6 +19,9 @@ import { AlertController } from '@ionic/angular'; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import { openUserEditModal } from 'src/lib/user/modal-user-edit/modal-user-edit.component'; 
														 | 
														
														 | 
														
															 import { openUserEditModal } from 'src/lib/user/modal-user-edit/modal-user-edit.component'; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import { openUserLoginModal } from 'src/lib/user/modal-user-login/modal-user-login.component'; 
														 | 
														
														 | 
														
															 import { openUserLoginModal } from 'src/lib/user/modal-user-login/modal-user-login.component'; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import { TestPageComponent } from './test-page/test-page.component'; 
														 | 
														
														 | 
														
															 import { TestPageComponent } from './test-page/test-page.component'; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+import { TianqiComponent } from '../tianqi/tianqi.component'; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+import { RiliComponent } from '../rili/rili.component'; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 @Component({ 
														 | 
														
														 | 
														
															 @Component({ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															   selector: 'app-tab2', 
														 | 
														
														 | 
														
															   selector: 'app-tab2', 
														 | 
													
												
											
												
													
														| 
														 | 
														
															   templateUrl: 'tab2.page.html', 
														 | 
														
														 | 
														
															   templateUrl: 'tab2.page.html', 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -57,6 +60,8 @@ import { TestPageComponent } from './test-page/test-page.component'; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     IonItemOption, 
														 | 
														
														 | 
														
															     IonItemOption, 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     IonItemSliding, 
														 | 
														
														 | 
														
															     IonItemSliding, 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     IonItemOptions, 
														 | 
														
														 | 
														
															     IonItemOptions, 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    TianqiComponent, 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    RiliComponent 
														 | 
													
												
											
												
													
														| 
														 | 
														
															   ] 
														 | 
														
														 | 
														
															   ] 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 }) 
														 | 
														
														 | 
														
															 }) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 export class Tab2Page implements OnInit { 
														 | 
														
														 | 
														
															 export class Tab2Page implements OnInit { 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -76,7 +81,6 @@ export class Tab2Page implements OnInit { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     this.loadPlanList() 
														 | 
														
														 | 
														
															     this.loadPlanList() 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     this.loadCoachList() 
														 | 
														
														 | 
														
															     this.loadCoachList() 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     this.loadPlanUser() 
														 | 
														
														 | 
														
															     this.loadPlanUser() 
														 | 
													
												
											
												
													
														| 
														 | 
														
															- 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															   } 
														 | 
														
														 | 
														
															   } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															   async loadPlanList() { 
														 | 
														
														 | 
														
															   async loadPlanList() { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     let currentUser = new CloudUser(); 
														 | 
														
														 | 
														
															     let currentUser = new CloudUser(); 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -84,7 +88,7 @@ export class Tab2Page implements OnInit { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     if (currentUser) { 
														 | 
														
														 | 
														
															     if (currentUser) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															       cloudQuery.equalTo("user", currentUser.toPointer()); 
														 | 
														
														 | 
														
															       cloudQuery.equalTo("user", currentUser.toPointer()); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															       this.planList = await cloudQuery.find(); 
														 | 
														
														 | 
														
															       this.planList = await cloudQuery.find(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-      console.log(this.planList) 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+      console.log("计划为:", this.planList) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															       //排序算法 
														 | 
														
														 | 
														
															       //排序算法 
														 | 
													
												
											
												
													
														| 
														 | 
														
															       this.planList.sort((a, b) => { 
														 | 
														
														 | 
														
															       this.planList.sort((a, b) => { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         const srcIdA = a.get("srcId").match(/\d+/); 
														 | 
														
														 | 
														
															         const srcIdA = a.get("srcId").match(/\d+/); 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -121,7 +125,10 @@ export class Tab2Page implements OnInit { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     }); 
														 | 
														
														 | 
														
															     }); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     toast.present(); 
														 | 
														
														 | 
														
															     toast.present(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															   } 
														 | 
														
														 | 
														
															   } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															- 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+  onDateChange2(event: any) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    console.log(event); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    this.realDate = new Date(event); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+  } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															   // 计算 BMI 
														 | 
														
														 | 
														
															   // 计算 BMI 
														 | 
													
												
											
												
													
														| 
														 | 
														
															   calculateBMI(height: number, weight: number): number { 
														 | 
														
														 | 
														
															   calculateBMI(height: number, weight: number): number { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     const heightInMeters = height / 100; 
														 | 
														
														 | 
														
															     const heightInMeters = height / 100; 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -166,10 +173,9 @@ export class Tab2Page implements OnInit { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             this.checkInHistory.add(date); 
														 | 
														
														 | 
														
															             this.checkInHistory.add(date); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															           }); 
														 | 
														
														 | 
														
															           }); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         } 
														 | 
														
														 | 
														
															         } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        // 安全地获取数据,使用默认值来防止 null 或 undefined 错误 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         this.days = user.get("days") || 0; 
														 | 
														
														 | 
														
															         this.days = user.get("days") || 0; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         this.consecutiveDays = user.get("sucdays") || 0; 
														 | 
														
														 | 
														
															         this.consecutiveDays = user.get("sucdays") || 0; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        this.power = user.get("power") || 0;  // 假设 power 默认是 0 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        this.power = user.get("power") || 0; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															       } else { 
														 | 
														
														 | 
														
															       } else { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         console.warn('No user data found'); 
														 | 
														
														 | 
														
															         console.warn('No user data found'); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															       } 
														 | 
														
														 | 
														
															       } 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -277,10 +283,27 @@ export class Tab2Page implements OnInit { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     } 
														 | 
														
														 | 
														
															     } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															   } 
														 | 
														
														 | 
														
															   } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															-  // 补签操作 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															   async handleMakeupSignIn(user: CloudUser): Promise<string> { 
														 | 
														
														 | 
														
															   async handleMakeupSignIn(user: CloudUser): Promise<string> { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    // 如果用户有足够的动力值 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     if (user.get("power") >= this.powerForMakup) { 
														 | 
														
														 | 
														
															     if (user.get("power") >= this.powerForMakup) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+      const currentDate = this.realDate; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+      const formattedDate = this.formatDate(currentDate); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+      // 将补签日期添加到已打卡的日期集合 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+      if (!this.checkInHistory.has(formattedDate)) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        this.checkInHistory.add(formattedDate); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        this.days = this.checkInHistory.size; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        this.calculateConsecutiveDays(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+      } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															       user.set({ "power": user.get("power") - this.powerForMakup }); 
														 | 
														
														 | 
														
															       user.set({ "power": user.get("power") - this.powerForMakup }); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+      let checkedDays = user.get("checkeddays") || []; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+      if (!checkedDays.includes(formattedDate)) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        checkedDays.push(formattedDate); // 添加补签日期 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        user.set({ "checkeddays": checkedDays }); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+      } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+      user.set({ "days": this.days }); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+      user.set({ "sucdays": this.consecutiveDays }); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															       await user.save(); 
														 | 
														
														 | 
														
															       await user.save(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															       return '补签成功!'; 
														 | 
														
														 | 
														
															       return '补签成功!'; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     } else { 
														 | 
														
														 | 
														
															     } else { 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -290,7 +313,7 @@ export class Tab2Page implements OnInit { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															   // 补签点击事件 
														 | 
														
														 | 
														
															   // 补签点击事件 
														 | 
													
												
											
												
													
														| 
														 | 
														
															   async handleMakeupClick() { 
														 | 
														
														 | 
														
															   async handleMakeupClick() { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-    const confirmed = window.confirm('补签将消耗 ' + this.powerForMakup + ' 动能,确定补签吗?'); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    const confirmed = window.confirm('补签将消耗 ' + this.powerForMakup + ' 动能,且连续打卡天数清零!确定补签吗?'); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     if (confirmed) { 
														 | 
														
														 | 
														
															     if (confirmed) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															       let currentUser = new CloudUser(); 
														 | 
														
														 | 
														
															       let currentUser = new CloudUser(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															       const cloudQuery = new CloudQuery("fitUser"); 
														 | 
														
														 | 
														
															       const cloudQuery = new CloudQuery("fitUser"); 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -333,6 +356,9 @@ export class Tab2Page implements OnInit { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     if (user?.id) { 
														 | 
														
														 | 
														
															     if (user?.id) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															       this.currentUser = user 
														 | 
														
														 | 
														
															       this.currentUser = user 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     } 
														 | 
														
														 | 
														
															     } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    this.loadPlanList() 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    this.loadCoachList() 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    this.loadPlanUser() 
														 | 
													
												
											
												
													
														| 
														 | 
														
															   } 
														 | 
														
														 | 
														
															   } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															   async signup() { 
														 | 
														
														 | 
														
															   async signup() { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     // 弹出注册窗口 
														 | 
														
														 | 
														
															     // 弹出注册窗口 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -340,11 +366,14 @@ export class Tab2Page implements OnInit { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     if (user?.id) { 
														 | 
														
														 | 
														
															     if (user?.id) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															       this.currentUser = user 
														 | 
														
														 | 
														
															       this.currentUser = user 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     } 
														 | 
														
														 | 
														
															     } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-  } 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-  logout() { 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-    this.currentUser?.logout(); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															   } 
														 | 
														
														 | 
														
															   } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+  async logout() { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    await this.currentUser?.logout(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    this.loadPlanList() 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    this.loadCoachList() 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    this.loadPlanUser() 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+  } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															   editUser() { 
														 | 
														
														 | 
														
															   editUser() { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     openUserEditModal(this.modalCtrl) 
														 | 
														
														 | 
														
															     openUserEditModal(this.modalCtrl) 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -372,26 +401,27 @@ export class Tab2Page implements OnInit { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															       }); 
														 | 
														
														 | 
														
															       }); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     }); 
														 | 
														
														 | 
														
															     }); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															   } 
														 | 
														
														 | 
														
															   } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-  regeneratePlan() { 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-    console.log('重新生成计划:'); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															- 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-    // 创建一个弹出框 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-    this.modalCtrl.create({ 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-      component: TestPageComponent, 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-      componentProps: {} 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-    }).then(modal => { 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-      modal.present(); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-      modal.onDidDismiss().then((result) => { 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        if (result.data) { 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-          const updatedPlan = result.data; 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-          const index = this.planList.findIndex(item => item.id === updatedPlan.id); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-          if (index !== -1) { 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            this.planList[index] = updatedPlan; 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+  async regeneratePlan() { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    if (await this.checkout()) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+      console.log('重新生成计划:'); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+      // 创建一个弹出框 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+      this.modalCtrl.create({ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        component: TestPageComponent, 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        componentProps: {} 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+      }).then(modal => { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        modal.present(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        modal.onDidDismiss().then((result) => { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+          if (result.data) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            const updatedPlan = result.data; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            const index = this.planList.findIndex(item => item.id === updatedPlan.id); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            if (index !== -1) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+              this.planList[index] = updatedPlan; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															           } 
														 | 
														
														 | 
														
															           } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        } 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        this.loadPlanList() 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+          this.loadPlanList() 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        }); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															       }); 
														 | 
														
														 | 
														
															       }); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-    }); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															   } 
														 | 
														
														 | 
														
															   } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															   async deletePlan(day: any) { 
														 | 
														
														 | 
														
															   async deletePlan(day: any) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     const alert = await this.alertController.create({ 
														 | 
														
														 | 
														
															     const alert = await this.alertController.create({ 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -424,6 +454,7 @@ export class Tab2Page implements OnInit { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															     await alert.present(); 
														 | 
														
														 | 
														
															     await alert.present(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															   } 
														 | 
														
														 | 
														
															   } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															   //任务链 
														 | 
														
														 | 
														
															   //任务链 
														 | 
													
												
											
												
													
														| 
														 | 
														
															   actionTaskList: AgentTaskStep[] = [] 
														 | 
														
														 | 
														
															   actionTaskList: AgentTaskStep[] = [] 
														 | 
													
												
											
												
													
														| 
														 | 
														
															   healthTaskList: AgentTaskStep[] = [] 
														 | 
														
														 | 
														
															   healthTaskList: AgentTaskStep[] = [] 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -437,29 +468,47 @@ export class Tab2Page implements OnInit { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															   } 
														 | 
														
														 | 
														
															   } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															   shareData: any = {} 
														 | 
														
														 | 
														
															   shareData: any = {} 
														 | 
													
												
											
												
													
														| 
														 | 
														
															   // 任务:完成故事意境描述及图像绘制 
														 | 
														
														 | 
														
															   // 任务:完成故事意境描述及图像绘制 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-  doPoemTask() { 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-    this.actionTaskVisible = true; 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-    let task1 = TaskPoemPictureDesc({ shareData: this.shareData, modalCtrl: this.modalCtrl }); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-    let task2 = TaskPoemPictureCreate({ shareData: this.shareData, modalCtrl: this.modalCtrl }); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-    let PoemTaskList = [task1, task2] 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-    this.actionTaskList = PoemTaskList 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-    startTask(PoemTaskList) 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-  } 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-  doInqueryTask() { 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-    this.healthTaskVisible = true; 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-    let task1 = TaskInqueryUserStory({ shareData: this.shareData, modalCtrl: this.modalCtrl }); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-    let task2 = TaskInqueryDoctorQuestion({ shareData: this.shareData, modalCtrl: this.modalCtrl }); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-    let task3 = TaskInqueryUserAnswer({ shareData: this.shareData, modalCtrl: this.modalCtrl }); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-    // 定义任务集 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-    let InquireServiceTaskList = [ 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-      task1, task2, task3 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-    ] 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-    // 传递给显示组件 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-    this.healthTaskList = InquireServiceTaskList 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-    // 开始执行任务 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-    startTask(InquireServiceTaskList) 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+  async doPoemTask() { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    if (await this.checkout()) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+      await this.checkout() 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+      this.actionTaskVisible = true; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+      let task1 = TaskPoemPictureDesc({ shareData: this.shareData, modalCtrl: this.modalCtrl }); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+      let task2 = TaskPoemPictureCreate({ shareData: this.shareData, modalCtrl: this.modalCtrl }); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+      let PoemTaskList = [task1, task2] 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+      this.actionTaskList = PoemTaskList 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+      startTask(PoemTaskList) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+  } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+  async doInqueryTask() { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    if (await this.checkout()) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+      this.healthTaskVisible = true; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+      let task1 = TaskInqueryUserStory({ shareData: this.shareData, modalCtrl: this.modalCtrl }); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+      let task2 = TaskInqueryDoctorQuestion({ shareData: this.shareData, modalCtrl: this.modalCtrl }); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+      let task3 = TaskInqueryUserAnswer({ shareData: this.shareData, modalCtrl: this.modalCtrl }); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+      // 定义任务集 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+      let InquireServiceTaskList = [ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        task1, task2, task3 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+      ] 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+      // 传递给显示组件 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+      this.healthTaskList = InquireServiceTaskList 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+      // 开始执行任务 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+      startTask(InquireServiceTaskList) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															   } 
														 | 
														
														 | 
														
															   } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															   // 聊天页面 
														 | 
														
														 | 
														
															   // 聊天页面 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+  async checkout() { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    let currentUser = new CloudUser(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    if (!currentUser?.id) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+      console.log("用户未登录,请登录后重试"); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+      let user = await openUserLoginModal(this.modalCtrl); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+      if (!user?.id) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        return false;  // 用户未登录且登录失败,返回 false 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+      } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+      currentUser = user; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    return true; // 用户已登录,返回 true 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+  } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															   async openInquiry(coach: CloudObject) { 
														 | 
														
														 | 
														
															   async openInquiry(coach: CloudObject) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     let currentUser = new CloudUser(); 
														 | 
														
														 | 
														
															     let currentUser = new CloudUser(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     let userPrompt = `` 
														 | 
														
														 | 
														
															     let userPrompt = `` 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -492,9 +541,7 @@ export class Tab2Page implements OnInit { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     let ACL: any = { 
														 | 
														
														 | 
														
															     let ACL: any = { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															       "*": { read: false, write: false } 
														 | 
														
														 | 
														
															       "*": { read: false, write: false } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     } 
														 | 
														
														 | 
														
															     } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-    if (currentUser?.id) { 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-      ACL[currentUser?.id] = { read: true, write: true } 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-    } 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     consult.set({ 
														 | 
														
														 | 
														
															     consult.set({ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															       title: `交流记录${dateStr}-${coach?.get("name")}`, 
														 | 
														
														 | 
														
															       title: `交流记录${dateStr}-${coach?.get("name")}`, 
														 | 
													
												
											
												
													
														| 
														 | 
														
															       coach: coach.toPointer(), 
														 | 
														
														 | 
														
															       coach: coach.toPointer(), 
														 |