|  | @@ -19,6 +19,9 @@ 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';
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  @Component({
 | 
	
		
			
				|  |  |    selector: 'app-tab2',
 | 
	
		
			
				|  |  |    templateUrl: 'tab2.page.html',
 | 
	
	
		
			
				|  | @@ -57,6 +60,8 @@ import { TestPageComponent } from './test-page/test-page.component';
 | 
	
		
			
				|  |  |      IonItemOption,
 | 
	
		
			
				|  |  |      IonItemSliding,
 | 
	
		
			
				|  |  |      IonItemOptions,
 | 
	
		
			
				|  |  | +    TianqiComponent,
 | 
	
		
			
				|  |  | +    RiliComponent
 | 
	
		
			
				|  |  |    ]
 | 
	
		
			
				|  |  |  })
 | 
	
		
			
				|  |  |  export class Tab2Page implements OnInit {
 | 
	
	
		
			
				|  | @@ -76,7 +81,6 @@ export class Tab2Page implements OnInit {
 | 
	
		
			
				|  |  |      this.loadPlanList()
 | 
	
		
			
				|  |  |      this.loadCoachList()
 | 
	
		
			
				|  |  |      this.loadPlanUser()
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  |    }
 | 
	
		
			
				|  |  |    async loadPlanList() {
 | 
	
		
			
				|  |  |      let currentUser = new CloudUser();
 | 
	
	
		
			
				|  | @@ -84,7 +88,7 @@ export class Tab2Page implements OnInit {
 | 
	
		
			
				|  |  |      if (currentUser) {
 | 
	
		
			
				|  |  |        cloudQuery.equalTo("user", currentUser.toPointer());
 | 
	
		
			
				|  |  |        this.planList = await cloudQuery.find();
 | 
	
		
			
				|  |  | -      console.log(this.planList)
 | 
	
		
			
				|  |  | +      console.log("计划为:", this.planList)
 | 
	
		
			
				|  |  |        //排序算法
 | 
	
		
			
				|  |  |        this.planList.sort((a, b) => {
 | 
	
		
			
				|  |  |          const srcIdA = a.get("srcId").match(/\d+/);
 | 
	
	
		
			
				|  | @@ -121,7 +125,10 @@ export class Tab2Page implements OnInit {
 | 
	
		
			
				|  |  |      });
 | 
	
		
			
				|  |  |      toast.present();
 | 
	
		
			
				|  |  |    }
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | +  onDateChange2(event: any) {
 | 
	
		
			
				|  |  | +    console.log(event);
 | 
	
		
			
				|  |  | +    this.realDate = new Date(event);
 | 
	
		
			
				|  |  | +  }
 | 
	
		
			
				|  |  |    // 计算 BMI
 | 
	
		
			
				|  |  |    calculateBMI(height: number, weight: number): number {
 | 
	
		
			
				|  |  |      const heightInMeters = height / 100;
 | 
	
	
		
			
				|  | @@ -138,7 +145,7 @@ export class Tab2Page implements OnInit {
 | 
	
		
			
				|  |  |      } else if (bmi >= 25 && bmi < 29.9) {
 | 
	
		
			
				|  |  |        return '您的BMI稍微偏高,可以增加运动,控制饮食!(≧◡≦)';
 | 
	
		
			
				|  |  |      } else {
 | 
	
		
			
				|  |  | -      return '您的BMI较高,建议积极锻炼,控制体重!(。•́︿•̀。)';
 | 
	
		
			
				|  |  | +      return '您的BMI太高了,建议积极锻炼,控制体重!(。•́︿•̀。)';
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |    }
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -154,22 +161,18 @@ 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) => {
 | 
	
		
			
				|  |  |              this.checkInHistory.add(date);
 | 
	
		
			
				|  |  |            });
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | -        // 安全地获取数据,使用默认值来防止 null 或 undefined 错误
 | 
	
		
			
				|  |  |          this.days = user.get("days") || 0;
 | 
	
		
			
				|  |  |          this.consecutiveDays = user.get("sucdays") || 0;
 | 
	
		
			
				|  |  | -        this.power = user.get("power") || 0;  // 假设 power 默认是 0
 | 
	
		
			
				|  |  | +        this.power = user.get("power") || 0;
 | 
	
		
			
				|  |  |        } else {
 | 
	
		
			
				|  |  |          console.warn('No user data found');
 | 
	
		
			
				|  |  |        }
 | 
	
	
		
			
				|  | @@ -195,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 {
 | 
	
	
		
			
				|  | @@ -235,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") || [];
 | 
	
	
		
			
				|  | @@ -265,22 +298,33 @@ 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);
 | 
	
		
			
				|  |  | +        this.days = this.checkInHistory.size;
 | 
	
		
			
				|  |  | +        this.calculateConsecutiveDays();
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  |        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": 1 });
 | 
	
		
			
				|  |  |        await user.save();
 | 
	
		
			
				|  |  |        return '补签成功!';
 | 
	
		
			
				|  |  |      } else {
 | 
	
	
		
			
				|  | @@ -288,9 +332,9 @@ export class Tab2Page implements OnInit {
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |    }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -  // 补签点击事件
 | 
	
		
			
				|  |  | +  // 补签点击提示事件
 | 
	
		
			
				|  |  |    async handleMakeupClick() {
 | 
	
		
			
				|  |  | -    const confirmed = window.confirm('补签将消耗 ' + this.powerForMakup + ' 动能,确定补签吗?');
 | 
	
		
			
				|  |  | +    const confirmed = window.confirm('补签将消耗 ' + this.powerForMakup + ' 动能,且连续打卡天数清零!确定补签吗?');
 | 
	
		
			
				|  |  |      if (confirmed) {
 | 
	
		
			
				|  |  |        let currentUser = new CloudUser();
 | 
	
		
			
				|  |  |        const cloudQuery = new CloudQuery("fitUser");
 | 
	
	
		
			
				|  | @@ -333,6 +377,10 @@ export class Tab2Page implements OnInit {
 | 
	
		
			
				|  |  |      if (user?.id) {
 | 
	
		
			
				|  |  |        this.currentUser = user
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  | +    window.location.reload();  // 登录后刷新页面
 | 
	
		
			
				|  |  | +    // this.loadPlanList()
 | 
	
		
			
				|  |  | +    // this.loadCoachList()
 | 
	
		
			
				|  |  | +    // this.loadPlanUser()
 | 
	
		
			
				|  |  |    }
 | 
	
		
			
				|  |  |    async signup() {
 | 
	
		
			
				|  |  |      // 弹出注册窗口
 | 
	
	
		
			
				|  | @@ -340,11 +388,15 @@ export class Tab2Page implements OnInit {
 | 
	
		
			
				|  |  |      if (user?.id) {
 | 
	
		
			
				|  |  |        this.currentUser = user
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  | -  }
 | 
	
		
			
				|  |  | -  logout() {
 | 
	
		
			
				|  |  | -    this.currentUser?.logout();
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |    }
 | 
	
		
			
				|  |  | +  async logout() {
 | 
	
		
			
				|  |  | +    await this.currentUser?.logout();
 | 
	
		
			
				|  |  | +    window.location.reload();  // 登录后刷新页面
 | 
	
		
			
				|  |  | +    // this.loadPlanList()
 | 
	
		
			
				|  |  | +    // this.loadCoachList()
 | 
	
		
			
				|  |  | +    // this.loadPlanUser()
 | 
	
		
			
				|  |  | +  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |    editUser() {
 | 
	
		
			
				|  |  |      openUserEditModal(this.modalCtrl)
 | 
	
	
		
			
				|  | @@ -372,26 +424,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) {
 | 
	
		
			
				|  |  |      const alert = await this.alertController.create({
 | 
	
	
		
			
				|  | @@ -424,6 +477,7 @@ export class Tab2Page implements OnInit {
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      await alert.present();
 | 
	
		
			
				|  |  |    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |    //任务链
 | 
	
		
			
				|  |  |    actionTaskList: AgentTaskStep[] = []
 | 
	
		
			
				|  |  |    healthTaskList: AgentTaskStep[] = []
 | 
	
	
		
			
				|  | @@ -437,29 +491,47 @@ export class Tab2Page implements OnInit {
 | 
	
		
			
				|  |  |    }
 | 
	
		
			
				|  |  |    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) {
 | 
	
		
			
				|  |  |      let currentUser = new CloudUser();
 | 
	
		
			
				|  |  |      let userPrompt = ``
 | 
	
	
		
			
				|  | @@ -492,9 +564,7 @@ export class Tab2Page implements OnInit {
 | 
	
		
			
				|  |  |      let ACL: any = {
 | 
	
		
			
				|  |  |        "*": { read: false, write: false }
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  | -    if (currentUser?.id) {
 | 
	
		
			
				|  |  | -      ACL[currentUser?.id] = { read: true, write: true }
 | 
	
		
			
				|  |  | -    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      consult.set({
 | 
	
		
			
				|  |  |        title: `交流记录${dateStr}-${coach?.get("name")}`,
 | 
	
		
			
				|  |  |        coach: coach.toPointer(),
 | 
	
	
		
			
				|  | @@ -518,7 +588,6 @@ export class Tab2Page implements OnInit {
 | 
	
		
			
				|  |  |  # 对话环节
 | 
	
		
			
				|  |  |  0.导诊(根据用户基本情况,引导选择合适的训练计划) 
 | 
	
		
			
				|  |  |  1.预设的问询方式(根据学员自述情况进行引导)
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  |  - 打招呼,以学员自述为主
 | 
	
		
			
				|  |  |  - 当信息充足时,确认学员的目标与需求,并进入下一个环节 
 | 
	
		
			
				|  |  |  2.拓展的问询细节 
 | 
	
	
		
			
				|  | @@ -530,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)
 |