0225268 пре 4 месеци
родитељ
комит
a9c5e5ce81
6 измењених фајлова са 45 додато и 19 уклоњено
  1. 16 16
      src/app/tab3/tab3.page.html
  2. 29 3
      src/app/tab3/tab3.page.ts
  3. BIN
      src/assets/img/e.png
  4. BIN
      src/assets/img/f.png
  5. BIN
      src/assets/img/g.png
  6. BIN
      src/assets/img/xt.jpg

+ 16 - 16
src/app/tab3/tab3.page.html

@@ -52,17 +52,17 @@
         <ion-img src="assets/img/b.png"></ion-img>
       </ion-avatar>
       <ion-label>
-        <h2>用户名</h2>
-        <p>这是一条评论内容</p>
+        <h2>小刘爱装修</h2>
+        <p>你觉得这个设计怎么样</p>
       </ion-label>
     </ion-item>
     <ion-item>
       <ion-avatar slot="start">
-        <ion-img src="https://img2.baidu.com/it/u=2453029165,1962533557&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=500"></ion-img>
+        <ion-img src="assets/img/g.png"></ion-img>
       </ion-avatar>
       <ion-label>
-        <h2>回复者用户名</h2>
-        <p>这是一条回复内容</p>
+        <h2>西瓜</h2>
+        <p>你好呀,想咨询点事</p>
       </ion-label>
     </ion-item>
     <ion-item>
@@ -75,11 +75,11 @@
    <div *ngIf="activeTab === 'video'">
     <ion-item>
       <ion-avatar slot="start">
-        <ion-img src="assets/avatar1.jpg"></ion-img>
+        <ion-img src="assets/img/e.png"></ion-img>
       </ion-avatar>
       <ion-label>
-        <h2>用户名1</h2>
-        <p>这是一条内容1</p>
+        <h2>小雨</h2>
+        <p>1</p>
       </ion-label>
       <ion-buttons slot="end">
         <ion-button (click)="likePost(1)">
@@ -92,11 +92,11 @@
     </ion-item>
     <ion-item>
       <ion-avatar slot="start">
-        <ion-img src="assets/avatar2.jpg"></ion-img>
+        <ion-img src="assets/img/f.png"></ion-img>
       </ion-avatar>
       <ion-label>
-        <h2>用户名2</h2>
-        <p>这是一条内容2</p>
+        <h2>疯狂动物</h2>
+        <p>2</p>
       </ion-label>
       <ion-buttons slot="end">
         <ion-button (click)="likePost(2)">
@@ -111,10 +111,10 @@
    <div *ngIf="activeTab === 'search'">
     <ion-item>
       <ion-avatar slot="start">
-        <ion-img src="assets/avatar1.jpg"></ion-img>
+        <ion-img src="assets/img/a.png"></ion-img>
       </ion-avatar>
       <ion-label>
-        <h2>用户名1</h2>
+        <h2>海底</h2>
         <p>这是一条内容1</p>
       </ion-label>
       <ion-button slot="end" (click)="toggleFollow(1)" color="primary" [fill]="isUserFollowed(1) ? 'solid' : 'outline'">
@@ -124,7 +124,7 @@
 
     <ion-item>
       <ion-avatar slot="start">
-        <ion-img src="assets/avatar2.jpg"></ion-img>
+        <ion-img src="assets/img/b.png"></ion-img>
       </ion-avatar>
       <ion-label>
         <h2>用户名2</h2>
@@ -138,7 +138,7 @@
    <div *ngIf="activeTab === 'system'">
     <ion-item>
       <ion-avatar slot="start">
-        <ion-img src="assets/avatar1.jpg"></ion-img>
+        <ion-img src="assets/img/xt.jpg"></ion-img>
       </ion-avatar>
       <ion-label>
         <h2>系统消息标题1</h2>
@@ -148,7 +148,7 @@
 
     <ion-item>
       <ion-avatar slot="start">
-        <ion-img src="assets/avatar2.jpg"></ion-img>
+        <ion-img src="assets/img/xt.jpg"></ion-img>
       </ion-avatar>
       <ion-label>
         <h2>系统消息标题2</h2>

+ 29 - 3
src/app/tab3/tab3.page.ts

@@ -1,15 +1,40 @@
-import { Component } from '@angular/core';
+import { Component, ElementRef, OnInit, ViewChild } from '@angular/core';
 import { Router } from '@angular/router';
 import { ToastController } from '@ionic/angular';
 
+import Swiper from 'swiper';
+
 
 @Component({
   selector: 'app-tab3',
   templateUrl: 'tab3.page.html',
   styleUrls: ['tab3.page.scss']
 })
-export class Tab3Page {
-
+export class Tab3Page implements OnInit {
+  @ViewChild("slide1Comp") slide1Comp:ElementRef |undefined
+  ngOnInit() {
+    // 延迟500毫秒加载
+    setTimeout(() => {
+      this.initSwiper();
+    }, 500);
+    }
+    slide1:Swiper|undefined
+initSwiper(){
+console.log(this.slide1Comp)
+this.slide1 = new Swiper(this.slide1Comp?.nativeElement, {
+  loop:true,
+  autoplay:{
+    delay:500,
+  },
+  mousewheel: {
+    forceToAxis: true,
+  },
+  pagination:{
+    el:".swiper-pagination",
+    clickable:true
+  }
+});
+}
   constructor(private toastController: ToastController,private router: Router) {}
 
   activeTab:string = 'explore';
@@ -76,4 +101,5 @@ export class Tab3Page {
   goToAIChatPage() {
     this.router.navigate(['/aichat']); // 导航到AI对话页面
   }
+  
 }

BIN
src/assets/img/e.png


BIN
src/assets/img/f.png


BIN
src/assets/img/g.png


BIN
src/assets/img/xt.jpg