Commit 948e5ee0 authored by 范雪寒's avatar 范雪寒

fix: 不上传音频的时候,不显示播放器

parent e942b39d
......@@ -128,5 +128,8 @@
}
}
},
"defaultProject": "ng-template-generator"
}
"defaultProject": "ng-template-generator",
"cli": {
"analytics": false
}
}
\ No newline at end of file
This diff is collapsed.
......@@ -88,6 +88,7 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
onAudioUploadSuccess(e, key) {
this.item[key] = e.url;
// this.item[key] = '';
this.save();
}
......@@ -98,6 +99,7 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
*/
save() {
(<any> window).courseware.setData(this.item, null, this.saveKey);
console.log('this.item = ' + JSON.stringify(this.item));
this.refresh();
}
......
......@@ -448,9 +448,9 @@ export class PlayComponent implements OnInit, OnDestroy {
];
}
if (!this.data.audio_url) {
this.data.audio_url = 'assets/play/default/audio.mp3';
}
// if (!this.data.audio_url) {
// this.data.audio_url = 'assets/play/default/audio.mp3';
// }
}
......@@ -467,7 +467,9 @@ export class PlayComponent implements OnInit, OnDestroy {
initAudio() {
// 音频资源
this.addUrlToAudioObj(this.data.audio_url);
if (this.data.audio_url) {
this.addUrlToAudioObj(this.data.audio_url);
}
......@@ -585,6 +587,7 @@ export class PlayComponent implements OnInit, OnDestroy {
mapDown(event) {
if (!this.canTouch) {
return;
}
......@@ -600,15 +603,19 @@ export class PlayComponent implements OnInit, OnDestroy {
}
if (this.checkClickTarget(this.progressBarBg)) {
this.isClickedProgress = true;
this.touchDownProgressBar(this.progressBarBg);
return;
if (this.progressBarBg){
if (this.checkClickTarget(this.progressBarBg)) {
this.isClickedProgress = true;
this.touchDownProgressBar(this.progressBarBg);
return;
}
}
if (this.checkClickTarget(this.curAudio.playBtn)) {
this.touchDownAudioBtn(this.curAudio);
return;
if (this.curAudio) {
if (this.checkClickTarget(this.curAudio.playBtn)) {
this.touchDownAudioBtn(this.curAudio);
return;
}
}
this.sentences.forEach((sentence) => {
......@@ -724,6 +731,9 @@ export class PlayComponent implements OnInit, OnDestroy {
}
private initAudioPlayer() {
if (!this.data.audio_url) {
return;
}
this.curAudio = this.audioObj[this.data.audio_url];
this.curAudio.onended = () => {
this.setAudioState(this.curAudio, false);
......@@ -864,6 +874,9 @@ export class PlayComponent implements OnInit, OnDestroy {
}
private updateTime() {
if (!this.curAudio) {
return;
}
if (!this.isClickedProgress) {
const progress = this.curAudio.currentTime / this.curAudio.duration;
this.setAudioProgress(this.progressBarBg, progress);
......
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