Browse Source

feat(mobile): let coaches skip spelling words

彭峰 1 month ago
parent
commit
f9a66f787e

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

@@ -632,6 +632,16 @@ describe('home learning modules', () => {
     expect(router.url).toContain('/pages/stu/stu_con');
     expect(harness.routeNativeElement?.querySelectorAll('.repeat-list > button').length).toBe(1);
     expect(harness.routeNativeElement?.querySelector('.readonly-word-header')).toBeNull();
+
+    await harness.navigateByUrl('/pages/stu/pl_stu5?nids=811&pnid=801');
+    await harness.fixture.whenStable();
+    harness.fixture.detectChanges();
+    const spellingActions = harness.routeNativeElement?.querySelector('.teacher-spelling-actions') as HTMLElement;
+    expect(spellingActions.querySelectorAll('button').length).toBe(3);
+    expect(spellingActions.textContent).toContain('跳过并完成');
+    (spellingActions.querySelectorAll('button')[1] as HTMLButtonElement).click();
+    harness.fixture.detectChanges();
+    expect(harness.routeNativeElement?.textContent).toContain('拼写完成');
   });
 
   it('counts words marked as known as completed and persists them for the student', async () => {

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

@@ -271,8 +271,9 @@
             }
           </div>
         </article>
-        <div class="sticky-actions">
+        <div class="sticky-actions" [class.teacher-spelling-actions]="meta.path === 'pages/stu/pl_stu5'">
           <button type="button" class="secondary-button" (click)="resetSpelling()"><lucide-icon [img]="icons.RotateCcw" [size]="18" />重拼</button>
+          @if (meta.path === 'pages/stu/pl_stu5') { <button type="button" class="secondary-button" (click)="skipSpellingWord()">{{ currentIndex() === words().length - 1 ? '跳过并完成' : '跳过此词' }}</button> }
           <button type="button" class="primary-button" [disabled]="!spellingCorrect()" (click)="nextSpellingWord()">{{ currentIndex() === words().length - 1 ? '完成本关' : '下一个' }}<lucide-icon [img]="icons.ChevronRight" [size]="18" /></button>
         </div>
       }

+ 11 - 0
projects/xiaoshu-mobile/src/app/features/learning/learning-page.component.ts

@@ -717,6 +717,17 @@ export class LearningPageComponent implements OnInit, OnDestroy {
     this.play();
   }
 
+  skipSpellingWord(): void {
+    if (this.meta.path !== 'pages/stu/pl_stu5') return;
+    if (this.currentIndex() >= this.words().length - 1) {
+      this.completed.set(true);
+      return;
+    }
+    this.currentIndex.update((value) => value + 1);
+    this.prepareSpelling();
+    setTimeout(() => this.play(), 120);
+  }
+
   continueAfterStage(): void {
     this.completed.set(false);
     if (this.isMatchingPage) {

+ 1 - 0
projects/xiaoshu-mobile/src/styles.scss

@@ -417,6 +417,7 @@ app-learning-page .memory-student-filter label { display: flex; min-width: 0; fl
 app-learning-page .memory-student-filter span { color: var(--ink-soft); font-size: 11px; }
 app-learning-page .memory-student-filter strong { color: var(--ink); font-size: 18px; }
 app-learning-page .memory-student-filter select { min-height: 42px; padding-block: 7px; }
+app-learning-page .teacher-spelling-actions { grid-template-columns: repeat(3, minmax(0, 1fr)); }
 
 @media (max-width: 520px) {
   app-learning-page .memory-student-filter { grid-template-columns: 1fr; gap: 10px; }