|
@@ -45,7 +45,11 @@
|
|
|
:key="'curQue.option.child' + sIndex"
|
|
|
>
|
|
|
<template
|
|
|
- v-if="sItem.mp3_list.length > 0 && sItem.mp3_list[0].url"
|
|
|
+ v-if="
|
|
|
+ sItem.mp3_list &&
|
|
|
+ sItem.mp3_list.length > 0 &&
|
|
|
+ sItem.mp3_list[0].id
|
|
|
+ "
|
|
|
>
|
|
|
<span
|
|
|
:class="[
|
|
@@ -56,10 +60,10 @@
|
|
|
: 'NPC-play-btn-brown',
|
|
|
mp3_index == sItem.sIndex ? 'active' : '',
|
|
|
]"
|
|
|
- @click="palyAudio(sItem.new_word, sItem.sIndex)"
|
|
|
+ @click="palyAudio(sItem.sIndex)"
|
|
|
></span>
|
|
|
<audio
|
|
|
- :id="sItem.new_word"
|
|
|
+ :id="'word' + sItem.sIndex"
|
|
|
:src="sItem.mp3_list[0].id"
|
|
|
></audio>
|
|
|
</template>
|
|
@@ -158,19 +162,18 @@ export default {
|
|
|
//方法集合
|
|
|
methods: {
|
|
|
handleChange(val) {},
|
|
|
- palyAudio(new_word, sIndex) {
|
|
|
- console.log(sIndex);
|
|
|
+ palyAudio(sIndex) {
|
|
|
let _this = this;
|
|
|
_this.stopAudio();
|
|
|
- let node = document.getElementById(new_word);
|
|
|
+ let node = document.getElementById("word" + sIndex);
|
|
|
_this.playWord = node;
|
|
|
if (node) {
|
|
|
this.mp3_index = sIndex;
|
|
|
node.play();
|
|
|
}
|
|
|
- this.handleListenPlay();
|
|
|
+ this.handleListenPlay(sIndex);
|
|
|
},
|
|
|
- handleListenPlay() {
|
|
|
+ handleListenPlay(sIndex) {
|
|
|
let _this = this;
|
|
|
if (_this.playWord) {
|
|
|
let _this = this;
|
|
@@ -224,8 +227,6 @@ export default {
|
|
|
}).then((res) => {
|
|
|
this.$set(this.data, "list1", res.sentence_list);
|
|
|
this.isSuccess = true;
|
|
|
- console.log("=======");
|
|
|
- console.log(this.data.list1);
|
|
|
});
|
|
|
});
|
|
|
});
|
|
@@ -259,6 +260,9 @@ export default {
|
|
|
},
|
|
|
playNewwords() {
|
|
|
let _this = this;
|
|
|
+ if (_this.playWord) {
|
|
|
+ _this.playWord.pause();
|
|
|
+ }
|
|
|
let mp3_index = 0;
|
|
|
let leg = _this.mp3List.length;
|
|
|
let mp3 = _this.mp3List[mp3_index].mp3_list[0].id;
|
|
@@ -321,8 +325,6 @@ export default {
|
|
|
});
|
|
|
this.optionRes = JSON.parse(JSON.stringify(optionRes));
|
|
|
this.mp3List = mp3List;
|
|
|
- console.log("this.mp3List");
|
|
|
- console.log(this.curQue.option);
|
|
|
}
|
|
|
},
|
|
|
},
|