import { Component } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { IonicModule } from '@ionic/angular';
import { Router } from '@angular/router';

@Component({
  selector: 'app-tab1',
  standalone: true,
  imports: [CommonModule, FormsModule, IonicModule],
  templateUrl: 'tab1.page.html',
  styleUrls: ['tab1.page.scss'],
})
export class Tab1Page {
  searchText = '';
  activeTab = '首页';
  activeBottomTab = '首页';

  tabList = [
    '首页', '拍卖', '推荐', '最新上架', '热门关注', '饰品租赁',
    '挂刀推荐', '趋势榜单', '特殊磨损', '宝石刀', '打包专区'
  ];

  bottomTabs = ['首页', '分类', '消息', '我的'];

  items = [
    { name: 'AWP | 二西莫夫 (崭新出厂)', wear: '0.012345', price: '1,3131.00', image: 'assets/images/AWP.jpg' },
    { name: 'M4A4 | 二西莫夫 (久经沙场)', wear: '0.234567', price: '599.00', image: 'assets/images/A4.jpg' },
    { name: 'AK-47 | 燃料喷射器 (略有磨损)', wear: '0.123456', price: '899.00', image: 'assets/images/AK2.jpg' },
    { name: '手套 | 深红之网 (战痕累累)', wear: '0.456789', price: '2,499.00', image: 'assets/images/Glove.jpg' },
    { name: '蝴蝶刀 | 渐变大理石 (崭新出厂)', wear: '0.001234', price: '5,999.00', image: 'assets/images/Knife.jpg' },
    { name: '沙漠之鹰 | 印花集 (崭新出厂)', wear: '0.012345', price: '399.00', image: 'assets/images/Degou.jpg' }
  ];

  
 
  selectTab(tab: string) {
    this.activeTab = tab;
    console.log('切换标签:', tab);
  }

  selectBottomTab(tab: string) {
    this.activeBottomTab = tab;
    console.log('切换底部Tab:', tab);
  }

  onSearchByCamera() {
    console.log('使用相机搜索:', this.searchText);
  }

  onSearchByScan() {
    console.log('使用扫码搜索:', this.searchText);
  }

  onFeatureClick(feature: string) {
    console.log('点击功能按钮:', feature);
  }

 
  onLogout() {
    console.log('退出登录');
  }

  onProfile() {
    console.log('进入个人中心');
  }
  constructor(private router: Router) {}
   onItemClick(item: any) {
    console.log('点击了item:', item);
    this.router.navigate(['/item-detail'], { state: { item } });
  }
}
