Commit 0f6d9f5a authored by liujiaxin's avatar liujiaxin

fix: change refresh

parent e671f16a
......@@ -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);
}
......
......@@ -176,9 +176,9 @@ export class PlayComponent implements OnInit {
refresh() {
setTimeout(() => {
this.appRef.tick();
this.changeDetectorRef.markForCheck();
this.changeDetectorRef.detectChanges();
this.appRef.tick();
}, 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