|
@@ -4,7 +4,7 @@ import { CloudSeUser } from 'src/lib/cloudSeuser'; // 引入 CloudSeUser 类
|
|
|
import { FmodeChatCompletion } from 'fmode-ng'; // 引入 FmodeChatCompletion
|
|
|
import { addIcons } from 'ionicons';
|
|
|
import { albumsOutline, checkmarkCircleOutline, documentOutline, leafOutline, scanOutline, storefrontOutline } from 'ionicons/icons';
|
|
|
-import { IonButton, IonCard, IonCardContent, IonCardHeader, IonCol, IonContent, IonHeader, IonIcon, IonInput, IonRow, IonTextarea, IonTitle, IonToolbar, IonGrid, IonCardTitle, IonSearchbar, IonProgressBar, } from '@ionic/angular/standalone'; // 导入 Ionic 组件
|
|
|
+import { IonButton, IonCard, IonCardContent, IonCardHeader, IonCol, IonContent, IonHeader, IonIcon, IonInput, IonRow, IonTextarea, IonTitle, IonToolbar, IonGrid, IonCardTitle, IonSearchbar, IonProgressBar, IonButtons, } from '@ionic/angular/standalone'; // 导入 Ionic 组件
|
|
|
import { CommonModule } from '@angular/common'; // 导入 CommonModule
|
|
|
import { ImagePopupComponent } from '../image-popup/image-popup.component'; // 导入弹窗组件
|
|
|
import { ModalController, NavController } from '@ionic/angular/standalone';
|
|
@@ -15,6 +15,8 @@ import { Image4PopupComponent } from '../image-popup/image4-popup/image4-popup.c
|
|
|
import { openUserLoginModal } from 'src/lib/user/modal-user-login/modal-user-login.component';
|
|
|
import { CloudQuery, CloudUser } from 'src/lib/ncloud';
|
|
|
import { CloudSeMealPlan } from 'src/lib/cloudplans';
|
|
|
+import { MealService } from '../meal/meal.service';
|
|
|
+import { MealSearchComponent } from '../meal-search/meal-search/meal-search.component';
|
|
|
|
|
|
@Component({
|
|
|
selector: 'app-tab1',
|
|
@@ -24,7 +26,7 @@ import { CloudSeMealPlan } from 'src/lib/cloudplans';
|
|
|
imports: [
|
|
|
CommonModule, IonContent, IonHeader, IonTitle, IonToolbar,
|
|
|
IonButton, IonTextarea, IonInput, IonCard, IonCardContent, IonGrid, IonRow, IonCol, IonIcon,
|
|
|
- IonCardHeader, IonCardTitle, IonSearchbar, IonProgressBar
|
|
|
+ IonCardHeader, IonCardTitle, IonSearchbar, IonProgressBar,IonButtons
|
|
|
],
|
|
|
})
|
|
|
export class Tab1Page implements OnInit {
|
|
@@ -47,6 +49,7 @@ export class Tab1Page implements OnInit {
|
|
|
result: boolean = true; // 是否成功匹配到饮食计划
|
|
|
mark0:boolean=false;
|
|
|
isComplete:boolean = false;
|
|
|
+ searchQuery: string = '';
|
|
|
|
|
|
// 当前显示的幻灯片索引
|
|
|
currentSlide: number = 0;
|
|
@@ -121,6 +124,32 @@ export class Tab1Page implements OnInit {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ //搜索框功能实现
|
|
|
+ // 当输入发生变化时触发
|
|
|
+ setSearchQuery(query: string) {
|
|
|
+ this.searchQuery = query;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 点击搜索按钮时触发的搜索方法
|
|
|
+ async search() {
|
|
|
+ if (this.searchQuery.trim()) {
|
|
|
+ await this.openMealSearchModal();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 打开弹窗并展示搜索结果
|
|
|
+ async openMealSearchModal() {
|
|
|
+ const modal = await this.modalCtrl.create({
|
|
|
+ component: MealSearchComponent,
|
|
|
+ componentProps: {
|
|
|
+ searchQuery: this.searchQuery,
|
|
|
+ },
|
|
|
+ });
|
|
|
+
|
|
|
+ await modal.present();
|
|
|
+ }
|
|
|
+//搜索框功能实现
|
|
|
+
|
|
|
// 获取健康建议
|
|
|
async goHealthTips() {
|
|
|
this.isComplete = false;
|
|
@@ -263,6 +292,18 @@ export class Tab1Page implements OnInit {
|
|
|
this.router.navigate([`/tabs/tips`]);
|
|
|
}
|
|
|
|
|
|
+ goToasy() {
|
|
|
+ this.router.navigate([`/tabs/asy`]);
|
|
|
+ }
|
|
|
+
|
|
|
+ goToasf(){
|
|
|
+ this.router.navigate([`/tabs/asf`]);
|
|
|
+ }
|
|
|
+
|
|
|
+ goToasx(){
|
|
|
+ this.router.navigate([`/tabs/asx`]);
|
|
|
+ }
|
|
|
+
|
|
|
async login(){
|
|
|
// 弹出登录窗口
|
|
|
let user = await openUserLoginModal(this.modalCtrl);
|