diff --git a/package.json b/package.json index 4eba37241083a00e9f55f1edb0a7703c68b7f806..ad99808abda6cc039c2ab23c0e9f16debbff416b 100644 --- a/package.json +++ b/package.json @@ -3,6 +3,7 @@ "version": "0.0.1", "scripts": { "start": "ng serve", + "build": "ng build --build--optimizer --aot --base-href /JGT/v3/", "publish": "node ./bin/publish.js" }, "private": true, diff --git a/src/app/common/audio-recorder/audio-recorder.component.html b/src/app/common/audio-recorder/audio-recorder.component.html index d42f088c12a795d2d074e31d989e76e9934de296..7e1ab8934ef39f3398b681801f348b52411c4f34 100644 --- a/src/app/common/audio-recorder/audio-recorder.component.html +++ b/src/app/common/audio-recorder/audio-recorder.component.html @@ -11,11 +11,10 @@ </div> <nz-upload [nzAccept] = "'.mp3'" - [nzShowUploadList]="false" - [nzBeforeUpload]="beforeUpload"> - <!-- nzAction="/user/resource" --> - - <!--(nzChange)="handleChange($event)"--> + [nzShowUploadList]="false" + [nzAction]="uploadUrl" + [nzData]="uploadData" + (nzChange)="handleChange($event)"> <div class="btn-upload" [ngClass]="{'has-clear': withRmBtn && (audioUrl || audioBlob)}" *ngIf="type===Type.UPLOAD && !isUploading"> <fa name="upload"></fa> diff --git a/src/app/common/audio-recorder/audio-recorder.component.ts b/src/app/common/audio-recorder/audio-recorder.component.ts index 784d405291f41b59811a1a4c7e45b408a84096d1..c2f8259df442ff6f2530df4eda50e2d699238faf 100644 --- a/src/app/common/audio-recorder/audio-recorder.component.ts +++ b/src/app/common/audio-recorder/audio-recorder.component.ts @@ -21,6 +21,9 @@ export class AudioRecorderComponent implements OnInit, OnChanges, OnDestroy { Type = Type; withRmBtn = false; + uploadUrl = (<any>window).courseware.uploadUrl(); + uploadData = (<any>window).courseware.uploadData(); + @Input() needRemove = false; @@ -70,6 +73,7 @@ export class AudioRecorderComponent implements OnInit, OnChanges, OnDestroy { // this.beforeUpload(this.audioItem); } ngOnInit() { + this.audio.onplay = () => { this.onPlay(); }; @@ -148,7 +152,7 @@ export class AudioRecorderComponent implements OnInit, OnChanges, OnDestroy { this.audioRemoved.emit(); } - handleChange(info: { type: string, file: UploadFile, event: any }): void { + handleChange(info: { type: string, file: UploadFile, event: any }): void { switch (info.type) { case 'start': this.isUploading = true; @@ -156,6 +160,7 @@ export class AudioRecorderComponent implements OnInit, OnChanges, OnDestroy { break; case 'success': this.isUploading = false; + this.uploadSuccess(info.file.response); this.audioUploaded.emit(info.file.response); break; case 'progress': @@ -184,20 +189,12 @@ export class AudioRecorderComponent implements OnInit, OnChanges, OnDestroy { this.audioUrl = null; if (!this.checkSelectFile(file)) { - return; + return false; } this.isUploading = true; - this.progress = 0; - let path = '/imman/audios/'; - if (!environment.production) { - path = '/dev' + path; - } - window['net'].doUpload(file as any, 1, path, - this.doProgress , this.uploadSuccess , this.uploadFailure ); - return false; - + this.progress = 0; } - uploadSuccess = (id, name, hash, url, file?: File, inOss = false) => { + uploadSuccess = (url) => { this.nzMessageService.info('Upload Success'); this.isUploading = false; this.audioUrl = url;