123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134 |
- import { Component } from '@angular/core';
- import {
- IonHeader, IonToolbar, IonTitle, IonButtons, IonButton, IonIcon,
- IonContent, IonCard, IonCardHeader, IonCardTitle, IonCardSubtitle,
- IonCardContent, IonProgressBar, IonGrid, IonRow, IonCol, IonListHeader,
- IonLabel, IonList, IonItem, IonAvatar, IonBadge, IonFab, IonFabButton
- } from '@ionic/angular/standalone';
- import { addIcons } from 'ionicons';
- import {
- notificationsOutline, calendarNumber, checkmarkCircle, ellipseOutline,
- timeOutline, barbell, body, walk, add, refresh, fitness
- } from 'ionicons/icons';
- @Component({
- selector: 'app-tab2',
- templateUrl: 'tab2.page.html',
- styleUrls: ['tab2.page.scss'],
- standalone: true,
- imports: [
- IonHeader, IonToolbar, IonTitle, IonButtons, IonButton, IonIcon,
- IonContent, IonCard, IonCardHeader, IonCardTitle, IonCardSubtitle,
- IonCardContent, IonProgressBar, IonGrid, IonRow, IonCol, IonListHeader,
- IonLabel, IonList, IonItem, IonAvatar, IonBadge, IonFab, IonFabButton
- ]
- })
- export class Tab2Page {
- // 周训练数据
- weekDays = [
- { shortName: '周一', name: 'Monday', trained: true, active: false },
- { shortName: '周二', name: 'Tuesday', trained: false, active: true },
- { shortName: '周三', name: 'Wednesday', trained: true, active: false },
- { shortName: '周四', name: 'Thursday', trained: false, active: false },
- { shortName: '周五', name: 'Friday', trained: false, active: false },
- { shortName: '周六', name: 'Saturday', trained: false, active: false },
- { shortName: '周日', name: 'Sunday', trained: false, active: false }
- ];
- // 计算属性
- get completedWorkouts(): number {
- return this.weekDays.filter(day => day.trained).length;
- }
- get totalWorkouts(): number {
- return this.weekDays.length;
- }
- get completionRate(): number {
- return this.completedWorkouts / this.totalWorkouts;
- }
- // 推荐计划
- recommendedPlans = [
- {
- name: '全身燃脂训练',
- duration: 28,
- difficulty: '中级',
- image: 'assets/images/work-1.jpg', // 可以替换为实际图片路径
- isNew: true
- },
- {
- name: '核心力量提升',
- duration: 35,
- difficulty: '高级',
- image: 'assets/images/work-1.jpg', // 可以替换为实际图片路径
- isNew: false
- },
- {
- name: '瑜伽晨间唤醒',
- duration: 20,
- difficulty: '初级',
- image: 'assets/images/work-1.jpg', // 可以替换为实际图片路径
- isNew: true
- }
- ];
- // 我的计划
- myPlans = [
- {
- name: '30天减脂挑战',
- progress: 65,
- nextTime: '明天 7:00',
- remaining: 12,
- icon: 'barbell'
- },
- {
- name: '上肢力量训练',
- progress: 30,
- nextTime: '后天 19:30',
- remaining: 5,
- icon: 'body'
- },
- {
- name: '晨跑计划',
- progress: 80,
- nextTime: '今天 6:00',
- remaining: 3,
- icon: 'walk'
- }
- ];
- constructor() {
- addIcons({
- notificationsOutline,
- calendarNumber,
- checkmarkCircle,
- ellipseOutline,
- timeOutline,
- barbell,
- body,
- walk,
- add,
- refresh,
- fitness
- });
- }
- // 刷新计划
- refreshPlans() {
- console.log('刷新计划数据');
- // 这里可以添加实际刷新逻辑
- }
- // 打开计划详情
- openPlan(plan: any) {
- console.log('打开计划:', plan.name);
- // 这里可以添加导航逻辑
- }
- // 创建新计划
- createNewPlan() {
- console.log('创建新计划');
- // 这里可以添加创建逻辑
- }
- }
|