| 
					
				 | 
			
			
				@@ -19,8 +19,8 @@ import { AlertController } from '@ionic/angular'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 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 { TestPageComponent } from './test-page/test-page.component'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import { TianqiComponent } from '../tianqi/tianqi.component'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import { RiliComponent } from '../rili/rili.component'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import { TianqiComponent } from './tianqi/tianqi.component'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import { RiliComponent } from './rili/rili.component'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 @Component({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   selector: 'app-tab2', 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -145,7 +145,7 @@ export class Tab2Page implements OnInit { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } else if (bmi >= 25 && bmi < 29.9) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       return '您的BMI稍微偏高,可以增加运动,控制饮食!(≧◡≦)'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      return '您的BMI较高,建议积极锻炼,控制体重!(。•́︿•̀。)'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      return '您的BMI太高了,建议积极锻炼,控制体重!(。•́︿•̀。)'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -161,12 +161,9 @@ export class Tab2Page implements OnInit { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     // 使用 currentUser 的 pointer 查询用户相关数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     cloudQuery.equalTo("user", currentUser.toPointer()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      // 执行查询并获取数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       this.planUser = await cloudQuery.find(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      // 确保查询结果存在且有效 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       if (this.planUser && this.planUser.length > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         const user = this.planUser[0]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        // 获取和处理已打卡日期 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         const checkedDays = user.get("checkeddays") || []; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if (Array.isArray(checkedDays)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           checkedDays.forEach((date: string) => { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -201,6 +198,44 @@ export class Tab2Page implements OnInit { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     this.consecutiveDays = count; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  //查看动能细则 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  async chakan() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    // 动能细则的内容 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    const powerDetails = ` 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      普通打卡: 每天获得 5 动能。 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      连续打卡第七天: 额外获得 10 动能。 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      连续打卡第十五天: 额外获得 20 动能。 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      连续打卡第三十天: 额外获得 30 动能。 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      补签:补签之后,连续打卡天数会清零。 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      动能后续能够在商城兑换联名奖品哦! 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  `; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    // 创建 alert 对话框 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    const alert = await this.alertController.create({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      header: '动能细则', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      message: powerDetails,  // 显示动能细则内容 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      buttons: [ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          text: '取消', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          role: 'cancel', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          cssClass: 'secondary', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          handler: () => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            console.log('操作被取消'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          text: '确认', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          handler: () => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            console.log('动能细则已确认'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      ] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    // 显示对话框 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    await alert.present(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   // 格式化日期 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   formatDate(date: Date): string { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -241,29 +276,21 @@ export class Tab2Page implements OnInit { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   async markAttendance() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     const currentDate = this.realDate; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     const formattedDate = this.formatDate(currentDate); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    // 如果今天已经打卡 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     if (this.checkInHistory.has(formattedDate)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       this.showToast('今天已经打卡过了', 'warning'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    // 如果是未来日期 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     if (currentDate > this.correctDate(new Date())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       this.showToast('不能打卡未来的日期', 'danger'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    // 正常打卡 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     this.checkInHistory.add(formattedDate); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     this.days = this.checkInHistory.size; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     this.calculateConsecutiveDays(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     let currentUser = new CloudUser(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     const cloudQuery = new CloudQuery("fitUser"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     cloudQuery.equalTo("user", currentUser.toPointer()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     const userData = await cloudQuery.find(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     if (userData.length > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       const user = userData[0]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       let checkedDays = user.get("checkeddays") || []; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -271,24 +298,19 @@ export class Tab2Page implements OnInit { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       user.set({ "checkeddays": checkedDays }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       user.set({ "days": this.days }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       user.set({ "sucdays": this.consecutiveDays }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      // 计算奖励 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      let totalReward = this.dailyReward; // 每天签到奖励 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      totalReward += this.getConsecutiveReward(this.consecutiveDays); // 连续签到奖励 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      user.set({ "power": user.get("power") + totalReward }); // 增加总 power 奖励 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      let totalReward = this.dailyReward; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      totalReward += this.getConsecutiveReward(this.consecutiveDays); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      user.set({ "power": user.get("power") + totalReward }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       await user.save(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       this.loadPlanUser(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      this.showToast('打卡成功,获得了 ' + totalReward + ' Power'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      this.showToast('打卡成功,获得了 ' + totalReward + ' 动能'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  //补签操作 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   async handleMakeupSignIn(user: CloudUser): Promise<string> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    // 如果用户有足够的动力值 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     if (user.get("power") >= this.powerForMakup) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       const currentDate = this.realDate; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       const formattedDate = this.formatDate(currentDate); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       // 将补签日期添加到已打卡的日期集合 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       if (!this.checkInHistory.has(formattedDate)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         this.checkInHistory.add(formattedDate); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -302,8 +324,7 @@ export class Tab2Page implements OnInit { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         user.set({ "checkeddays": checkedDays }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       user.set({ "days": this.days }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      user.set({ "sucdays": this.consecutiveDays }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      user.set({ "sucdays": 1 }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       await user.save(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       return '补签成功!'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } else { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -311,7 +332,7 @@ export class Tab2Page implements OnInit { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  // 补签点击事件 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  // 补签点击提示事件 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   async handleMakeupClick() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     const confirmed = window.confirm('补签将消耗 ' + this.powerForMakup + ' 动能,且连续打卡天数清零!确定补签吗?'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     if (confirmed) { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -567,7 +588,6 @@ export class Tab2Page implements OnInit { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 # 对话环节 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 0.导诊(根据用户基本情况,引导选择合适的训练计划)  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 1.预设的问询方式(根据学员自述情况进行引导) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 - 打招呼,以学员自述为主 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 - 当信息充足时,确认学员的目标与需求,并进入下一个环节  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 2.拓展的问询细节  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -579,7 +599,7 @@ export class Tab2Page implements OnInit { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 - 完成训练计划时,请在消息结尾附带: [交流完成] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 # 开始话语 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 当您准备好了,可以以一个健身教练的身份,向来访的学员打招呼。 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-你好!欢迎来到健身房,我是${coach?.get("name")}教练,${coach?.get("desc")}。今天你想要专注锻炼哪个部位呢?或者有什么具体的健身目标吗?`); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+你好!欢迎来到WiseFitness健身房,我是${coach?.get("name")}教练,在${coach?.get("specialize")}方面颇有造诣。今天你想询问关于这个方面的哪些问题呢?`); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       onMessage: (chat: FmodeChat, message: FmodeChatMessage) => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         console.log("onMessage", message) 
			 |