|
|
@@ -3,11 +3,12 @@ import {
|
|
|
IonHeader, IonToolbar, IonTitle, IonContent,
|
|
|
IonButton, IonButtons, IonIcon, IonCard, IonCardHeader, IonCardTitle, IonCardContent,
|
|
|
IonItem, IonLabel, IonList, IonInput, IonTextarea, IonAvatar, IonSearchbar,
|
|
|
- ModalController} from '@ionic/angular/standalone';
|
|
|
+ ModalController,
|
|
|
+ IonSegment,} from '@ionic/angular/standalone';
|
|
|
import { ExploreContainerComponent } from '../explore-container/explore-container.component';
|
|
|
import { CommonModule } from '@angular/common';
|
|
|
import { openPostPublisherModal } from 'src/lib/public/post-publisher/post-publisher.component';
|
|
|
-import { CloudUser } from 'src/lib/ncloud';
|
|
|
+import { CloudObject, CloudPost, CloudQuery, CloudUser } from 'src/lib/ncloud';
|
|
|
import { openUserLoginModal } from 'src/lib/user/modal-user-login/modal-user-login.component';
|
|
|
|
|
|
@Component({
|
|
|
@@ -19,7 +20,7 @@ import { openUserLoginModal } from 'src/lib/user/modal-user-login/modal-user-log
|
|
|
CommonModule,
|
|
|
IonHeader, IonToolbar, IonTitle, IonContent, ExploreContainerComponent,
|
|
|
|
|
|
- IonButton, IonButtons, IonIcon,
|
|
|
+ IonButton, IonButtons, IonIcon,IonSegment,
|
|
|
|
|
|
IonCard, IonCardHeader, IonCardTitle, IonCardContent,
|
|
|
IonList, IonItem, IonLabel, IonAvatar, IonInput, IonTextarea,IonSearchbar
|
|
|
@@ -28,11 +29,29 @@ import { openUserLoginModal } from 'src/lib/user/modal-user-login/modal-user-log
|
|
|
})
|
|
|
export class Tab1Page {
|
|
|
currentUser:CloudUser|undefined
|
|
|
+ post:CloudPost|undefined
|
|
|
+
|
|
|
+
|
|
|
constructor(private modalCtrl:ModalController){
|
|
|
this.currentUser=new CloudUser();
|
|
|
+ this.post=new CloudPost();
|
|
|
}
|
|
|
|
|
|
|
|
|
+ ngOnInit() {
|
|
|
+ // 生命周期:页面加载后,运行帖子列表,加载函数
|
|
|
+ this.loadFilmPostList()
|
|
|
+ }
|
|
|
+
|
|
|
+ // 创建用于数据列表存储的属性
|
|
|
+ filmpostList:Array<CloudObject> = []
|
|
|
+
|
|
|
+ // 查询并加载列表的函数
|
|
|
+ async loadFilmPostList(){
|
|
|
+ let query = new CloudQuery("FilmPost");
|
|
|
+ this.filmpostList = await query.find()
|
|
|
+ }
|
|
|
+
|
|
|
async openPublishModal(){
|
|
|
|
|
|
if(!this.currentUser?.id){
|
|
|
@@ -41,47 +60,23 @@ async openPublishModal(){
|
|
|
if(this.currentUser?.id){
|
|
|
openPostPublisherModal(this.modalCtrl);
|
|
|
}
|
|
|
-
|
|
|
|
|
|
}
|
|
|
|
|
|
+ likePost() {
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ commentPost() {
|
|
|
+ // 评论逻辑
|
|
|
+ }
|
|
|
onSearch(event: any) {
|
|
|
const searchTerm = event.target.value; // 获取用户输入的搜索内容
|
|
|
console.log('搜索内容:', searchTerm);
|
|
|
// 在这里添加搜索逻辑,例如过滤列表或导航到搜索结果页面
|
|
|
}
|
|
|
|
|
|
- topics = [
|
|
|
- { title: '年度最佳剧集', participants: 120, popularity: '⭐⭐⭐⭐⭐' },
|
|
|
- { title: '经典电影回顾', participants: 80, popularity: '⭐⭐⭐⭐' },
|
|
|
- { title: '新剧推荐', participants: 200, popularity: '⭐⭐⭐⭐⭐⭐' },
|
|
|
- ];
|
|
|
-
|
|
|
- posts = [
|
|
|
- { title: '对《某某剧名》的看法', author: '用户A', comments: 5, popularity: '⭐⭐⭐⭐⭐' },
|
|
|
- { title: '最新剧集讨论', author: '用户B', comments: 2, popularity: '⭐⭐⭐⭐' },
|
|
|
- ];
|
|
|
|
|
|
- newPost = {
|
|
|
- title: '',
|
|
|
- content: ''
|
|
|
- };
|
|
|
|
|
|
- comments = [
|
|
|
- { username: '用户C', content: '我觉得这部剧非常精彩!', userAvatar: 'assets/avatar1.png' },
|
|
|
- { username: '用户D', content: '剧情发展很吸引人!', userAvatar: 'assets/avatar2.png' },
|
|
|
- ];
|
|
|
-
|
|
|
- submitPost() {
|
|
|
- if (this.newPost.title && this.newPost.content) {
|
|
|
- this.posts.push({
|
|
|
- title: this.newPost.title,
|
|
|
- author: '当前用户', // 这里可以替换为实际用户
|
|
|
- comments: 0,
|
|
|
- popularity: '⭐⭐' // 默认热度
|
|
|
- });
|
|
|
- this.newPost.title = '';
|
|
|
- this.newPost.content = '';
|
|
|
- }
|
|
|
- }
|
|
|
+
|
|
|
}
|