Commit a2cb5174 authored by Tt's avatar Tt

组件提供

parent 5c44512d
......@@ -22,20 +22,21 @@
<div *ngFor="let group of item; let m = index" style="border: 1px solid #000;">
<div *ngFor="let info of item; let m = index" style="border: 1px solid #000;">
<div style="width: 300px; margin-top: 15px">
<span>请输入标题: </span>
<input type="text" nz-input [(ngModel)]="item.title" (blur)="save()" />
<input type="text" nz-input [(ngModel)]="info.title" (blur)="save()" />
</div>
<div style="margin-top: 15px">
<span>标题音频: </span>
<app-audio-recorder [audioUrl]="item.audio_title" (audioUploaded)="onAudioUploadSuccess($event, 'audio_title')">
<app-audio-recorder [audioUrl]="info.audio_title"
(audioUploaded)="onAudioUploadSuccess($event,m, 'audio_title')">
</app-audio-recorder>
</div>
<div *ngFor="let it of group; let i = index" style="padding: 0.5vw">
<div *ngFor="let it of info.group; let i = index" style="padding: 0.5vw">
<div class="border" style="display: flex; align-items: center">
<div class="item-box" style="width: 100%">
<h2 style="padding-bottom: 1vw">连线组-{{ i + 1 }}</h2>
......
......@@ -59,7 +59,7 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
init() {
if (this.item.length == 0) {
this.item.push([]);
this.addGroup();
}
}
......@@ -68,7 +68,7 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
* @param e
*/
onImageUploadSuccess(e, key) {
this.item[key] = e.url;
// this.item[key] = e.url;
this.save();
}
......@@ -76,18 +76,16 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
* 储存音频数据
* @param e
*/
onAudioUploadSuccess(e, key) {
this.item[key] = e.url;
onAudioUploadSuccess(e, i, key) {
this.item[i][key] = 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();
}
......@@ -145,7 +143,7 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
* 添加选项组
*/
addItem(i) {
let group = this.item[i];
let group = this.item[i].group;
if (group.length >= 5) return;
const data = {
......@@ -169,7 +167,7 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
}
deleteItem(i, data) {
let group = this.item[i];
let group = this.item[i].group;
const index = group.indexOf(data);
if (index !== -1) {
group.splice(index, 1);
......@@ -178,7 +176,11 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
this.save();
}
addGroup() {
this.item.push([]);
this.item.push({
title: '',
audio_title: '',
group: []
});
}
}
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