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;