Commit 7d1cde86 authored by xxx's avatar xxx

修改语音问题

parent 63efc794
......@@ -224,6 +224,14 @@ export default {
this.heartbeatTimer = setInterval(() => {
this.reconnect();
}, 10000)
let str1 = localStorage.getItem(this.userName1 + 'voiceData');
if(!str1){
return
}else{
let arr2 = JSON.parse(str1);
this.videoContentAllArray = arr2;
this.$parent.audioDataFn(arr2);
}
},
//关闭语音申请组件
voiceAppCloseFn(){
......@@ -270,22 +278,25 @@ export default {
websocketonerror(e) {
console.log("WebSocket连接发生错误");
},
//WebSocket数据接收
//WebSocket数据接收
websocketonmessage(e){
//console.log('websocketonmessage',e);
console.log('websocketonmessage',e);
let that = this;
if(e == undefined){
let str1 = localStorage.getItem(this.userName1 + 'voiceData');
if(!str1){
return
}else{
let arr2 = JSON.parse(str1);
that.videoContentAllArray = arr2;
that.$parent.audioDataFn(arr2);
}
// let str1 = localStorage.getItem(this.userName1 + 'voiceData');
// if(!str1){
// return
// }else{
// let arr2 = JSON.parse(str1);
// that.videoContentAllArray = arr2;
// that.$parent.audioDataFn(arr2);
// }
}else{
let str1 = localStorage.getItem(this.userName1 + 'voiceData');
let str2 = JSON.parse(e.data);
if(str2.fromUserId != this.userName1){
that.$parent.tishishoudaoyuyinFn();
}
if(!str1){
let arr1 = [];
arr1.unshift(str2);
......
......@@ -52,7 +52,7 @@
<personalCenter ref="personalCenterMethod" v-show="selectFunction == 6"/>
<smallWindow ref="smallWindowMethod" v-show="selectFunction == 7"/>
<!-- 语音播放 -->
<audio controls currentTime autoplay :src='indexSrcUrl' style="display:none;"></audio>
<audio id="audioIndex" controls currentTime autoplay :src='indexSrcUrl' style="display:none;"></audio>
<!-- 语音提示区域 -->
<div class="audioTishiView" v-if="audioTishiViewShow">
<div class="audioTishiView_son1">
......@@ -111,6 +111,7 @@ import smallWindow from './components/smallWindow/index.vue' //小窗口车辆
import mars3dViewerMap from '../../components/mars3d/Map.vue' //地图
import ElectricQuantity from '../../components/electricity/index.vue' //电池组件
import indexSituationPic1 from '../../assets/images/truckTuPian/tonghuazhong1.png'
import yuyintishi from '@/assets/yuyintishi.mp3'
export default {
......@@ -716,6 +717,13 @@ export default {
indexListeningFn(item){
this.$refs.voiceApplicationMethod.selectSituationIndex(item);
},
//提示收到语音
tishishoudaoyuyinFn(){
this.indexSrcUrl = yuyintishi;
let au = document.getElementById('audioIndex');
au.currentTime = 0;
au.play();
},
//返回语音url
fanhuiAudioUrl(url){
this.indexSrcUrl = url;
......
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