import { Component, OnInit } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { IonHeader, IonToolbar, IonTitle, IonContent,IonButtons, IonButton, IonIcon,IonDatetime } from '@ionic/angular/standalone';
import { Router } from '@angular/router';
import { addIcons } from 'ionicons';
import { calendar } from 'ionicons/icons';
import { CloudObject, CloudQuery } from 'src/lib/ncloud';
@Component({
  selector: 'app-daily-content',
  templateUrl: './daily-content.page.html',
  styleUrls: ['./daily-content.page.scss'],
  standalone: true,
  imports: [FormsModule,CommonModule,IonHeader, IonToolbar, IonTitle, IonContent,IonButtons, IonButton,IonDatetime, IonIcon],
})

export class DailyContentPage implements OnInit {

  ngOnInit() {
    // 生命周期：页面加载后，运行医生列表加载函数
    this.loadPLContentsList();
  }

  // 创建用于数据列表存储的属性
  PLContentsList:Array<CloudObject> = []

  async loadPLContentsList(){
    let query = new CloudQuery("PL_Contents");
    query.equalTo('type', '图文'); // 添加查询条件来限制 type="图文"
    this.PLContentsList = await query.find() //限制查询条件为type="图文"
  }
  constructor(private router:Router) {
    addIcons({calendar});
  }
  navigateToDiary() {
    this.router.navigateByUrl('/daily-content')
    // 导航到日历页面的逻辑
  }

  navigateToToday() {
    this.router.navigateByUrl('/tabs/tab1')
    // 返回到今天内容的逻辑
  }

  onDateChange(event: any) {
    // 处理日期改变的逻辑
  }

  viewItemDetails(item: any) {
    console.log(item);
    // 跳转到对应内容详情页面的逻辑
  }
}
