community.component.html 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. <ion-header>
  2. <ion-toolbar>
  3. <ion-icon name="compass-outline" size="large" color="dark"></ion-icon>
  4. <ion-button slot="end" fill="clear" size="small" routerLink="share">
  5. <ion-icon name="add-circle-outline" size="large" color="dark"></ion-icon>
  6. <ion-note>发布</ion-note>
  7. </ion-button>
  8. </ion-toolbar>
  9. </ion-header>
  10. <ion-content color="light">
  11. <!-- 导航 -->
  12. <ion-card class="navbar">
  13. <ion-toolbar>
  14. <ion-segment value="推荐">
  15. <ion-segment-button value="推荐" (click)="cate='推荐'">
  16. <ion-label>推荐</ion-label>
  17. </ion-segment-button>
  18. <ion-segment-button value="关注" (click)="cate='关注'">
  19. <ion-label>关注</ion-label>
  20. </ion-segment-button>
  21. </ion-segment>
  22. </ion-toolbar>
  23. </ion-card>
  24. <ion-content>
  25. <ng-container *ngIf="cate=='关注'">
  26. <div class="carousel-container">
  27. <div class="carousel">
  28. <ng-container *ngFor="let attention of attentionList; let i = index">
  29. <ion-col size="6" *ngIf="i % 2 === 0">
  30. <ion-card class="roleCard custom-card" (click)="goAttentionDetail(attention)">
  31. <img alt="关注图" [src]="attention?.get('img')" />
  32. </ion-card>
  33. </ion-col>
  34. </ng-container>
  35. </div>
  36. </div>
  37. <div class="carousel-container">
  38. <div class="carousel">
  39. <ng-container *ngFor="let attention of attentionList.slice().reverse(); let i = index">
  40. <ion-col size="6" *ngIf="i % 2 === 0">
  41. <ion-card class="roleCard custom-card" (click)="goAttentionDetail(attention)">
  42. <img alt="关注图" [src]="attention?.get('img')" />
  43. </ion-card>
  44. </ion-col>
  45. </ng-container>
  46. </div>
  47. </div>
  48. <ng-container *ngFor="let science of scienceList">
  49. <ion-card (click)="goScienceDetail(science)">
  50. <img alt="科普图" [src]="science?.get('img')" />
  51. <ion-card-header>
  52. <ion-card-title>{{science?.get('name')}}</ion-card-title>
  53. <ion-card-subtitle>{{science?.get('createdAt') | date: 'YYYY/MM/dd' || "发布时间"}}</ion-card-subtitle>
  54. <div class="metadata-end-wrapper">
  55. <ion-button fill="clear" color="dark" size="small" class="see">
  56. <ion-icon name="eye-outline" size="small"></ion-icon>
  57. <ion-note>{{science?.get('see')}}</ion-note>
  58. </ion-button>
  59. <ion-button fill="clear" color="dark" size="small" class="like">
  60. <ion-icon name="heart-outline" size="small"></ion-icon>
  61. <ion-note>{{science?.get('like')}}</ion-note>
  62. </ion-button>
  63. </div>
  64. </ion-card-header>
  65. <ion-card-content>
  66. <p class="foodContent">{{science?.get('content')}}</p>
  67. </ion-card-content>
  68. </ion-card>
  69. </ng-container>
  70. </ng-container>
  71. <!-- 推荐部分 -->
  72. <ng-container *ngIf="cate=='推荐'">
  73. <ion-grid>
  74. <ion-row>
  75. <ng-container *ngFor="let attention of recommendList">
  76. <ion-col size="6">
  77. <ion-card class="roleCard" (click)="goRecommendDetail(attention)">
  78. <img alt="推荐图" [src]="attention?.get('img')" />
  79. <ion-card-header>
  80. <ion-card-title>{{attention?.get('name')}}</ion-card-title>
  81. <ion-card-subtitle style="font-size:0.7rem;">
  82. 作者:{{attention?.get('user')?.get('name') || "无名"}}
  83. </ion-card-subtitle>
  84. </ion-card-header>
  85. <div class="metadata-end-wrapper">
  86. <ion-button shape="round" size="small" color="danger">
  87. <ion-icon name="heart-outline" size="small"></ion-icon>
  88. {{attention?.get('like')}}
  89. </ion-button>
  90. </div>
  91. </ion-card>
  92. </ion-col>
  93. </ng-container>
  94. </ion-row>
  95. </ion-grid>
  96. </ng-container>
  97. </ion-content>