|
|
@@ -2,6 +2,7 @@ import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
|
|
import { IonHeader, IonToolbar, IonTitle, IonContent, IonButton, IonCard, IonCardHeader, IonCardTitle, IonCardContent, IonItem, IonLabel, IonList, IonInput, IonTextarea, IonAvatar } from '@ionic/angular/standalone';
|
|
|
import { ExploreContainerComponent } from '../explore-container/explore-container.component';
|
|
|
import { CommonModule } from '@angular/common';
|
|
|
+import { Router } from '@angular/router';
|
|
|
|
|
|
@Component({
|
|
|
selector: 'app-tab1',
|
|
|
@@ -17,6 +18,45 @@ import { CommonModule } from '@angular/common';
|
|
|
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
|
|
})
|
|
|
export class Tab1Page {
|
|
|
+ /**
|
|
|
+ * 轮播图
|
|
|
+ */
|
|
|
+ images = [
|
|
|
+ 'https://picsum.photos/800/400?random=19',
|
|
|
+ 'https://picsum.photos/800/400?random=18',
|
|
|
+ 'https://picsum.photos/800/400?random=17',
|
|
|
+ 'https://picsum.photos/800/400?random=15',
|
|
|
+ 'https://picsum.photos/800/400?random=13',
|
|
|
+ 'https://picsum.photos/800/400?random=14',
|
|
|
+ ];
|
|
|
+ currentSlide = 0;
|
|
|
+ intervalId: any;
|
|
|
+ setSlidePosition() {
|
|
|
+ // 这里不需要额外的逻辑,因为在 HTML 中已经通过绑定实现
|
|
|
+ }
|
|
|
+
|
|
|
+ nextSlide() {
|
|
|
+ this.currentSlide = (this.currentSlide + 1) % this.images.length;
|
|
|
+ }
|
|
|
+
|
|
|
+ prevSlide() {
|
|
|
+ this.currentSlide = (this.currentSlide - 1 + this.images.length) % this.images.length;
|
|
|
+ }
|
|
|
+
|
|
|
+ goToSlide(index: number) {
|
|
|
+ this.currentSlide = index;
|
|
|
+ }
|
|
|
+
|
|
|
+ startAutoSlide() {
|
|
|
+ this.intervalId = setInterval(() => this.nextSlide(), 3000);
|
|
|
+ }
|
|
|
+ ngOnDestroy() {
|
|
|
+ if (this.intervalId) {
|
|
|
+ clearInterval(this.intervalId);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ constructor(private router: Router,) {}
|
|
|
topics = [
|
|
|
{ title: '如何更好练习球性', participants: 120 },
|
|
|
{ title: '经典招式学习', participants: 80 },
|
|
|
@@ -41,6 +81,9 @@ export class Tab1Page {
|
|
|
this.newPost.content = '';
|
|
|
}
|
|
|
}
|
|
|
+ gototab9(){
|
|
|
+ this.router.navigate(["tabs/tab9"])
|
|
|
+ }
|
|
|
|
|
|
selectCoach(coach: any) {
|
|
|
console.log(`选择了教练: ${coach.name},风格: ${coach.style}`);
|
|
|
@@ -52,4 +95,6 @@ export class Tab1Page {
|
|
|
console.log('搜索内容:', searchTerm);
|
|
|
// 在这里添加搜索逻辑,例如过滤列表或导航到搜索结果页面
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
+
|