|
@@ -21,105 +21,108 @@
|
|
|
<div style="height: 56px;"></div>
|
|
|
<!-- 打卡 -->
|
|
|
<div *ngIf="selectedTab === 'checkin'" class="checkin">
|
|
|
- <ion-card-content *ngFor="let user of planUser">
|
|
|
- <ion-card>
|
|
|
- <ion-card-header>
|
|
|
- <ion-card-title>欢迎回来!{{ user.get('name') }}</ion-card-title>
|
|
|
- </ion-card-header>
|
|
|
- <ion-card-content>
|
|
|
- <div class="greeting-container">
|
|
|
- <!-- 头像和信息容器 -->
|
|
|
- <div class="avatar-info-container">
|
|
|
- <!-- 头像部分 -->
|
|
|
- <div class="avatar-container">
|
|
|
- <img [src]="user.get('avater')" alt="用户头像" class="avatar">
|
|
|
+ <ng-container *ngIf="planUser && planUser.length > 0; else noUserContent">
|
|
|
+ <ion-card-content *ngFor="let user of planUser">
|
|
|
+ <ion-card>
|
|
|
+ <ion-card-header>
|
|
|
+ <ion-card-title>欢迎回来!{{ user.get('name') }}</ion-card-title>
|
|
|
+ </ion-card-header>
|
|
|
+ <ion-card-content>
|
|
|
+ <div class="greeting-container">
|
|
|
+ <div class="avatar-info-container">
|
|
|
+ <div class="avatar-container">
|
|
|
+ <img [src]="user.get('avater')" alt="用户头像" class="avatar">
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="user-info">
|
|
|
+ <ion-card>
|
|
|
+ <ion-card-content>
|
|
|
+ <p><strong>身高:</strong>{{ user.get('height') }} cm</p>
|
|
|
+ <p><strong>体重:</strong>{{ user.get('weight') }} kg</p>
|
|
|
+ <p><strong>BMI:</strong>{{ calculateBMI(user.get('height'), user.get('weight')) }}</p>
|
|
|
+ <p><strong>运动目标:</strong>{{ user.get('fitnessGoals') }}</p>
|
|
|
+ </ion-card-content>
|
|
|
+ </ion-card>
|
|
|
+ <ion-label>{{ getEncouragement(calculateBMI(user.get('height'), user.get('weight'))) }}</ion-label>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
+ </div>
|
|
|
+ </ion-card-content>
|
|
|
+ </ion-card>
|
|
|
|
|
|
- <!-- 用户信息部分 -->
|
|
|
- <div class="user-info">
|
|
|
- <ion-card>
|
|
|
- <ion-card-content>
|
|
|
- <p><strong>身高:</strong>{{ user.get('height') }} cm</p>
|
|
|
- <p><strong>体重:</strong>{{ user.get('weight') }} kg</p>
|
|
|
- <p><strong>BMI:</strong>{{ calculateBMI(user.get('height'), user.get('weight')) }}</p>
|
|
|
- <p><strong>运动目标:</strong>{{ user.get('fitnessGoals') }}</p>
|
|
|
- </ion-card-content>
|
|
|
- </ion-card>
|
|
|
- <ion-label>{{ getEncouragement(calculateBMI(user.get('height'), user.get('weight'))) }}</ion-label>
|
|
|
+ <ion-card>
|
|
|
+ <ion-card-header>
|
|
|
+ <ion-card-title>打卡区域</ion-card-title>
|
|
|
+ <div class="power-label">
|
|
|
+ <strong>我的动能</strong>
|
|
|
+ <p class="stat-value">{{ user.get('power') }}</p>
|
|
|
+ </div>
|
|
|
+ </ion-card-header>
|
|
|
+ <ion-card-content>
|
|
|
+ <ion-datetime [value]="realDate.toISOString()" (ionChange)="onDateChange($event)">
|
|
|
+ </ion-datetime>
|
|
|
+ <div class="card-info">
|
|
|
+ <ion-button [disabled]="getButtonState(realDate).isDisabled"
|
|
|
+ (click)="getButtonState(realDate).buttonText === '补签' ? handleMakeupClick() : markAttendance()"
|
|
|
+ class="check">
|
|
|
+ {{ getButtonState(realDate).buttonText }}
|
|
|
+ </ion-button>
|
|
|
+ </div>
|
|
|
+ <div class="card-stats">
|
|
|
+ <div class="stat-item">
|
|
|
+ <p><strong>已打卡天数</strong></p>
|
|
|
+ <p class="stat-value">{{ user.get('days') }}</p>
|
|
|
+ </div>
|
|
|
+ <div class="stat-item">
|
|
|
+ <p><strong>连续打卡天数</strong></p>
|
|
|
+ <p class="stat-value">{{ user.get('sucdays') }}</p>
|
|
|
</div>
|
|
|
</div>
|
|
|
- </div>
|
|
|
- </ion-card-content>
|
|
|
- </ion-card>
|
|
|
+ </ion-card-content>
|
|
|
+ </ion-card>
|
|
|
+ </ion-card-content>
|
|
|
+ </ng-container>
|
|
|
|
|
|
+ <ng-template #noUserContent>
|
|
|
<ion-card>
|
|
|
<ion-card-header>
|
|
|
- <ion-card-title>打卡区域</ion-card-title>
|
|
|
- <div class="power-label">
|
|
|
- <strong>我的动能</strong>
|
|
|
- <p class="stat-value">{{ user.get('power') }}</p>
|
|
|
- </div>
|
|
|
+ <ion-card-title>没有用户数据</ion-card-title>
|
|
|
</ion-card-header>
|
|
|
<ion-card-content>
|
|
|
- <ion-datetime [value]="realDate.toISOString()" (ionChange)="onDateChange($event)">
|
|
|
- </ion-datetime>
|
|
|
- <div class="card-info">
|
|
|
- <ion-button [disabled]="getButtonState(realDate).isDisabled"
|
|
|
- (click)="getButtonState(realDate).buttonText === '补签' ? handleMakeupClick() : markAttendance()"
|
|
|
- class="check">
|
|
|
- {{ getButtonState(realDate).buttonText }}
|
|
|
- </ion-button>
|
|
|
- </div>
|
|
|
- <div class="card-stats">
|
|
|
- <div class="stat-item">
|
|
|
- <p><strong>已打卡天数</strong></p>
|
|
|
-
|
|
|
- <p class="stat-value">{{ user.get('days') }}</p>
|
|
|
-
|
|
|
- </div>
|
|
|
- <div class="stat-item">
|
|
|
- <p><strong>连续打卡天数</strong></p>
|
|
|
-
|
|
|
- <p class="stat-value">{{ user.get('sucdays') }}</p>
|
|
|
-
|
|
|
- </div>
|
|
|
- </div>
|
|
|
-
|
|
|
+ <p>当前没有用户信息,请稍后再试。</p>
|
|
|
</ion-card-content>
|
|
|
</ion-card>
|
|
|
+ </ng-template>
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- <ion-card>
|
|
|
- <!-- 未登录 -->
|
|
|
+ <ion-card>
|
|
|
+ <!-- 未登录 -->
|
|
|
+ @if(!currentUser?.id){
|
|
|
+ <ion-card-header>
|
|
|
+ <ion-card-title>请登录</ion-card-title>
|
|
|
+ <ion-card-subtitle>暂无信息</ion-card-subtitle>
|
|
|
+ </ion-card-header>
|
|
|
+ }
|
|
|
+ <!-- 未登录 -->
|
|
|
+ @if(currentUser?.id){
|
|
|
+ <ion-card-header>
|
|
|
+ <ion-card-title>{{currentUser?.get("username")}} {{currentUser?.get("realname")}}</ion-card-title>
|
|
|
+ <ion-card-subtitle>性别:{{currentUser?.get("gender")||"-"}} 年龄:{{currentUser?.get("age")||"-"}}
|
|
|
+ </ion-card-subtitle>
|
|
|
+ </ion-card-header>
|
|
|
+ }
|
|
|
+ <ion-card-content>
|
|
|
@if(!currentUser?.id){
|
|
|
- <ion-card-header>
|
|
|
- <ion-card-title>请登录</ion-card-title>
|
|
|
- <ion-card-subtitle>暂无信息</ion-card-subtitle>
|
|
|
- </ion-card-header>
|
|
|
+ <ion-button expand="block" (click)="signup()">注册</ion-button>
|
|
|
+ <ion-button expand="block" (click)="login()">登录</ion-button>
|
|
|
}
|
|
|
- <!-- 未登录 -->
|
|
|
@if(currentUser?.id){
|
|
|
- <ion-card-header>
|
|
|
- <ion-card-title>{{currentUser?.get("username")}} {{currentUser?.get("realname")}}</ion-card-title>
|
|
|
- <ion-card-subtitle>性别:{{currentUser?.get("gender")||"-"}} 年龄:{{currentUser?.get("age")||"-"}}
|
|
|
- </ion-card-subtitle>
|
|
|
- </ion-card-header>
|
|
|
+ <ion-button expand="block" (click)="editUser()">编辑资料</ion-button>
|
|
|
+ <ion-button expand="block" (click)="logout()" color="light">登出</ion-button>
|
|
|
}
|
|
|
- <ion-card-content>
|
|
|
- @if(!currentUser?.id){
|
|
|
- <ion-button expand="block" (click)="signup()">注册</ion-button>
|
|
|
- <ion-button expand="block" (click)="login()">登录</ion-button>
|
|
|
- }
|
|
|
- @if(currentUser?.id){
|
|
|
- <ion-button expand="block" (click)="editUser()">编辑资料</ion-button>
|
|
|
- <ion-button expand="block" (click)="logout()" color="light">登出</ion-button>
|
|
|
- }
|
|
|
- </ion-card-content>
|
|
|
- </ion-card>
|
|
|
- </ion-card-content>
|
|
|
+ </ion-card-content>
|
|
|
+ </ion-card>
|
|
|
+
|
|
|
</div>
|
|
|
|
|
|
<!-- 计划 -->
|