|
@@ -45,6 +45,9 @@
|
|
|
...info,
|
|
|
});
|
|
|
if (res.errcode == '0') {
|
|
|
+ for (let [index, item] of res.data.entries()) {
|
|
|
+ item.id = index
|
|
|
+ }
|
|
|
that.$set(that, `markers`, res.data);
|
|
|
} else {
|
|
|
uni.showToast({
|
|
@@ -54,13 +57,12 @@
|
|
|
}
|
|
|
},
|
|
|
// 点击标记点对应的气泡 播放多种语音类型的讲解
|
|
|
- toTap(e) {
|
|
|
+ async toTap(e) {
|
|
|
const that = this;
|
|
|
- const markerId = e.detail.markerId.toString()
|
|
|
- const index = markerId.substr(markerId.length - 1)
|
|
|
- const marker = that.markers[index]
|
|
|
+ const markerId = e.detail.markerId
|
|
|
+ const marker = that.markers[markerId]
|
|
|
let src;
|
|
|
- if (marker.audio.length > 0) src = marker.audio[0].url
|
|
|
+ if (marker && marker.audio && marker.audio.length > 0) src = marker?.audio[0]?.url
|
|
|
innerAudioContext.destroy(); //销毁这个实例
|
|
|
innerAudioContext = uni.createInnerAudioContext();
|
|
|
innerAudioContext.autoplay = true;
|