Commit 0f6d9f5a authored by liujiaxin's avatar liujiaxin

fix: change refresh

parent e671f16a
...@@ -27,7 +27,7 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy { ...@@ -27,7 +27,7 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
constructor(private appRef: ApplicationRef, constructor(private appRef: ApplicationRef,
private changeDetectorRef: ChangeDetectorRef, private changeDetectorRef: ChangeDetectorRef,
private modalService: NzModalService, private modalService: NzModalService,
private nzMessageService: NzMessageService,) { private nzMessageService: NzMessageService,) {
} }
...@@ -37,7 +37,7 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy { ...@@ -37,7 +37,7 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
this.item = { this.item = {
contentObj: { contentObj: {
} }
}; };
...@@ -82,6 +82,7 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy { ...@@ -82,6 +82,7 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
item.showPic = !item.showPic; item.showPic = !item.showPic;
this.item.contentObj.groups = this.groups; this.item.contentObj.groups = this.groups;
this.save(); this.save();
this.refresh();
} }
onDeleteCoursewareItem(groupIndex, index) { onDeleteCoursewareItem(groupIndex, index) {
this.modalService.confirm({ this.modalService.confirm({
...@@ -93,13 +94,16 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy { ...@@ -93,13 +94,16 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
this.groups[groupIndex].options.splice(index, 1); this.groups[groupIndex].options.splice(index, 1);
this.item.contentObj.groups = this.groups; this.item.contentObj.groups = this.groups;
this.save(); this.save();
this.refresh();
}, },
}); });
this.refresh();
} }
onHandleOptionItemImage(groupIndex, e, index) { onHandleOptionItemImage(groupIndex, e, index) {
this.groups[groupIndex].options[index].pic_id = e.url; this.groups[groupIndex].options[index].pic_id = e.url;
this.item.contentObj.groups = this.groups; this.item.contentObj.groups = this.groups;
this.save(); this.save();
this.refresh();
} }
addNewOptionItem (groupIndex) { addNewOptionItem (groupIndex) {
const content = { const content = {
...@@ -130,6 +134,7 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy { ...@@ -130,6 +134,7 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
} }
this.groups[groupIndex].options.push(content); this.groups[groupIndex].options.push(content);
this.updateOptionItemText(); this.updateOptionItemText();
this.refresh();
} }
updateGroupText(evt?: {target: {value: ''}}, group?: {name: ''}) { updateGroupText(evt?: {target: {value: ''}}, group?: {name: ''}) {
let u = true; let u = true;
...@@ -144,6 +149,7 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy { ...@@ -144,6 +149,7 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
if (u) { if (u) {
this.save(); this.save();
} }
this.refresh();
} }
updateOptionItemText(evt?: {target: {value: ''}}, item?: {text: ''}) { updateOptionItemText(evt?: {target: {value: ''}}, item?: {text: ''}) {
let u = true; let u = true;
...@@ -158,9 +164,10 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy { ...@@ -158,9 +164,10 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
if (u) { if (u) {
this.save(); this.save();
} }
this.refresh();
} }
/** /**
* 储存数据 * 储存数据
*/ */
...@@ -174,6 +181,8 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy { ...@@ -174,6 +181,8 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
*/ */
refresh() { refresh() {
setTimeout(() => { setTimeout(() => {
this.changeDetectorRef.markForCheck();
this.changeDetectorRef.detectChanges();
this.appRef.tick(); this.appRef.tick();
}, 1); }, 1);
} }
......
...@@ -176,9 +176,9 @@ export class PlayComponent implements OnInit { ...@@ -176,9 +176,9 @@ export class PlayComponent implements OnInit {
refresh() { refresh() {
setTimeout(() => { setTimeout(() => {
this.appRef.tick();
this.changeDetectorRef.markForCheck(); this.changeDetectorRef.markForCheck();
this.changeDetectorRef.detectChanges(); this.changeDetectorRef.detectChanges();
this.appRef.tick();
}, 1); }, 1);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment