Commit 1edc9e3b authored by 范雪寒's avatar 范雪寒

feat: form

parent 84e30557
......@@ -3,19 +3,24 @@
<div style="padding: 10px;">
<div style="width: 100%; margin-top: 15px; margin-bottom: 50px;" align="center">
<h2>标题设置</h2>
<div style="width: 50%; display: flex; justify-content: center; align-items: center;">
<input type="text" nz-input [(ngModel)]="item.title" (blur)="save()" style="width: 200px;margin-top: 5px">
<div class="border" style="width: 800px;">
<span style="height: 30px; font-size: 18px;">开场语音:</span>
<div style="width: 200px;">
<app-audio-recorder
style="margin-top: 5px; margin-left: 5px;"
[audioUrl]="item.title_audio_url"
(audioUploaded)="onAudioUploadSuccess($event, 'title_audio_url')"
></app-audio-recorder>
[audioUrl]="item.startAudio"
(audioUploaded)="onAudioUploadSuccess($event, 'startAudio')">
</app-audio-recorder>
</div>
<span style="height: 30px; font-size: 18px;">结束语音:</span>
<div style="width: 200px;">
<app-audio-recorder
[audioUrl]="item.endAudio"
(audioUploaded)="onAudioUploadSuccess($event, 'endAudio')">
</app-audio-recorder>
</div>
</div>
<app-custom-hot-zone
[bgItem]="item.bgItem"
[hotZoneItemArr]="item.hotZoneItemArr"
......
......@@ -63,31 +63,19 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
]
},
},
]
constructor(private appRef: ApplicationRef, private changeDetectorRef: ChangeDetectorRef) {
}
createShell() {
this.item.wordList.push({
word: '',
audio: '',
backWord: '',
backWordAudio: '',
});
this.save();
}
removeShell(idx) {
this.item.wordList.splice(idx, 1);
this.save();
}
ngOnInit() {
this.item = {};
this.item = {
startAudio: '',
endAudio: ''
};
// 获取存储的数据
(<any>window).courseware.getData((data) => {
......@@ -114,7 +102,6 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
}
onSaveCustomAction(e) {
console.log('e:', e);
this.item.customAction = e;
......@@ -124,8 +111,8 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
saveHotZone(group, e) {
console.log('e: ', e);
const {bgItem, hotZoneItemArr} = e;
const { bgItem, hotZoneItemArr } = e;
group.bgItem = bgItem;
group.hotZoneItemArr = hotZoneItemArr;
......@@ -152,16 +139,6 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
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();
}
/**
* 储存数据
*/
......
export const defaultData = {
"pic_url": "http://staging-teach.cdn.ireadabc.com/ed94332a503c31e0908bd4c6923a2665.png",
"pic_url_2": "http://staging-teach.cdn.ireadabc.com/5fb60317ade0195d35ad8034d5370a7f.png",
"text": "This is a test label.",
"audio_url": "http://staging-teach.cdn.ireadabc.com/f47f1d7b5c160fe1c59500d180346240.mp3"
}
\ No newline at end of file
"bgItem": {
"url": "http://staging-teach.cdn.ireadabc.com/c465e1fc66313a170827d4f18d2c6e55.jpeg",
"rect": {
"x": 396.35,
"y": 0,
"width": 1180.3,
"height": 738
}
},
"hotZoneItemArr": [{
"id": "1632280599616",
"index": 0,
"pic_url": "http://staging-teach.cdn.ireadabc.com/e04216e18a88cf20bb02a144d1ff541a.jpg",
"itemType": "pic",
"fontScale": 1.54140625,
"imgScale": 0.12967798085291557,
"mapScale": 1.54140625,
"gIdx": "1",
"rect": {
"x": 159.65,
"y": 482.97,
"width": 149,
"height": 140.05
}
}],
"startAudio": "http://staging-teach.cdn.ireadabc.com/dfb27b510e121a1045a3b7613a530e43.mp3",
"endAudio": "http://staging-teach.cdn.ireadabc.com/d948ef84a50e6ac36bc31110f9062878.mp3"
};
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