diff --git a/src/app/form/form.component.ts b/src/app/form/form.component.ts index e9757ef9f2dd82c1bd6197013c1b4da07a6fe6a6..f15bc1c88c3c8a18b841203005ff299c8a499330 100644 --- a/src/app/form/form.component.ts +++ b/src/app/form/form.component.ts @@ -27,7 +27,7 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy { constructor(private appRef: ApplicationRef, private changeDetectorRef: ChangeDetectorRef, - private modalService: NzModalService, + private modalService: NzModalService, private nzMessageService: NzMessageService,) { } @@ -37,7 +37,7 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy { this.item = { contentObj: { - + } }; @@ -82,6 +82,7 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy { item.showPic = !item.showPic; this.item.contentObj.groups = this.groups; this.save(); + this.refresh(); } onDeleteCoursewareItem(groupIndex, index) { this.modalService.confirm({ @@ -93,13 +94,16 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy { this.groups[groupIndex].options.splice(index, 1); this.item.contentObj.groups = this.groups; this.save(); + this.refresh(); }, }); + this.refresh(); } onHandleOptionItemImage(groupIndex, e, index) { this.groups[groupIndex].options[index].pic_id = e.url; this.item.contentObj.groups = this.groups; this.save(); + this.refresh(); } addNewOptionItem (groupIndex) { const content = { @@ -130,6 +134,7 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy { } this.groups[groupIndex].options.push(content); this.updateOptionItemText(); + this.refresh(); } updateGroupText(evt?: {target: {value: ''}}, group?: {name: ''}) { let u = true; @@ -144,6 +149,7 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy { if (u) { this.save(); } + this.refresh(); } updateOptionItemText(evt?: {target: {value: ''}}, item?: {text: ''}) { let u = true; @@ -158,9 +164,10 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy { if (u) { this.save(); } + this.refresh(); } - + /** * å‚¨å˜æ•°æ® */ @@ -174,6 +181,8 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy { */ refresh() { setTimeout(() => { + this.changeDetectorRef.markForCheck(); + this.changeDetectorRef.detectChanges(); this.appRef.tick(); }, 1); } diff --git a/src/app/play/play.component.ts b/src/app/play/play.component.ts index bf54b8346dc12d8fff311831fb725d7637817698..fc2df8017f17e91ce04541842c8d600ee73519ec 100644 --- a/src/app/play/play.component.ts +++ b/src/app/play/play.component.ts @@ -176,9 +176,9 @@ export class PlayComponent implements OnInit { refresh() { setTimeout(() => { - this.appRef.tick(); this.changeDetectorRef.markForCheck(); this.changeDetectorRef.detectChanges(); + this.appRef.tick(); }, 1); }