import { Component } from '@angular/core';
import { Router } from '@angular/router';

@Component({
  selector: 'app-tab3',
  templateUrl: 'tab3.page.html',
  styleUrls: ['tab3.page.scss']
})
export class Tab3Page {

  cards = [
    { title: '我的订单', content: '查看全部', icon: 'document-text-outline' },
    { title: '积分中心', content: '答题赢积分', icon: 'trophy-outline' },
    { title: '我的勋章', content: '2枚勋章', icon: 'medal-outline' }
  ];

 
  currentTab: string = 'unpublished';
  userImage: string = 'https://via.placeholder.com/150'; // 默认图片地址

  onFileSelected(event: Event) {
    const inputElement = event.target as HTMLInputElement;
   if (inputElement.files && inputElement.files.length > 0) {
    const file = inputElement.files[0];
    const reader = new FileReader();
    reader.onload = () => {
      if (reader.result) {
        this.userImage = reader.result as string;
      }
    };
    reader.readAsDataURL(file);
  }

  }

  constructor(private router: Router) {}
  GoToLoginPage(){
    this.router.navigate(['./tab3/login'])
  }

}
