Commit 7d1cde86 authored by xxx's avatar xxx

修改语音问题

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