|  | @@ -1,6 +1,6 @@
 | 
											
												
													
														|  |  import { Component, AfterViewInit } from '@angular/core';
 |  |  import { Component, AfterViewInit } from '@angular/core';
 | 
											
												
													
														|  |  import { Router } from '@angular/router';
 |  |  import { Router } from '@angular/router';
 | 
											
												
													
														|  | -import { ModalController, NavController } from '@ionic/angular';
 |  | 
 | 
											
												
													
														|  | 
 |  | +import { ModalController, NavController, ToastController } from '@ionic/angular';
 | 
											
												
													
														|  |  import { HttpClient } from '@angular/common/http';
 |  |  import { HttpClient } from '@angular/common/http';
 | 
											
												
													
														|  |  import { Observable } from 'rxjs';
 |  |  import { Observable } from 'rxjs';
 | 
											
												
													
														|  |  import { map, catchError } from 'rxjs/operators';
 |  |  import { map, catchError } from 'rxjs/operators';
 | 
											
										
											
												
													
														|  | @@ -63,7 +63,8 @@ export class Tab1Page implements AfterViewInit {
 | 
											
												
													
														|  |    isDragging: boolean = false; // 标记是否正在拖动
 |  |    isDragging: boolean = false; // 标记是否正在拖动
 | 
											
												
													
														|  |    currentTranslate: number = 0; // 当前的平移值
 |  |    currentTranslate: number = 0; // 当前的平移值
 | 
											
												
													
														|  |    cardWidth = 216; // 每个卡片的宽度加上间距 (200 + 16)
 |  |    cardWidth = 216; // 每个卡片的宽度加上间距 (200 + 16)
 | 
											
												
													
														|  | -  isCyclic: boolean = true; // 是否启用循环滑动
 |  | 
 | 
											
												
													
														|  | 
 |  | +  isCyclic: boolean = true;
 | 
											
												
													
														|  | 
 |  | +  fileToUpload: File | null = null; // 是否启用循环滑动
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |    ngAfterViewInit() {
 |  |    ngAfterViewInit() {
 | 
											
												
													
														|  |      this.updateCarousel(); // 确保初始状态正确
 |  |      this.updateCarousel(); // 确保初始状态正确
 | 
											
										
											
												
													
														|  | @@ -172,6 +173,7 @@ export class Tab1Page implements AfterViewInit {
 | 
											
												
													
														|  |      this.currentIndex = Math.max(0, Math.min(cardIndex, this.doctors.length - 1));
 |  |      this.currentIndex = Math.max(0, Math.min(cardIndex, this.doctors.length - 1));
 | 
											
												
													
														|  |      this.updateCarousel();
 |  |      this.updateCarousel();
 | 
											
												
													
														|  |    }
 |  |    }
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  |    // 在线咨询按钮点击事件
 |  |    // 在线咨询按钮点击事件
 | 
											
												
													
														|  |    onConsultNow() {
 |  |    onConsultNow() {
 | 
											
												
													
														|  |      console.log(`立即咨询`);
 |  |      console.log(`立即咨询`);
 | 
											
										
											
												
													
														|  | @@ -191,9 +193,52 @@ export class Tab1Page implements AfterViewInit {
 | 
											
												
													
														|  |    }
 |  |    }
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |    // 发布求医信息
 |  |    // 发布求医信息
 | 
											
												
													
														|  | -  publishHealthInfo() {
 |  | 
 | 
											
												
													
														|  | -    // 这里可以添加发布求医信息的逻辑
 |  | 
 | 
											
												
													
														|  | -    console.log('发布求医信息');
 |  | 
 | 
											
												
													
														|  | 
 |  | +  handleClick() {
 | 
											
												
													
														|  | 
 |  | +    const fileInput = document.getElementById('fileInput');
 | 
											
												
													
														|  | 
 |  | +    if (fileInput) {
 | 
											
												
													
														|  | 
 |  | +      fileInput.click();
 | 
											
												
													
														|  | 
 |  | +    } else {
 | 
											
												
													
														|  | 
 |  | +      console.error('File input element not found');
 | 
											
												
													
														|  | 
 |  | +    }
 | 
											
												
													
														|  | 
 |  | +  }
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +  publishHealthInfo(files: FileList) {
 | 
											
												
													
														|  | 
 |  | +    if (files && files.length > 0) {
 | 
											
												
													
														|  | 
 |  | +      const file = files[0];
 | 
											
												
													
														|  | 
 |  | +      const allowedTypes = ['application/msword', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 
 | 
											
												
													
														|  | 
 |  | +                            'image/jpeg', 'image/png', 'image/gif'];
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +      if (allowedTypes.includes(file.type)) {
 | 
											
												
													
														|  | 
 |  | +        console.log('Selected file:', file.name);
 | 
											
												
													
														|  | 
 |  | +        // 在这里可以添加上传文件的逻辑
 | 
											
												
													
														|  | 
 |  | +        this.fileToUpload = file;
 | 
											
												
													
														|  | 
 |  | +        // 在这里添加上传文件的逻辑
 | 
											
												
													
														|  | 
 |  | +        this.uploadFile().then(() => this.navCtrl.navigateForward('/tabs/tab2'));
 | 
											
												
													
														|  | 
 |  | +      } else {
 | 
											
												
													
														|  | 
 |  | +        this.presentToast('仅支持 .doc, .docx, .jpg, .jpeg, .png, .gif 文件类型');
 | 
											
												
													
														|  | 
 |  | +      }
 | 
											
												
													
														|  | 
 |  | +    } else {
 | 
											
												
													
														|  | 
 |  | +      console.log('No file selected');
 | 
											
												
													
														|  | 
 |  | +    }
 | 
											
												
													
														|  | 
 |  | +  }
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +  async presentToast(message: string) {
 | 
											
												
													
														|  | 
 |  | +    const toast = await this.toastController.create({
 | 
											
												
													
														|  | 
 |  | +      message: message,
 | 
											
												
													
														|  | 
 |  | +      duration: 2000,
 | 
											
												
													
														|  | 
 |  | +      position: 'bottom'
 | 
											
												
													
														|  | 
 |  | +    });
 | 
											
												
													
														|  | 
 |  | +    toast.present();
 | 
											
												
													
														|  | 
 |  | +  }
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +  private async uploadFile(): Promise<void> {
 | 
											
												
													
														|  | 
 |  | +    if (this.fileToUpload) {
 | 
											
												
													
														|  | 
 |  | +      // 这里是模拟文件上传的过程,您可以替换为实际的上传逻辑。
 | 
											
												
													
														|  | 
 |  | +      // 比如调用API进行文件上传,并处理响应。
 | 
											
												
													
														|  | 
 |  | +      // 简单示例:
 | 
											
												
													
														|  | 
 |  | +      // await this.http.post('your-upload-endpoint', this.fileToUpload).toPromise();
 | 
											
												
													
														|  | 
 |  | +      return new Promise((resolve) => setTimeout(resolve, 1000)); // 模拟异步操作
 | 
											
												
													
														|  | 
 |  | +    }
 | 
											
												
													
														|  |    }
 |  |    }
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |    isLoginModalOpen = false; // 声明 isLoginModalOpen 属性
 |  |    isLoginModalOpen = false; // 声明 isLoginModalOpen 属性
 | 
											
										
											
												
													
														|  | @@ -206,7 +251,8 @@ export class Tab1Page implements AfterViewInit {
 | 
											
												
													
														|  |      private router: Router,
 |  |      private router: Router,
 | 
											
												
													
														|  |      private modalController: ModalController,
 |  |      private modalController: ModalController,
 | 
											
												
													
														|  |      private navCtrl: NavController,
 |  |      private navCtrl: NavController,
 | 
											
												
													
														|  | -    private http: HttpClient // 注入 HttpClient
 |  | 
 | 
											
												
													
														|  | 
 |  | +    private http: HttpClient,
 | 
											
												
													
														|  | 
 |  | +    private toastController: ToastController // 注入 ToastController
 | 
											
												
													
														|  |    ) {}
 |  |    ) {}
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |    openLoginModal() {
 |  |    openLoginModal() {
 | 
											
										
											
												
													
														|  | @@ -291,4 +337,7 @@ export class Tab1Page implements AfterViewInit {
 | 
											
												
													
														|  |      // 跳转到详情页面
 |  |      // 跳转到详情页面
 | 
											
												
													
														|  |      this.navCtrl.navigateForward('/details');
 |  |      this.navCtrl.navigateForward('/details');
 | 
											
												
													
														|  |    }
 |  |    }
 | 
											
												
													
														|  | -}
 |  | 
 | 
											
												
													
														|  | 
 |  | +}
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +
 |