Commit e11a0036 authored by Chen Jiping's avatar Chen Jiping

fix:修复图片无音效的问题

parent a5287492
...@@ -3,6 +3,8 @@ import { Obj } from './ObjBean'; ...@@ -3,6 +3,8 @@ import { Obj } from './ObjBean';
export class ExercisesBean extends Obj { export class ExercisesBean extends Obj {
answerIndex: number; answerIndex: number;
picAudioUrl : String;
wordArr: Array<WordBean> = []; wordArr: Array<WordBean> = [];
} }
......
...@@ -198,6 +198,14 @@ ...@@ -198,6 +198,14 @@
</app-upload-image-with-preview> </app-upload-image-with-preview>
</nz-form-control> </nz-form-control>
</nz-form-item> </nz-form-item>
<nz-form-item>
<nz-form-label [nzSpan]="6" nzFor="{{j}}.audioUrl">图片发音</nz-form-label>
<nz-form-control [nzSpan]="6">
<app-audio-recorder id="{{j}}.picAudioUrl" [audioUrl]="data.picAudioUrl"
(audioUploaded)="onAudioUploadSuccess($event, data, 'picAudioUrl')">
</app-audio-recorder>
</nz-form-control>
</nz-form-item>
<nz-form-item> <nz-form-item>
<nz-form-label [nzSpan]="6" nzFor="exercises">操作</nz-form-label> <nz-form-label [nzSpan]="6" nzFor="exercises">操作</nz-form-label>
<nz-form-control [nzSpan]="6"> <nz-form-control [nzSpan]="6">
......
...@@ -24,6 +24,8 @@ export class Exercises { ...@@ -24,6 +24,8 @@ export class Exercises {
shown = false; shown = false;
pic : MySprite;
init(images, data) { init(images, data) {
...@@ -109,7 +111,7 @@ export class Exercises { ...@@ -109,7 +111,7 @@ export class Exercises {
pic.x = this.bg.width / 2; pic.x = this.bg.width / 2;
pic.y = 150 / 2; pic.y = 150 / 2;
console.log(pic.y); this.pic = pic;
this.bg.addChild(pic); this.bg.addChild(pic);
} }
......
...@@ -589,6 +589,8 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -589,6 +589,8 @@ export class PlayComponent implements OnInit, OnDestroy {
this.addUrlToAudioObj('index_' + i, exercises.audioUrl); this.addUrlToAudioObj('index_' + i, exercises.audioUrl);
this.addUrlToAudioObj('pic_' + i, exercises.picAudioUrl);
let wordArr = exercises.wordArr; let wordArr = exercises.wordArr;
for(let j = 0; j < wordArr.length; ++ j){ for(let j = 0; j < wordArr.length; ++ j){
...@@ -887,6 +889,15 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -887,6 +889,15 @@ export class PlayComponent implements OnInit, OnDestroy {
return; return;
} }
if(this.checkClickTarget(exercises.pic)){
let key = 'pic_' + index;
this.curAudio = this.audioObj[key];
this.playAudio(key, true);
return;
}
if(!exercises.answered){ if(!exercises.answered){
if(this.checkClickTarget(exercises.indexBg1)){ if(this.checkClickTarget(exercises.indexBg1)){
......
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