Kaynağa Gözat

fix(mobile): hide review pay labels from student calendars

彭峰 4 gün önce
ebeveyn
işleme
ddd41c54d0

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

@@ -440,6 +440,28 @@ describe('home learning modules', () => {
     });
   }
 
+  it('shows only review states to students and keeps pay labels on teacher calendars', async () => {
+    const harness = await RouterTestingHarness.create('/pages/stu/stu_calendar?scope=overdue');
+    const calendar = harness.fixture.debugElement.query(By.directive(LearningPageComponent)).componentInstance as LearningPageComponent;
+    const today = new Date().toLocaleDateString('sv-SE', {timeZone:'Asia/Shanghai'});
+    calendar.calendarItems.set([
+      {GeneralID:1,kywsj:'2000-01-01',kywrq:'2000-01-01',fxzt:0},
+      {GeneralID:2,kywsj:today,kywrq:today,fxzt:0},
+      {GeneralID:3,kywsj:'2999-01-01',kywrq:'2999-01-01',fxzt:0},
+      {GeneralID:4,kywsj:'2000-01-01',kywrq:'2000-01-01',fxzt:1},
+    ]);
+    const states = () => Array.from(harness.routeNativeElement!.querySelectorAll('.task-state')).map(node => node.textContent!.trim());
+    harness.fixture.detectChanges();
+    expect(states()).toEqual(['逾期补做','待复习','未到期','已完成']);
+    expect(harness.routeNativeElement!.querySelector('.memory-date-tasks h2')?.textContent).toBe('逾期补做');
+    expect(harness.routeNativeElement!.textContent).not.toMatch(/计薪|记薪|工资|薪酬|收入/);
+    user.set({userId:300,groupId:3});session.groupId.set(3);harness.fixture.detectChanges();
+    expect(states()).toEqual(['逾期补做 · 不计薪','待复习 · 当天完成计薪','未到期','已完成']);
+    expect(harness.routeNativeElement!.querySelector('.memory-date-tasks h2')?.textContent).toBe('逾期补做 · 不计薪');
+    user.set({userId:100,groupId:1});session.groupId.set(1);harness.fixture.detectChanges();
+    expect(harness.routeNativeElement!.textContent).not.toMatch(/计薪|记薪|工资|薪酬|收入/);
+  });
+
   it('loads the review calendar once per login and refreshes only on an explicit request', async () => {
     const api = TestBed.inject(ApiService) as unknown as LearningModulesApiService;
     const originalPost = api.post.bind(api);

+ 1 - 1
projects/xiaoshu-mobile/src/app/features/learning/learning-page.component.html

@@ -409,7 +409,7 @@
     </section>
 
     <section class="memory-date-tasks" aria-live="polite">
-      @if(reviewScope()==='overdue'){<h2>逾期补做 · 不计薪</h2>}
+      @if(reviewScope()==='overdue'){<h2>{{ canStartPointReading ? '逾期补做 · 不计薪' : '逾期补做' }}</h2>}
       <header><div><span>当日复习</span><strong>{{ memorySelectedLabel() }}</strong></div><b>@if (calendarLoading()) { <span class="memory-loading-label"><lucide-icon class="spin" [img]="icons.RefreshCw" [size]="15" />正在加载</span> } @else { {{ memorySelectedTasks().length }} 项 }</b></header>
       <div class="calendar-list">
         @if (calendarLoading()) {

+ 4 - 1
projects/xiaoshu-mobile/src/app/features/learning/learning-page.component.ts

@@ -1158,7 +1158,10 @@ export class LearningPageComponent implements OnInit, OnDestroy {
 
   memoryTaskStatus(item: SourceItem): string {
     if (this.calendarCompleted(item)) return '已完成';
-    return this.calendarReady(item) ? (this.calendarDate(item)<this.dateOnly()?'逾期补做 · 不计薪':'待复习 · 当天完成计薪') : '未到期';
+    if (!this.calendarReady(item)) return '未到期';
+    const overdue = this.calendarDate(item) < this.dateOnly();
+    if (!this.canStartPointReading) return overdue ? '逾期补做' : '待复习';
+    return overdue ? '逾期补做 · 不计薪' : '待复习 · 当天完成计薪';
   }
 
   isWritingRecord(): boolean {