From 9b0ce027bf71197730ae35a2511b9a8d0f169ed4 Mon Sep 17 00:00:00 2001 From: joylink_cuiweidong <364937672@qq.com> Date: Tue, 21 Apr 2020 11:26:07 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/newMap/jointTrainingNew/index.vue | 2 +- .../newMap/jointTrainingNew/menuSchema.vue | 2 +- .../runPlanCommon/chooseTemplatePlan.vue | 4 +- src/views/trainRoom/e-chat.vue | 50 +++++++++++++++---- 4 files changed, 44 insertions(+), 14 deletions(-) diff --git a/src/views/newMap/jointTrainingNew/index.vue b/src/views/newMap/jointTrainingNew/index.vue index ff903836b..63092118f 100644 --- a/src/views/newMap/jointTrainingNew/index.vue +++ b/src/views/newMap/jointTrainingNew/index.vue @@ -85,7 +85,7 @@ export default { panelShow: true, ibpPart: '', showStation: '', - stationList: '', + stationList: [], showSelectStation: false, mapViewLoadedOver: false }; diff --git a/src/views/newMap/jointTrainingNew/menuSchema.vue b/src/views/newMap/jointTrainingNew/menuSchema.vue index 7ea9dbe47..7f1316488 100644 --- a/src/views/newMap/jointTrainingNew/menuSchema.vue +++ b/src/views/newMap/jointTrainingNew/menuSchema.vue @@ -66,7 +66,7 @@ export default { } }, stationList: { - type: Object, + type: Array, default() { return []; } diff --git a/src/views/publish/runPlanCommon/chooseTemplatePlan.vue b/src/views/publish/runPlanCommon/chooseTemplatePlan.vue index 4a41eae46..5ec78a9a7 100644 --- a/src/views/publish/runPlanCommon/chooseTemplatePlan.vue +++ b/src/views/publish/runPlanCommon/chooseTemplatePlan.vue @@ -75,7 +75,9 @@ export default { this.loading = false; this.dialogShow = true; this.loadInitData(); - this.reloadTable(); + if (this.mapId) { + this.reloadTable(); + } }, doClose() { this.dialogShow = false; diff --git a/src/views/trainRoom/e-chat.vue b/src/views/trainRoom/e-chat.vue index 836d801a1..f6431ca08 100644 --- a/src/views/trainRoom/e-chat.vue +++ b/src/views/trainRoom/e-chat.vue @@ -31,6 +31,7 @@
+
正在录音...
确定
@@ -75,6 +76,8 @@ export default { textList: [], recordSending:false, text: '', + seconds:0, + inter:null, recorders: null, sending: false, disabled:true, @@ -147,7 +150,6 @@ export default { startRecording() { const that = this; if (!this.recordSending && !this.recorders && !this.microphone) { - debugger; navigator.getUserMedia( { audio: true } // 只启用音频 , function (stream) { @@ -158,6 +160,13 @@ export default { }); that.recorders.startRecording(); that.recordSending = true; + that.inter = setInterval(() => { + if (that.seconds < 60) { + that.seconds++; + } else { + clearInterval(that.inter); + } + }, 1000); }, function (error) { switch (error.code || error.name) { case 'PERMISSION_DENIED': @@ -209,40 +218,42 @@ export default { this.recorders.stopRecording(function(blobURL) { const data = URL.createObjectURL(that.recorders.getBlob()); console.log('--------', data); + clearInterval(that.inter); + that.seconds = 0; const blob = that.recorders.getBlob(); const fd = new FormData(); fd.append('file', blob); chatWithAudio(fd, that.$route.query.group).then((res)=>{ this.recordSending = false; - this.$message({ + that.$message({ showClose: true, message: '语音发送成功', type: 'success' }); }).catch(error => { // this.sending = false; - this.recordSending = false; + that.recordSending = false; const message = JSON.parse(error.message); if (message.err_no == 3301) { - this.$message({ + that.$message({ showClose: true, message: '音频质量有问题', type: 'error' }); } else if (message.err_no == 3308) { - this.$message({ + that.$message({ showClose: true, message: '音频过长,建议60s以下', type: 'error' }); } else if (message.err_no == 3314) { - this.$message({ + that.$message({ showClose: true, message: '音频太短,建议重录', type: 'error' }); } else { - this.$message({ + that.$message({ showClose: true, message: '网络问题,请重试', type: 'error' @@ -309,8 +320,14 @@ export default { // } }, cancleRecording() { - this.recordSending = false; - this.recorders = null; + if (this.microphone) { + clearInterval(this.inter); + this.seconds = 0; + this.microphone.stop(); + this.microphone = null; + this.recordSending = false; + this.recorders = null; + } }, playAudio(nor) { this.$refs.audio.src = nor.src; @@ -435,6 +452,12 @@ export default { } } + #record_progress_bar{ + height: 100%; + position: absolute; + background: #bbe5f5; + } + .chat_record_tip{ height: 28px; display: inline-block; @@ -442,7 +465,6 @@ export default { width: 100%; font-size: 13px; border-top: 1px #d8dce5 solid; - padding: 6px 0px 6px 4px; position: absolute; bottom: 0; right: 0; @@ -453,15 +475,21 @@ export default { height: 8px; background: #25d825; border-radius: 10px; - margin-left: 3px; + left: 7px; margin-right: 0px; box-shadow: -1px 0px 3px #6d6d6d; border: 1px #28d228 solid; + position: absolute; + top: 10px; } .record_tip_text{ display: inline-block; font-size: 12px; margin-left: 3px; + // padding: 8px 0px 6px 0px; + position: absolute; + top: 8px; + left:20px } .record_tip_confirm{ position: absolute;