|
@@ -1,6 +1,7 @@
|
|
import { Component } from '@angular/core';
|
|
import { Component } from '@angular/core';
|
|
import { IonHeader, IonToolbar, IonTitle, IonContent, IonSearchbar, IonIcon, IonTabButton, IonTabs, IonTabBar, IonLabel, IonMenu, IonList, IonItem, IonMenuButton } from '@ionic/angular/standalone';
|
|
import { IonHeader, IonToolbar, IonTitle, IonContent, IonSearchbar, IonIcon, IonTabButton, IonTabs, IonTabBar, IonLabel, IonMenu, IonList, IonItem, IonMenuButton } from '@ionic/angular/standalone';
|
|
import { Router } from '@angular/router';
|
|
import { Router } from '@angular/router';
|
|
|
|
+import { CommonModule } from '@angular/common';
|
|
|
|
|
|
@Component({
|
|
@Component({
|
|
selector: 'app-tab3',
|
|
selector: 'app-tab3',
|
|
@@ -8,6 +9,7 @@ import { Router } from '@angular/router';
|
|
styleUrls: ['tab3.page.scss'],
|
|
styleUrls: ['tab3.page.scss'],
|
|
standalone: true,
|
|
standalone: true,
|
|
imports: [
|
|
imports: [
|
|
|
|
+ CommonModule,
|
|
IonHeader, IonToolbar, IonTitle, IonContent,
|
|
IonHeader, IonToolbar, IonTitle, IonContent,
|
|
IonSearchbar, IonIcon, IonTabButton, IonTabs, IonTabBar, IonLabel,
|
|
IonSearchbar, IonIcon, IonTabButton, IonTabs, IonTabBar, IonLabel,
|
|
IonMenu, IonList, IonItem, IonMenuButton
|
|
IonMenu, IonList, IonItem, IonMenuButton
|
|
@@ -30,7 +32,7 @@ export class Tab3Page {
|
|
id: '2',
|
|
id: '2',
|
|
image: 'assets/img/xiangrikui.png',
|
|
image: 'assets/img/xiangrikui.png',
|
|
title: '梵高《向日葵》',
|
|
title: '梵高《向日葵》',
|
|
- description: '经典中的经典,笔触很牛!#花',
|
|
|
|
|
|
+ description: '经典中的经典,笔触很牛!',
|
|
avatarUrl: 'assets/img/book2.png',
|
|
avatarUrl: 'assets/img/book2.png',
|
|
userName: '艺术鉴赏家',
|
|
userName: '艺术鉴赏家',
|
|
date: '11-30',
|
|
date: '11-30',
|
|
@@ -52,7 +54,7 @@ export class Tab3Page {
|
|
id: '4',
|
|
id: '4',
|
|
image: 'assets/img/cunzhuang.png',
|
|
image: 'assets/img/cunzhuang.png',
|
|
title: '阿尔小镇',
|
|
title: '阿尔小镇',
|
|
- description: '走吧,梵高,去你最爱的阿尔看看,阿尔小镇',
|
|
|
|
|
|
+ description: '吧,梵高,去你最爱的阿尔看看,阿尔小镇',
|
|
avatarUrl: 'assets/img/book4.png',
|
|
avatarUrl: 'assets/img/book4.png',
|
|
userName: '风景画师',
|
|
userName: '风景画师',
|
|
date: '11-28',
|
|
date: '11-28',
|
|
@@ -73,20 +75,26 @@ export class Tab3Page {
|
|
});
|
|
});
|
|
const target = document.querySelector(`span[data-id="${text}"]`) as HTMLElement;
|
|
const target = document.querySelector(`span[data-id="${text}"]`) as HTMLElement;
|
|
if (target) {
|
|
if (target) {
|
|
- // target.style.textDecoration = 'underline';
|
|
|
|
- // target.style.textDecorationColor = 'red';
|
|
|
|
target.setAttribute('underline', 'true');
|
|
target.setAttribute('underline', 'true');
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
goToDetail(artId: string) {
|
|
goToDetail(artId: string) {
|
|
- console.log('Navigating to artwork:', artId);
|
|
|
|
- this.router.navigate(['/tabs/art-detail', artId], {
|
|
|
|
- state: { artwork: this.artworks.find(art => art.id === artId) }
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
|
|
+ console.log('Art ID:', artId);
|
|
|
|
+ const artwork = this.artworks.find(art => art.id === artId);
|
|
|
|
|
|
- goToCategory(category: string) {
|
|
|
|
- this.router.navigate(['/tabs/category', category]);
|
|
|
|
|
|
+ if (artwork) {
|
|
|
|
+ this.router.navigate(['/tabs/art-detail', artId], {
|
|
|
|
+ state: { artwork }
|
|
|
|
+ }).then(() => {
|
|
|
|
+ console.log('Navigation successful');
|
|
|
|
+ }).catch(err => {
|
|
|
|
+ console.error('Navigation failed:', err);
|
|
|
|
+ });
|
|
|
|
+ } else {
|
|
|
|
+ console.warn('Artwork not found for id:', artId);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+
|
|
}
|
|
}
|