|
@@ -6,7 +6,8 @@ import { addIcons } from 'ionicons';
|
|
|
import { albumsOutline, documentOutline, leafOutline, scanOutline, storefrontOutline } from 'ionicons/icons';
|
|
|
import { IonButton, IonCard, IonCardContent, IonCardHeader, IonCol, IonContent, IonHeader, IonIcon, IonInput, IonRow, IonTextarea, IonTitle, IonToolbar, IonGrid, IonCardTitle, IonSearchbar,} from '@ionic/angular/standalone'; // 导入 Ionic 组件
|
|
|
import { CommonModule } from '@angular/common'; // 导入 CommonModule
|
|
|
-
|
|
|
+import { ImagePopupComponent } from '../image-popup/image-popup.component'; // 导入弹窗组件
|
|
|
+import { ModalController,NavController} from '@ionic/angular/standalone';
|
|
|
@Component({
|
|
|
selector: 'app-tab1',
|
|
|
templateUrl: 'tab1.page.html',
|
|
@@ -15,7 +16,7 @@ import { CommonModule } from '@angular/common'; // 导入 CommonModule
|
|
|
imports: [
|
|
|
CommonModule, IonContent, IonHeader, IonTitle, IonToolbar,
|
|
|
IonButton, IonTextarea, IonInput, IonCard, IonCardContent, IonGrid, IonRow, IonCol, IonIcon,
|
|
|
- IonCardHeader,IonCardTitle,IonSearchbar
|
|
|
+ IonCardHeader,IonCardTitle,IonSearchbar,
|
|
|
],
|
|
|
})
|
|
|
export class Tab1Page implements OnInit {
|
|
@@ -27,16 +28,16 @@ export class Tab1Page implements OnInit {
|
|
|
|
|
|
// 存储图片的数组
|
|
|
images = [
|
|
|
- 'https://example.com/image1.jpg',
|
|
|
- 'https://example.com/image2.jpg',
|
|
|
- 'https://example.com/image3.jpg',
|
|
|
- 'https://example.com/image4.jpg'
|
|
|
+ 'https://app.fmode.cn/dev/jxnu/202226701038/ssbt2022.jpg',
|
|
|
+ 'https://app.fmode.cn/dev/jxnu/202226701038/ssbt2022.jpg',
|
|
|
+ 'https://app.fmode.cn/dev/jxnu/202226701038/ssbt2022.jpg',
|
|
|
+ 'https://app.fmode.cn/dev/jxnu/202226701038/ssbt2022.jpg'
|
|
|
];
|
|
|
|
|
|
// 当前显示的幻灯片索引
|
|
|
currentSlide: number = 0;
|
|
|
|
|
|
- constructor(private router: Router) {
|
|
|
+ constructor(private router: Router, private modalCtrl: ModalController) {
|
|
|
addIcons({ scanOutline, documentOutline, storefrontOutline, albumsOutline, leafOutline });
|
|
|
this.cloudSeUser = new CloudSeUser();
|
|
|
}
|
|
@@ -121,6 +122,35 @@ export class Tab1Page implements OnInit {
|
|
|
});
|
|
|
}
|
|
|
|
|
|
+ // 打开弹窗
|
|
|
+async openImagePopup(imageUrl: string, description: string) {
|
|
|
+ try {
|
|
|
+ const modal = await this.modalCtrl.create({
|
|
|
+ component: ImagePopupComponent,
|
|
|
+ componentProps: { imageUrl, description }
|
|
|
+ });
|
|
|
+ await modal.present();
|
|
|
+ } catch (error) {
|
|
|
+ console.error('打开弹窗时出错', error); // 捕获并输出错误
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+ // 点击轮播图
|
|
|
+async onImageClick(index: number) {
|
|
|
+const descriptions = [
|
|
|
+ '<p><strong>第一张图片</strong>的描述内容。<br>这里有更多的文字,还可以使用 <em>斜体</em> 和 <u>下划线</u>。</p>',
|
|
|
+ '<p><strong>第二张图片</strong>的描述内容。<br>此描述支持更复杂的布局和<strong>加粗文本</strong>。</p>',
|
|
|
+ '<p><strong>第三张图片</strong>的描述内容。<br>您可以在这里插入更多的 <a href="#">链接</a> 或者其他 HTML 元素。</p>',
|
|
|
+ '<p><strong>第四张图片</strong>的描述内容。<br>支持多行内容和 <em>各种格式</em>。</p>'
|
|
|
+];
|
|
|
+
|
|
|
+
|
|
|
+ // 打开弹窗并传递描述
|
|
|
+ await this.openImagePopup(this.images[index], descriptions[index]);
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
// 前一个幻灯片
|
|
|
prevSlide() {
|
|
|
if (this.currentSlide > 0) {
|