Răsfoiți Sursa

fix(mobile): hide teacher pay from lesson and review completion

彭峰 8 ore în urmă
părinte
comite
35fdc5b004

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

@@ -1568,7 +1568,7 @@ describe('home learning modules', () => {
     }
   });
 
-  it('ends without requiring feedback and displays the server-confirmed lesson pay', async () => {
+  it('ends without requiring feedback and keeps lesson pay out of the completion notice', async () => {
     user.set({userId:300,userName:'coach',honeyName:'张老师',groupId:3});session.groupId.set(3);
     const api=TestBed.inject(ApiService) as unknown as LearningModulesApiService;api.appointmentStatus=10;
     spyOn(TestBed.inject(PlatformService),'confirm').and.resolveTo(true);
@@ -1576,7 +1576,7 @@ describe('home learning modules', () => {
     const component=harness.fixture.debugElement.query(By.directive(AppointmentPageComponent)).componentInstance as AppointmentPageComponent;
     await component.endLesson();expect(api.completionRequests.length).toBe(1);expect(api.completionRequests[0]['feedback']).toBeUndefined();
     api.appointmentStatus=30;api.completionResponse.next({retcode:0,result:{status:30,teacherPay:45,payStatus:'earned',feedbackStatus:'pending'}});api.completionResponse.complete();
-    harness.fixture.detectChanges();expect(harness.routeNativeElement?.textContent).toContain('本节带课工资 ¥45.00');expect(harness.routeNativeElement?.textContent).toContain('反馈待补');
+    harness.fixture.detectChanges();expect(harness.routeNativeElement?.textContent).toContain('已结课');expect(harness.routeNativeElement?.textContent).not.toMatch(/工资|¥45/);expect(harness.routeNativeElement?.textContent).toContain('反馈待补');
   });
 
   it('retains the optional feedback-and-complete dialog and submits once after validation', async () => {
@@ -1885,23 +1885,31 @@ describe('home learning modules', () => {
     expect(harness.routeNativeElement?.querySelectorAll('.learning-record-card .learning-item').length).toBe(5);
     expect((harness.routeNativeElement?.querySelectorAll('.record-pagination button')[1] as HTMLButtonElement).disabled).toBeTrue();
   });
-  it('shows the server half-yuan reward and distinguishes student self-study from overdue work', async()=>{
+  it('keeps review completion free of pay details for every reward outcome', async()=>{
     user.set({userId:300,groupId:3,honeyName:'老师'});session.groupId.set(3);session.student.set({userId:100,groupId:1});
     const harness=await RouterTestingHarness.create('/pages/stu/record?id=900&gid=103');await harness.fixture.whenStable();
     const component=harness.fixture.debugElement.query(By.directive(LearningPageComponent)).componentInstance as LearningPageComponent;
-    component.reviewCompletion.set({amount:0.5,rewardStatus:'earned'});harness.fixture.detectChanges();
-    expect(harness.routeNativeElement?.querySelector('.review-complete')?.textContent).toContain('本次收入 ¥0.50');
-    component.reviewCompletion.set({amount:0,rewardStatus:'ineligible',ineligibleReason:'self_study',unchanged:true});harness.fixture.detectChanges();
-    expect(harness.routeNativeElement?.querySelector('.review-complete')?.textContent).toContain('学生自习,不计薪');
-    expect(harness.routeNativeElement?.querySelector('.review-complete')?.textContent).not.toContain('逾期补做');
-    component.reviewCompletion.set({amount:0,rewardStatus:'ineligible',ineligibleReason:'duplicate_review',unchanged:true});harness.fixture.detectChanges();
-    expect(harness.routeNativeElement?.querySelector('.review-complete')?.textContent).toContain('重复复习,不重复计薪');
+    for (const result of [
+      {amount:0.5,rewardStatus:'earned'},
+      {amount:1,rewardStatus:'earned',unchanged:true},
+      {amount:0,rewardStatus:'ineligible',ineligibleReason:'self_study',unchanged:true},
+      {amount:0,rewardStatus:'ineligible',ineligibleReason:'duplicate_review',unchanged:true},
+      {amount:0,rewardStatus:'ineligible'},
+      {amount:0,rewardStatus:'pending'},
+    ]) {
+      component.reviewCompletion.set(result);harness.fixture.detectChanges();
+      const completion=harness.routeNativeElement?.querySelector('.review-complete');
+      expect(completion?.textContent).toContain('复习已完成');
+      expect(completion?.textContent).not.toMatch(/收入|工资|计薪|记账|¥/);
+      expect(completion?.textContent).toContain('继续今日任务');
+      expect(completion?.textContent).toContain('返回原任务列表');
+    }
     user.set({userId:100,groupId:1,honeyName:'学生'});session.groupId.set(1);harness.fixture.detectChanges();
     expect(harness.routeNativeElement?.querySelector('.review-complete')?.textContent).toContain('复习已完成');
-    expect(harness.routeNativeElement?.querySelector('.review-complete')?.textContent).not.toContain('收入');
+    expect(harness.routeNativeElement?.querySelector('.review-complete')?.textContent).not.toMatch(/收入|工资|计薪|记账|¥/);
   });
 
-  it('waits for server completion, blocks duplicate clicks and shows zero for overdue work', async()=>{
+  it('waits for server completion and blocks duplicate clicks for overdue work', async()=>{
     user.set({userId:300,groupId:3,honeyName:'老师'});session.groupId.set(3);session.student.set({userId:100,groupId:1});
     const api=TestBed.inject(ApiService),post=api.post.bind(api),reply=new Subject<ApiEnvelope<any>>();
     const submit=spyOn(api,'post').and.callFake((action,params)=>action==='app_review_complete'?reply:post(action,params));
@@ -1910,7 +1918,7 @@ describe('home learning modules', () => {
     component.endRecord();component.endRecord();harness.fixture.detectChanges();expect(component.reviewCompletion()).toBeNull();expect(component.canDeactivate()).toBeFalse();
     expect(submit.calls.allArgs().filter(a=>a[0]==='app_review_complete').length).toBe(1);
     reply.next({retcode:1,result:{amount:0,rewardStatus:'ineligible',completed:true}});reply.complete();harness.fixture.detectChanges();
-    expect(harness.routeNativeElement?.querySelector('.review-complete')?.textContent).toContain('本次收入 ¥0.00');expect(component.canDeactivate()).toBeTrue();
+    expect(harness.routeNativeElement?.querySelector('.review-complete')?.textContent).toContain('复习已完成');expect(harness.routeNativeElement?.querySelector('.review-complete')?.textContent).not.toMatch(/收入|工资|计薪|¥/);expect(component.canDeactivate()).toBeTrue();
   });
 
 });

+ 2 - 2
projects/xiaoshu-mobile/src/app/features/appointment/appointment-page.component.ts

@@ -343,11 +343,11 @@ export class AppointmentPageComponent implements OnInit, OnDestroy {
     if (this.submitting() || !this.can('complete')) return;
     if (this.classStudyLoading() || this.classStudyError() || !this.classStudy()) { this.actionError.set('请先加载本节学习成果,再结束课程'); return; }
     if (this.classStudy()?.pending) { this.actionError.set('还有未确认的学习批次,请先处理'); return; }
-    if (!await this.platform.confirm('确认结束本次课程?系统将记录课时和工资,课堂反馈可以稍后补充。')) return;
+    if (!await this.platform.confirm('确认结束本次课程?系统将记录课时,课堂反馈可以稍后补充。')) return;
     if (this.submitting() || !this.can('complete')) return;
     this.submitting.set(true);this.actionError.set('');
     this.api.post<{teacherPay:number|null;payStatus:string}>('app_lesson_complete', {orderId:this.orderId,expectedUpdatedAt:this.order()['updatedAt']}).pipe(finalize(()=>this.submitting.set(false))).subscribe({
-      next:({result})=>{this.completionNotice.set(result.payStatus==='earned'&&result.teacherPay!=null?'已结课,本节带课工资 ¥'+Number(result.teacherPay).toFixed(2)+' · 反馈待补':'已结课 · 工资待核对 · 反馈待补');this.load();},
+      next:()=>{this.completionNotice.set('已结课 · 反馈待补');this.load();},
       error:(e:ApiError)=>this.actionError.set(e.message),
     });
   }

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

@@ -452,9 +452,8 @@
       </div>
     </section>
   } @else if (isRecordPage) {
-    @if(reviewCompletion(); as result){
+    @if(reviewCompletion()){
       <section class="review-complete" role="status"><h2>复习已完成</h2>
-        @if(canStartPointReading){<strong>{{result.unchanged?'已记账金额':'本次收入'}} ¥{{result.amount | number:'1.2-2'}}</strong><p>{{result.ineligibleReason==='self_study'?'学生自习,不计薪':result.ineligibleReason==='duplicate_review'?'重复复习,不重复计薪':result.rewardStatus==='ineligible'?'逾期补做,不计薪':result.unchanged?'此任务已完成,不重复计薪':result.rewardStatus==='earned'?'已记录当天复习工资':'计薪凭据待核对'}}</p>}
         <button class="primary-button" type="button" (click)="returnToReview(true)">继续今日任务</button>
         <button class="secondary-button" type="button" (click)="returnToReview()">返回原任务列表</button>
         <a class="secondary-button" routerLink="/pages/home/index">返回首页</a>