Просмотр исходного кода

fix(mobile): remove duplicate coach profile shortcut

彭峰 4 недель назад
Родитель
Сommit
0124d7e090

+ 4 - 1
projects/xiaoshu-mobile/src/app/core/home-learning-modules.integration.spec.ts

@@ -659,7 +659,10 @@ describe('home learning modules', () => {
     harness.fixture.detectChanges();
     const coachLinks = Array.from(harness.routeNativeElement?.querySelectorAll('.coach-quick-grid > a') ?? []).map((link) => link.getAttribute('href'));
     expect(coachLinks).toEqual(['/pages/home/shop', '/pages/member/ke_xiao', '/pages/his/his', '/pages/member/ke_fuxi']);
-    expect(harness.routeNativeElement?.querySelector('.home-header .header-action')?.getAttribute('href')).toBe('/pages/home/ucenter');
+    expect(harness.routeNativeElement?.querySelector('.home-header .header-action')).toBeNull();
+    const coachAccountTab = (Array.from(harness.fixture.nativeElement.querySelectorAll('.tabbar a')) as HTMLAnchorElement[])
+      .find((link) => link.getAttribute('href') === '/pages/home/ucenter');
+    expect(coachAccountTab?.textContent).toContain('我的');
     expect(harness.routeNativeElement?.querySelector('.content-section')).toBeNull();
     const memoryApi = TestBed.inject(ApiService) as unknown as LearningModulesApiService;
     expect(memoryApi.lastMemoryParams).toEqual(jasmine.objectContaining({ uid: 300, pageSize:20 }));

+ 4 - 2
projects/xiaoshu-mobile/src/app/features/home/home-page.component.html

@@ -1,6 +1,8 @@
-<header class="home-header">
+<header class="home-header" [class.coach-home-header]="isCoach()">
   <div class="brand"><img src="/static/images/logo-wordmark.png" alt="小树陪练" /><span>线上与线下,一对一陪练</span></div>
-  <a class="header-action" [routerLink]="isCoach() ? '/pages/home/ucenter' : '/pages/home/search'" [attr.aria-label]="isCoach() ? '个人中心' : '搜索'" [attr.title]="isCoach() ? '个人中心' : '搜索'"><lucide-icon [img]="isCoach() ? icons.UserRound : icons.Search" [size]="23" /></a>
+  @if (!isCoach()) {
+    <a class="header-action" routerLink="/pages/home/search" aria-label="搜索" title="搜索"><lucide-icon [img]="icons.Search" [size]="23" /></a>
+  }
 </header>
 
 <main class="home-main">

+ 1 - 0
projects/xiaoshu-mobile/src/app/features/home/home-page.component.scss

@@ -1,5 +1,6 @@
 :host { display: block; min-height: 100%; background: var(--surface); }
 .home-header { display: grid; min-height: calc(78px + env(safe-area-inset-top)); grid-template-columns: minmax(0, 1fr) 44px; align-items: center; padding: env(safe-area-inset-top) 18px 0 20px; background: var(--surface); border-bottom: 1px solid var(--line-soft); gap: 4px; }
+.home-header.coach-home-header { grid-template-columns: minmax(0, 1fr); padding-right: 20px; }
 .brand { display: flex; min-width: 0; align-items: flex-end; gap: 11px; }
 .brand img { width: 154px; height: 43px; flex: 0 0 auto; object-fit: contain; object-position: left center; }
 .brand span { min-width: 0; color: var(--brand-deep); font-size: 13px; font-weight: 650; line-height: 1.25; overflow-wrap: anywhere; }