123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- import { Component, OnInit } from '@angular/core';
- import { ActivatedRoute } from '@angular/router';
- import { NavController } from '@ionic/angular';
- @Component({
- selector: 'app-eye-exam',
- templateUrl: './eye-exam.page.html',
- styleUrls: ['./eye-exam.page.scss']
- })
- export class EyeExamPage implements OnInit {
- index: number = -1;
- report: any;
- constructor(private route: ActivatedRoute, private navController: NavController) {}
- ngOnInit() {
- const paramMap = this.route.snapshot.paramMap;
- if (paramMap) {
- const indexParam = paramMap.get('index');
- if (indexParam !== null) {
- this.index = +indexParam;
-
- this.report = this.getReportData(this.index);
- } else {
- console.error('Invalid index parameter.');
- }
- } else {
- console.error('Route snapshot paramMap is null or undefined.');
- }
- }
- getReportData(index: number): any {
-
- return {
- title: '眼科检查报告',
- date: new Date(),
- details: '视力良好,无异常。建议定期复查。',
- attachments: [
- { url: '../../assets/images/eye1.jpg', name: '附件1' },
- { url: '../../assets/images/eye2.jpg', name: '附件2' }
- ]
- };
- }
- goBack() {
- this.navController.navigateBack('/tabs/tab3');
- }
- }
|