|
@@ -1,7 +1,7 @@
|
|
|
import { CommonModule } from '@angular/common';
|
|
import { CommonModule } from '@angular/common';
|
|
|
import { ChangeDetectionStrategy, Component, computed, inject, OnInit, signal } from '@angular/core';
|
|
import { ChangeDetectionStrategy, Component, computed, inject, OnInit, signal } from '@angular/core';
|
|
|
import { Router, RouterLink } from '@angular/router';
|
|
import { Router, RouterLink } from '@angular/router';
|
|
|
-import { Award, BookMarked, ChevronRight, CircleHelp, History, LogOut, LucideAngularModule, MessageSquare, Settings, ShieldCheck, UserRound } from 'lucide-angular';
|
|
|
|
|
|
|
+import { Award, BookMarked, CalendarDays, CheckCircle2, ChevronRight, CircleHelp, History, LogOut, LucideAngularModule, MessageSquare, RefreshCw, Settings, ShieldCheck, UserRound, UsersRound } from 'lucide-angular';
|
|
|
import { finalize } from 'rxjs';
|
|
import { finalize } from 'rxjs';
|
|
|
import { APP_VERSION } from '../../core/app.constants';
|
|
import { APP_VERSION } from '../../core/app.constants';
|
|
|
import { ApiService } from '../../core/api.service';
|
|
import { ApiService } from '../../core/api.service';
|
|
@@ -43,6 +43,7 @@ export class AccountPageComponent implements OnInit {
|
|
|
readonly version = APP_VERSION;
|
|
readonly version = APP_VERSION;
|
|
|
readonly coachPanel = signal<CoachPanelSummary>({ todaySchedules: 0, completedLessons: 0, reviewIncome: 0, reviewRecords: 0, totalLessons: 0, totalHours: 0, course30: 0, course60: 0, trialLessons: 0 });
|
|
readonly coachPanel = signal<CoachPanelSummary>({ todaySchedules: 0, completedLessons: 0, reviewIncome: 0, reviewRecords: 0, totalLessons: 0, totalHours: 0, course30: 0, course60: 0, trialLessons: 0 });
|
|
|
readonly coachPanelLoading = signal(false);
|
|
readonly coachPanelLoading = signal(false);
|
|
|
|
|
+ readonly overviewError = signal('');
|
|
|
readonly antiForgetLoading = signal(false);
|
|
readonly antiForgetLoading = signal(false);
|
|
|
readonly antiForgetError = signal('');
|
|
readonly antiForgetError = signal('');
|
|
|
readonly avatarFailed = signal(false);
|
|
readonly avatarFailed = signal(false);
|
|
@@ -50,13 +51,18 @@ export class AccountPageComponent implements OnInit {
|
|
|
readonly antiForgetSummary = signal<AntiForgetHistorySummary>({ total: 0, completed: 0, progress: 0, todayTotal: 0, todayCompleted: 0, duePending: 0, scheduled: 0, scheduledDays: 0 });
|
|
readonly antiForgetSummary = signal<AntiForgetHistorySummary>({ total: 0, completed: 0, progress: 0, todayTotal: 0, todayCompleted: 0, duePending: 0, scheduled: 0, scheduledDays: 0 });
|
|
|
readonly membership = computed(() => buildAccountMembership(this.session.user()));
|
|
readonly membership = computed(() => buildAccountMembership(this.session.user()));
|
|
|
readonly companionSummary = signal<CompanionLearningSummary>({ completedSessions: 0, completedMinutes: 0, durationLabel: '0 小时' });
|
|
readonly companionSummary = signal<CompanionLearningSummary>({ completedSessions: 0, completedMinutes: 0, durationLabel: '0 小时' });
|
|
|
- readonly icons = { Award, BookMarked, ChevronRight, CircleHelp, History, LogOut, MessageSquare, Settings, ShieldCheck, UserRound };
|
|
|
|
|
- readonly services = [
|
|
|
|
|
|
|
+ readonly icons = { Award, BookMarked, CalendarDays, CheckCircle2, ChevronRight, CircleHelp, History, LogOut, MessageSquare, RefreshCw, Settings, ShieldCheck, UserRound, UsersRound };
|
|
|
|
|
+ readonly services = computed(() => Number(this.session.groupId()) === 3 ? [
|
|
|
|
|
+ { path: '/pages/home/shop', label: '陪练排课', icon: CalendarDays },
|
|
|
|
|
+ { path: '/pages/member/ke_xiao', label: '销课记录', icon: CheckCircle2 },
|
|
|
|
|
+ { path: '/pages/his/his', label: '学员记录', icon: UsersRound },
|
|
|
|
|
+ { path: '/pages/member/feedback', label: '意见反馈', icon: MessageSquare },
|
|
|
|
|
+ ] : [
|
|
|
{ path: '/pages/his/well', label: '专项训练', icon: Award },
|
|
{ path: '/pages/his/well', label: '专项训练', icon: Award },
|
|
|
{ path: '/pages/member/starshop', label: '生词本', icon: BookMarked },
|
|
{ path: '/pages/member/starshop', label: '生词本', icon: BookMarked },
|
|
|
{ path: '/pages/his/his', label: '学习记录', icon: History },
|
|
{ path: '/pages/his/his', label: '学习记录', icon: History },
|
|
|
{ path: '/pages/member/feedback', label: '意见反馈', icon: MessageSquare },
|
|
{ path: '/pages/member/feedback', label: '意见反馈', icon: MessageSquare },
|
|
|
- ];
|
|
|
|
|
|
|
+ ]);
|
|
|
|
|
|
|
|
private readonly api = inject(ApiService);
|
|
private readonly api = inject(ApiService);
|
|
|
private readonly router = inject(Router);
|
|
private readonly router = inject(Router);
|
|
@@ -68,6 +74,7 @@ export class AccountPageComponent implements OnInit {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
loadAntiForget(): void { this.loadAccountOverview(true); }
|
|
loadAntiForget(): void { this.loadAccountOverview(true); }
|
|
|
|
|
+ retryOverview(): void { this.loadAccountOverview(true); }
|
|
|
|
|
|
|
|
private loadAccountOverview(refresh: boolean): void {
|
|
private loadAccountOverview(refresh: boolean): void {
|
|
|
const uid = this.session.user()?.userId;
|
|
const uid = this.session.user()?.userId;
|
|
@@ -77,6 +84,7 @@ export class AccountPageComponent implements OnInit {
|
|
|
this.companionLoading.set(!coach);
|
|
this.companionLoading.set(!coach);
|
|
|
this.antiForgetLoading.set(!coach);
|
|
this.antiForgetLoading.set(!coach);
|
|
|
this.antiForgetError.set('');
|
|
this.antiForgetError.set('');
|
|
|
|
|
+ this.overviewError.set('');
|
|
|
this.api.post<AccountOverview>('app_account_overview', { uid, refresh }).pipe(
|
|
this.api.post<AccountOverview>('app_account_overview', { uid, refresh }).pipe(
|
|
|
finalize(() => {
|
|
finalize(() => {
|
|
|
this.coachPanelLoading.set(false);
|
|
this.coachPanelLoading.set(false);
|
|
@@ -94,7 +102,10 @@ export class AccountPageComponent implements OnInit {
|
|
|
}
|
|
}
|
|
|
if (result.antiForgetSummary) this.antiForgetSummary.set(result.antiForgetSummary);
|
|
if (result.antiForgetSummary) this.antiForgetSummary.set(result.antiForgetSummary);
|
|
|
},
|
|
},
|
|
|
- error: () => this.antiForgetError.set('抗遗忘数据暂时无法加载'),
|
|
|
|
|
|
|
+ error: () => {
|
|
|
|
|
+ this.overviewError.set(coach ? '老师工作数据暂时无法加载' : '账号数据暂时无法加载');
|
|
|
|
|
+ if (!coach) this.antiForgetError.set('抗遗忘数据暂时无法加载');
|
|
|
|
|
+ },
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
|
|
|