| 
					
				 | 
			
			
				@@ -1,42 +1,49 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import { Component, OnInit } from '@angular/core'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import { IonButton, IonCard, IonCardHeader, IonCardSubtitle, IonCardTitle, IonContent, IonHeader, IonIcon, IonInput, IonItem, IonList, IonTitle, IonToolbar } from '@ionic/angular/standalone'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import { IonCardContent,IonLabel } from '@ionic/angular/standalone'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import { IonAvatar, IonButton, IonCard, IonCardHeader, IonCardSubtitle, IonCardTitle, IonContent, IonHeader, IonIcon, IonInput, IonItem, IonList, IonTitle, IonToolbar } from '@ionic/angular/standalone'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import { FormsModule } from '@angular/forms'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import { CommonModule } from '@angular/common'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import { NavigationExtras, Router } from '@angular/router'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import { PostService } from '../post.service'; // 导入服务 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import { IonButtons } from '@ionic/angular/standalone'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import { IonCardContent } from '@ionic/angular/standalone'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 @Component({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   selector: 'app-community', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   templateUrl: './community.page.html', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   styleUrls: ['./community.page.scss'], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   standalone: true, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  imports: [IonHeader,IonToolbar,IonTitle,IonContent,IonList,IonCard,IonCardHeader, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    IonCardTitle,IonCardSubtitle,IonItem,IonInput,IonButton,IonIcon,IonCardContent, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    FormsModule,CommonModule,IonLabel 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  imports: [IonHeader,IonToolbar,IonButtons,IonIcon,IonButton,IonContent,IonCard,IonCardHeader, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    IonItem,IonAvatar,IonCardTitle,IonCardSubtitle,FormsModule,CommonModule,IonCardContent,IonTitle 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     ], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 export class CommunityPage implements OnInit { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  comments: { username: string; date: Date; text: string }[] = []; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  newComment: string = ''; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  posts: { id: number; username: string; date: Date; text: string; imageUrl?: string; avatarUrl?: string }[] = []; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  constructor() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    this.comments = [ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      { username: '用户1', date: new Date(), text: '这件衣服真好看!' }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      { username: '用户2', date: new Date(), text: '我也想要一件!' }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    ]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  addComment() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    if (this.newComment.trim()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      const newCommentObj = { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        username: '当前用户', // 可以替换为实际的用户名 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        date: new Date(), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        text: this.newComment, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      this.comments.push(newCommentObj); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      this.newComment = ''; // 清空输入框 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  constructor(private router: Router,private postService: PostService) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   ngOnInit() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    this.posts = this.postService.getPosts(); // 从服务中获取动态数据// 这里可以进行数据的初始化或获取 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  // viewPost(postId: number) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  //   const state: any = {  postId:  postId }; // 你要传递的对象数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  //   const navigationExtras: NavigationExtras = { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  //     state: state 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  //   }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  //   console.log("state::",state); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-     
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  //   this.router.navigate(['/tabs/post-page', postId]); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  //   // this.router.navigate(['/tabs/post-page', postId]); // 导航到动态详情页面 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  // } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  viewPost(postId: number) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    // 直接导航到动态详情页面 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    this.router.navigate(['/tabs/post-page', postId]); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  sharePost() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    this.router.navigate(['/tabs/share-page']); // 导航到分享动态页面 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 |