Commit d4a11193 authored by Chen Jiping's avatar Chen Jiping

feat:增加音频名显示,并增加音频转换处理

parent 6f6efa65
...@@ -29,7 +29,6 @@ ...@@ -29,7 +29,6 @@
</div> </div>
</div> </div>
<div *ngIf="audioUrl && needRemove; then truthyTemplate else falsyTemplate"></div> <div *ngIf="audioUrl && needRemove; then truthyTemplate else falsyTemplate"></div>
<ng-template #truthyTemplate > <ng-template #truthyTemplate >
...@@ -45,10 +44,6 @@ ...@@ -45,10 +44,6 @@
<fa-icon icon="cog"></fa-icon> <fa-icon icon="cog"></fa-icon>
</div> </div>
</ng-template> </ng-template>
</div> </div>
<div class="p-progress ml-2" (click)="onBtnPlay()" *ngIf="audioUrl || audioBlob"> <div class="p-progress ml-2" (click)="onBtnPlay()" *ngIf="audioUrl || audioBlob">
...@@ -58,4 +53,6 @@ ...@@ -58,4 +53,6 @@
<fa-icon [icon]="playIcon"></fa-icon> <fa-icon [icon]="playIcon"></fa-icon>
</div> </div>
</div> </div>
<div class="audio-name">{{_audioName}}</div>
</div> </div>
...@@ -103,6 +103,13 @@ ...@@ -103,6 +103,13 @@
} }
} }
.audio-name{
margin-top: 3.5px;
position: relative;
margin-left: 7px;;
line-height: 26px;
}
:host ::ng-deep nz-upload { :host ::ng-deep nz-upload {
line-height: 33px; line-height: 33px;
} }
......
...@@ -31,6 +31,9 @@ export class AudioRecorderComponent implements OnInit, OnChanges, OnDestroy { ...@@ -31,6 +31,9 @@ export class AudioRecorderComponent implements OnInit, OnChanges, OnDestroy {
@Input() @Input()
audioItem: any = null; audioItem: any = null;
@Input()
_audioName: any = null;
@Input() @Input()
set audioUrl(url) { set audioUrl(url) {
this._audioUrl = url; this._audioUrl = url;
...@@ -48,6 +51,7 @@ export class AudioRecorderComponent implements OnInit, OnChanges, OnDestroy { ...@@ -48,6 +51,7 @@ export class AudioRecorderComponent implements OnInit, OnChanges, OnDestroy {
@Output() audioUploaded = new EventEmitter(); @Output() audioUploaded = new EventEmitter();
@Output() audioUploadFailure = new EventEmitter(); @Output() audioUploadFailure = new EventEmitter();
@Output() audioRemoved = new EventEmitter(); @Output() audioRemoved = new EventEmitter();
@Output() audioName = new EventEmitter();
percent = 0; percent = 0;
progress = 0; progress = 0;
recorder: any; recorder: any;
...@@ -168,8 +172,12 @@ export class AudioRecorderComponent implements OnInit, OnChanges, OnDestroy { ...@@ -168,8 +172,12 @@ export class AudioRecorderComponent implements OnInit, OnChanges, OnDestroy {
break; break;
case 'success': case 'success':
this.isUploading = false; this.isUploading = false;
let url = info.file.response.url;
url = url.substring(0, url.lastIndexOf(".")) + "_l.mp3";
info.file.response.url = url;
this.uploadSuccess(info.file.response); this.uploadSuccess(info.file.response);
this.audioUploaded.emit(info.file.response); this.audioUploaded.emit(info.file.response);
this.audioName.emit(info.file.name);
break; break;
case 'progress': case 'progress':
this.progress = parseInt(info.event.percent, 10); this.progress = parseInt(info.event.percent, 10);
......
...@@ -18,8 +18,8 @@ ...@@ -18,8 +18,8 @@
<nz-form-item> <nz-form-item>
<nz-form-label [nzSpan]="4">题目音频</nz-form-label> <nz-form-label [nzSpan]="4">题目音频</nz-form-label>
<nz-form-control [nzSpan]="12"> <nz-form-control [nzSpan]="12">
<app-audio-recorder [audioUrl]="item.questionTextAudio" <app-audio-recorder [audioUrl]="item.questionTextAudio" [_audioName]="item.questionTextAudioName"
(audioUploaded)="onAudioUploadSuccess($event, item, 'questionTextAudio')"> (audioUploaded)="onAudioUploadSuccess($event, item, 'questionTextAudio')" (audioName)="onAudioName($event, item, 'questionTextAudioName')">
</app-audio-recorder> </app-audio-recorder>
</nz-form-control> </nz-form-control>
</nz-form-item> </nz-form-item>
...@@ -34,8 +34,8 @@ ...@@ -34,8 +34,8 @@
<nz-form-item> <nz-form-item>
<nz-form-label [nzSpan]="4">完整音频</nz-form-label> <nz-form-label [nzSpan]="4">完整音频</nz-form-label>
<nz-form-control [nzSpan]="12"> <nz-form-control [nzSpan]="12">
<app-audio-recorder [audioUrl]="item.pageAudio" <app-audio-recorder [audioUrl]="item.pageAudio" [_audioName]="item.pageAudioName"
(audioUploaded)="onAudioUploadSuccess($event, item, 'pageAudio')"> (audioUploaded)="onAudioUploadSuccess($event, item, 'pageAudio')" (audioName)="onAudioName($event, item, 'pageAudioName')">
</app-audio-recorder> </app-audio-recorder>
</nz-form-control> </nz-form-control>
</nz-form-item> </nz-form-item>
...@@ -62,8 +62,8 @@ ...@@ -62,8 +62,8 @@
<nz-form-item> <nz-form-item>
<nz-form-label [nzSpan]="4">音频</nz-form-label> <nz-form-label [nzSpan]="4">音频</nz-form-label>
<nz-form-control [nzSpan]="14"> <nz-form-control [nzSpan]="14">
<app-audio-recorder [audioUrl]="data.audio" <app-audio-recorder [audioUrl]="data.audio" [_audioName]="data.audioName"
(audioUploaded)="onAudioUploadSuccess($event, data, 'audio')"> (audioUploaded)="onAudioUploadSuccess($event, data, 'audio')" (audioName)="onAudioName($event, data, 'audioName')">
</app-audio-recorder> </app-audio-recorder>
</nz-form-control> </nz-form-control>
</nz-form-item> </nz-form-item>
......
...@@ -62,6 +62,11 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy { ...@@ -62,6 +62,11 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
this.save(); this.save();
} }
if (!this.item.questionTextAudioName) {
this.item.questionTextAudioName = "故事留声机游戏说明.MP3";
this.save();
}
if (!this.item.sentences) { if (!this.item.sentences) {
this.item.sentences = []; this.item.sentences = [];
this.save(); this.save();
...@@ -88,6 +93,11 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy { ...@@ -88,6 +93,11 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
this.save(); this.save();
} }
onAudioName(e, item, key){
item[key] = e;
this.save();
}
/** /**
* 储存数据 * 储存数据
*/ */
......
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