Commit 503effd0 authored by liujiangnan's avatar liujiangnan

fix: 表单保存问题

parent 0a8f1cc1
......@@ -13,7 +13,6 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
saveKey = 'ww_vocabulary';
// 储存对象
item;
originContent;
constructor(private appRef: ApplicationRef,
......@@ -33,12 +32,12 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
pic_id: "",
vocabulary_audio: ""
}
};
};
// 获取存储的数据
(window as any).courseware.getData((data) => {
if (data) {
this.item = data;
this.item = data;
}
this.changeDetectorRef.markForCheck();
this.changeDetectorRef.detectChanges();
......@@ -65,30 +64,21 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
if (temp) {
this.item.contentObj.vocabulary = this.item.contentObj.vocabulary.trim();
}
if (temp !== this.originContent.vocabulary) {
this.originContent.vocabulary = temp;
this.save();
}
this.save();
}
updatePartOfSpeech() {
const temp = this.item.contentObj.vocabularyType ? this.item.contentObj.vocabularyType.trim() : '';
if (temp) {
this.item.contentObj.vocabularyType = this.item.contentObj.vocabularyType.trim();
}
if (temp !== this.originContent.vocabularyType) {
this.originContent.vocabularyType = temp;
this.save();
}
this.save();
}
updateDefinition() {
const temp = this.item.contentObj.definition ? this.item.contentObj.definition.trim() : '';
if (temp) {
this.item.contentObj.definition = this.item.contentObj.definition.trim();
}
if (temp !== this.originContent.definition) {
this.originContent.definition = temp;
this.save();
}
this.save();
}
onVocabularyAudioUploadSuccess(e) {
......
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