Commit 503effd0 authored by liujiangnan's avatar liujiangnan

fix: 表单保存问题

parent 0a8f1cc1
...@@ -13,7 +13,6 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy { ...@@ -13,7 +13,6 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
saveKey = 'ww_vocabulary'; saveKey = 'ww_vocabulary';
// 储存对象 // 储存对象
item; item;
originContent;
constructor(private appRef: ApplicationRef, constructor(private appRef: ApplicationRef,
...@@ -65,31 +64,22 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy { ...@@ -65,31 +64,22 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
if (temp) { if (temp) {
this.item.contentObj.vocabulary = this.item.contentObj.vocabulary.trim(); this.item.contentObj.vocabulary = this.item.contentObj.vocabulary.trim();
} }
if (temp !== this.originContent.vocabulary) {
this.originContent.vocabulary = temp;
this.save(); this.save();
} }
}
updatePartOfSpeech() { updatePartOfSpeech() {
const temp = this.item.contentObj.vocabularyType ? this.item.contentObj.vocabularyType.trim() : ''; const temp = this.item.contentObj.vocabularyType ? this.item.contentObj.vocabularyType.trim() : '';
if (temp) { if (temp) {
this.item.contentObj.vocabularyType = this.item.contentObj.vocabularyType.trim(); this.item.contentObj.vocabularyType = this.item.contentObj.vocabularyType.trim();
} }
if (temp !== this.originContent.vocabularyType) {
this.originContent.vocabularyType = temp;
this.save(); this.save();
} }
}
updateDefinition() { updateDefinition() {
const temp = this.item.contentObj.definition ? this.item.contentObj.definition.trim() : ''; const temp = this.item.contentObj.definition ? this.item.contentObj.definition.trim() : '';
if (temp) { if (temp) {
this.item.contentObj.definition = this.item.contentObj.definition.trim(); this.item.contentObj.definition = this.item.contentObj.definition.trim();
} }
if (temp !== this.originContent.definition) {
this.originContent.definition = temp;
this.save(); this.save();
} }
}
onVocabularyAudioUploadSuccess(e) { onVocabularyAudioUploadSuccess(e) {
this.item.contentObj.vocabulary_audio = e.url; this.item.contentObj.vocabulary_audio = e.url;
......
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