|
@@ -1,12 +1,78 @@
|
|
|
+// import { Component } from '@angular/core';
|
|
|
+// import { Router } from '@angular/router';
|
|
|
+
|
|
|
+// @Component({
|
|
|
+// selector: 'app-tab2',
|
|
|
+// templateUrl: 'tab2.page.html',
|
|
|
+// styleUrls: ['tab2.page.scss']
|
|
|
+// })
|
|
|
+// export class Tab2Page {
|
|
|
+// selectedCategory: string = 'default';
|
|
|
+
|
|
|
+// books = [
|
|
|
+// { title: '人才战略', image: 'assets/images/book1.jpg' },
|
|
|
+// { title: 'Book 2', image: 'assets/book2.jpg' },
|
|
|
+// { title: 'Book 3', image: 'assets/book3.jpg' },
|
|
|
+// { title: 'Book 4', image: 'assets/book4.jpg' },
|
|
|
+// { title: 'Book 5', image: 'assets/book5.jpg' },
|
|
|
+// { title: 'Book 6', image: 'assets/book6.jpg' }
|
|
|
+// ];
|
|
|
+
|
|
|
+// constructor(private router: Router) {}
|
|
|
+
|
|
|
+// segmentChanged() {
|
|
|
+// // Handle segment change logic here
|
|
|
+// }
|
|
|
+
|
|
|
+// viewBookDetail(book: any) {
|
|
|
+// // 实现跳转到书籍详情页面的逻辑
|
|
|
+// this.router.navigate(['/book-detail', book.id]); // 假设路由为 '/book-detail/:id'
|
|
|
+// }
|
|
|
+// }
|
|
|
+
|
|
|
import { Component } from '@angular/core';
|
|
|
+import { NavController } from '@ionic/angular';
|
|
|
|
|
|
@Component({
|
|
|
selector: 'app-tab2',
|
|
|
templateUrl: 'tab2.page.html',
|
|
|
- styleUrls: ['tab2.page.scss']
|
|
|
+ styleUrls: ['tab2.page.scss'],
|
|
|
})
|
|
|
export class Tab2Page {
|
|
|
+ bookRows: any[] = [];
|
|
|
+ currentCategory: string = 'default';
|
|
|
+
|
|
|
+ constructor(private navCtrl: NavController) {
|
|
|
+ this.loadBooks();
|
|
|
+ }
|
|
|
+
|
|
|
+ loadBooks() {
|
|
|
+ // 根据不同分类加载不同的书籍数据
|
|
|
+ // 示例数据,您需要根据实际情况进行替换
|
|
|
+ this.bookRows = [
|
|
|
+ [
|
|
|
+ { imageUrl: 'assets/images/book1.jpg', title: '人才战略' },
|
|
|
+ { imageUrl: 'assets/images/book2.jpg', title: '神秘岛' },
|
|
|
+ { imageUrl: 'assets/images/book3.jpg', title: '快乐王子' },
|
|
|
+ { imageUrl: 'assets/images/book4.jpg', title: '西游记' },
|
|
|
+ { imageUrl: 'assets/images/book5.jpg', title: '易经' },
|
|
|
+ { imageUrl: 'assets/images/book6.jpg', title: '呐喊' },
|
|
|
+ { imageUrl: 'assets/images/book7.jpg', title: '三国演义' },
|
|
|
+ { imageUrl: 'assets/images/book8.jpg', title: 'TOM历险记' },
|
|
|
+ { imageUrl: 'assets/images/book9.jpg', title: '神秘岛2' },
|
|
|
+ { imageUrl: 'assets/images/book10.jpg', title: '诗经' }
|
|
|
+ ],
|
|
|
+ // 其他分类的书籍数据...
|
|
|
+ ];
|
|
|
+ }
|
|
|
|
|
|
- constructor() {}
|
|
|
+ segmentChanged(event: any) {
|
|
|
+ this.currentCategory = event.detail.value;
|
|
|
+ this.loadBooks();
|
|
|
+ }
|
|
|
|
|
|
-}
|
|
|
+ goToBookDetail(book: any) {
|
|
|
+ // 导航至书籍详情页面
|
|
|
+ this.navCtrl.navigateForward(`/book-detail`);
|
|
|
+ }
|
|
|
+}
|