From fb3bf48bbc33b258f2ab602d42f5dae1eac93fd2 Mon Sep 17 00:00:00 2001 From: kuaifan Date: Sun, 29 May 2022 11:13:17 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BD=95=E9=9F=B3=E6=97=B6=E9=95=BF=E4=B8=8D?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=88=99=E5=8F=96=E6=B6=88=E5=BD=95=E9=9F=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../manage/components/ChatInput/index.vue | 51 +++++++++++++------ 1 file changed, 35 insertions(+), 16 deletions(-) diff --git a/resources/assets/js/pages/manage/components/ChatInput/index.vue b/resources/assets/js/pages/manage/components/ChatInput/index.vue index 676b554f4..d6c2f5f84 100755 --- a/resources/assets/js/pages/manage/components/ChatInput/index.vue +++ b/resources/assets/js/pages/manage/components/ChatInput/index.vue @@ -89,7 +89,7 @@
{ + if (this.recordState === 'ing') { + // 录音中,但录音时长不增加则取消录音 + if (this.__recordDuration && this.__recordDuration === this.recordDuration) { + this.__recordDuration = null; + this.stopRecord(true); + $A.messageWarning("录音失败,请重试") + } else { + this.__recordDuration = this.recordDuration; + } + } + }, 1000) }, beforeDestroy() { if (this.quill) { @@ -219,6 +233,9 @@ export default { this.observer.disconnect() this.observer = null } + if (this.recordInter) { + clearInterval(this.recordInter) + } }, computed: { ...mapState(['dialogInputCache', 'cacheProjects', 'cacheTasks', 'cacheUserBasic', 'userId']), @@ -612,20 +629,22 @@ export default { startRecord() { if (this.sendClass === 'recorder') { this.recordState = "ready"; - this.recordRec.open(_ => { - if (this.recordState === "ready") { - this.recordDuration = 0; - this.recordState = "ing" - this.recordBlob = null - setTimeout(_ => { - this.recordRec.start() - }, 300) - } else { - this.recordRec.close(); - } - }, (msg) => { - $A.messageError(msg || '打开录音失败') - }); + this.$nextTick(_ => { + this.recordRec.open(_ => { + if (this.recordState === "ready") { + this.recordDuration = 0; + this.recordState = "ing" + this.recordBlob = null + setTimeout(_ => { + this.recordRec.start() + }, 300) + } else { + this.recordRec.close(); + } + }, (msg) => { + $A.messageError(msg || '打开录音失败') + }); + }) return true; } else { return false;