xukang 4 月之前
父節點
當前提交
1f82fa3c41
共有 2 個文件被更改,包括 6 次插入10 次删除
  1. 6 10
      newwisefitnessapp/src/app/discount-banner/discount-banner.component.ts
  2. 0 0
      wisefitness-prod/homework.md

+ 6 - 10
newwisefitnessapp/src/app/discount-banner/discount-banner.component.ts

@@ -1,19 +1,18 @@
 import { Component, OnInit, OnDestroy } from '@angular/core';
-import { IonicModule } from '@ionic/angular'; // 导入 IonicModule
+import { IonicModule } from '@ionic/angular';
 
 @Component({
   selector: 'app-discount-banner',
   templateUrl: './discount-banner.component.html',
   styleUrls: ['./discount-banner.component.scss'],
-  standalone: true,  // 确保组件是独立组件
-  imports: [IonicModule],  // 引入 Ionic 模块
+  standalone: true,
+  imports: [IonicModule],
 })
 export class DiscountBannerComponent implements OnInit, OnDestroy {
-  countdown: string = '';  // 倒计时字符串
-  private countdownInterval: any;  // 保存计时器引用
-
+  countdown: string = '';
+  private countdownInterval: any;
   ngOnInit() {
-    const endTime = new Date('2024-12-01T00:00:00');  // 活动结束时间
+    const endTime = new Date('2025-01-01T00:00:00');
     this.countdownInterval = setInterval(() => {
       const now = new Date();
       const diff = endTime.getTime() - now.getTime();
@@ -21,14 +20,11 @@ export class DiscountBannerComponent implements OnInit, OnDestroy {
       const hours = Math.floor((diff / (1000 * 60 * 60)) % 24);
       const minutes = Math.floor((diff / (1000 * 60)) % 60);
       const seconds = Math.floor((diff / 1000) % 60);
-
-      // 更新倒计时字符串
       this.countdown = `${days}天 ${hours}小时 ${minutes}分 ${seconds}秒`;
     }, 1000);
   }
 
   ngOnDestroy() {
-    // 清除计时器
     if (this.countdownInterval) {
       clearInterval(this.countdownInterval);
     }

+ 0 - 0
wisefitness-prod/homework.md