import { Component } from '@angular/core';
import { BannerCarousel } from '../pages-home/components/banner-carousel/banner-carousel';
import { QuickDesignEntry } from '../pages-home/components/quick-design-entry/quick-design-entry';
import { PopularDesigns } from '../pages-home/components/popular-designs/popular-designs';
import { AiRecommendation } from '../pages-home/components/ai-recommendation/ai-recommendation';
import { Router } from '@angular/router'; // 添加导入
@Component({
  selector: 'app-page-home',
  standalone: true,
  imports: [ BannerCarousel,
    QuickDesignEntry,
    PopularDesigns,
    AiRecommendation],
  templateUrl: './page-home.html',
  styleUrl: './page-home.scss'
})
export class PageHome {
constructor(private router: Router) {} // 注入Router服务

  // 导航到设计中心
  navigateToDesignCenter() {
     console.log('正在导航到设计中心');
    
    // 修正路径为 /cloth/design-center
    this.router.navigate(['/cloth', 'design-center'])
      .then(navResult => {
        if (navResult) {
          console.log('导航成功');
          window.scrollTo(0, 0); // 滚动到页面顶部
        } else {
          console.log('导航失败 - 路径未匹配');
        }
      })
      .catch(error => {
        console.error('导航错误:', error);
      });
  }
}
