Commit 815c5a5f authored by 范雪寒's avatar 范雪寒

feat: 表单页完成

parent 2a162676
This diff is collapsed.
...@@ -18,24 +18,11 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy { ...@@ -18,24 +18,11 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
} }
createShell() {
this.item.wordList.push({
word: '',
audio: '',
backWord: '',
backWordAudio: '',
});
this.save();
}
removeShell(idx) {
this.item.wordList.splice(idx, 1);
this.save();
}
ngOnInit() { ngOnInit() {
this.item = {}; this.item = {
letter: 'A'
};
// 获取存储的数据 // 获取存储的数据
(<any>window).courseware.getData((data) => { (<any>window).courseware.getData((data) => {
...@@ -52,6 +39,11 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy { ...@@ -52,6 +39,11 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
}, this.saveKey); }, this.saveKey);
} }
selectLetter(letter) {
this.item.letter = letter;
this.save();
}
ngOnChanges() { ngOnChanges() {
} }
...@@ -77,18 +69,8 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy { ...@@ -77,18 +69,8 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
* 储存音频数据 * 储存音频数据
* @param e * @param e
*/ */
onAudioUploadSuccess(e, key) { onAudioUploadSuccess(e) {
this.item[key] = e.url; this.item.audio = e.url;
this.save();
}
onWordAudioUploadSuccess(e, idx) {
this.item.wordList[idx].audio = e.url;
this.save();
}
onBackWordAudioUploadSuccess(e, idx) {
this.item.wordList[idx].backWordAudio = e.url;
this.save(); this.save();
} }
...@@ -97,7 +79,6 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy { ...@@ -97,7 +79,6 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
*/ */
save() { save() {
(<any>window).courseware.setData(this.item, null, this.saveKey); (<any>window).courseware.setData(this.item, null, this.saveKey);
this.refresh(); this.refresh();
console.log('this.item = ' + JSON.stringify(this.item)); console.log('this.item = ' + JSON.stringify(this.item));
} }
......
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