| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- import { Component, NgModule } from '@angular/core';
- import { IonHeader, IonToolbar, IonTitle, IonContent, IonList, IonItem, IonLabel, IonAvatar, IonButton, IonSegment, IonSegmentButton, IonSegmentContent, IonSegmentView, IonCardContent, IonCardTitle, IonCardHeader, IonCard } from '@ionic/angular/standalone';
- import { ExploreContainerComponent } from '../explore-container/explore-container.component';
- import { addIcons } from 'ionicons';
- import { airplane, bluetooth, call, wifi } from 'ionicons/icons';
- import { IonicModule, ModalController } from '@ionic/angular';
- import { ArticleCardComponent } from '../component/article-card/article-card.component';
- import { CommonModule } from '@angular/common';
- import { CloudObject, CloudQuery } from 'src/lib/ncloud';
- import { FormsModule } from '@angular/forms';
- import { NavigationLanComponent } from '../component/navigation-lan/navigation-lan.component';
- addIcons({ airplane, bluetooth, call, wifi });
- interface Article {
- image: string;
- title: string;
- category: string;
- date: string;
- views: number;
- likes: number;
- }
- @Component({
- selector: 'app-tab2',
- templateUrl: 'tab2.page.html',
- styleUrls: ['tab2.page.scss'],
- standalone: true,
- imports: [IonHeader, IonToolbar, IonTitle, IonContent, ExploreContainerComponent,
- IonLabel,IonItem,IonList,IonAvatar,ArticleCardComponent,CommonModule,IonButton,
- IonSegment, IonSegmentButton,NavigationLanComponent,
- IonSegmentContent,IonSegmentView,IonCardContent, IonCardTitle, IonCardHeader,IonCard
- ]
- })
- export class Tab2Page {
- type:"hotdot"|"export"|"sleep"|"lift"|"male"|"female" = "hotdot"
- typeChange(ev:any){
- this.type = ev?.detail?.value || ev?.value || 'hotdot'
- console.log(this.type)
- }
- // constructor(private modalCtrl:ModalController) { }
- constructor() { }
- cards: Array<CloudObject> = [];
- async loadCards() {
- let query = new CloudQuery('HotDot');
- // query.equalTo('category', 'HotDot');
- // query.greaterThan('views', 1000); // 查询 views 大于 1000 的文章
- if (this.type == 'hotdot') {
- }
- if (this.type == 'hotdot') {
- }
- if (this.type == 'hotdot') {
- }
- if (this.type == 'male') {
- query.equalTo('category', 'MaleHealth')
- }
- if (this.type == 'female') {
- query.equalTo("category", "FemaleHealth")
- }
- // query.greaterThan('views', 1000); // 查询 views 大于 1000 的文章
- this.cards = await query.find();
- console.log(this.cards);
- }
- ngOnInit() {
- this.loadCards();
- }
- }
|