From 8140e15f5d8aebb3d92f8b234d6bfb1a063f3a58 Mon Sep 17 00:00:00 2001 From: liuye Date: Thu, 18 Jul 2024 15:14:34 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=B9=E8=AF=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/project/biaopin/AppDialogue/Talk.vue | 86 +++++++++--------------- 1 file changed, 30 insertions(+), 56 deletions(-) diff --git a/src/project/biaopin/AppDialogue/Talk.vue b/src/project/biaopin/AppDialogue/Talk.vue index f034b54e..82d4ecdc 100644 --- a/src/project/biaopin/AppDialogue/Talk.vue +++ b/src/project/biaopin/AppDialogue/Talk.vue @@ -144,42 +144,12 @@ export default { methods: { ...mapActions(['autoLogin', 'getUserInfo']), startRecord() { - // if(this.isFlag) return - // this.isStart = true - // uni.authorize({ - // scope: 'scope.record', - // success() { - // // const options = { - // // duration: 10000, - // // sampleRate: 44100, - // // numberOfChannels: 1, - // // encodeBitRate: 192000, - // // format: 'aac', - // // frameSize: 50 - // // } - // const options = { - // duration: 60000, - // sampleRate: 16000, - // format: 'mp3' - // } - // recorderManager.start(options); - - // }, - // fail(err) { - // this.isStart = false - // uni.showModal({ - // title: "提示", - // content: "您的录音权限未开启", - // }) - // } - // }) this.isStart = true this.recorder = Recorder({ type: 'mp3', sampleRate: 16000, bitRate: 16 }) - this.recorder.open(() => { this.recorder.start() }) @@ -220,25 +190,6 @@ export default { this.type = 'text' this.content = '' }, - upLoad(filePath) { - return new Promise((resolve, reject) => { - uni.uploadFile({ - url: `${this.$http.defaults.baseURL}/admin/file/add`, - filePath, - fileType: 'audio', - name: 'file', - success: uploadFileRes => { - this.voiceUrl = JSON.parse(uploadFileRes.data).data[0].split(';')[0] - this.voiceId = JSON.parse(uploadFileRes.data).data[0].split(';')[1] - this.sendVoice() - resolve(uploadFileRes) - }, - fail: err => { - reject(err) - } - }) - }) - }, sendMsg() { if(!this.user.token) { return this.$u.toast("请先进行登录") @@ -308,15 +259,38 @@ export default { } }) }, + // play(src, index) { + // innerAudioContext.stop(); + // if(this.messageList[index].isPlay) { + // innerAudioContext.onStop(() => { + // this.messageList[index].isPlay = false + // }) + // return + // } + + // this.messageList.map((item) => { + // if(item.sdkFileUrl) { + // item.isPlay = false + // } + // }) + // this.messageList[index].isPlay = true + // innerAudioContext.src = src; + + // this.$nextTick(() => { + // innerAudioContext.play(); + // }) + // innerAudioContext.onEnded(() => { + // this.messageList[index].isPlay = false + // }) + // }, + // playStop(index) { + // innerAudioContext.stop(); + // innerAudioContext.onStop(() => { + // this.messageList[index].isPlay = false + // }) + // }, play(src, index) { innerAudioContext.stop(); - if(this.messageList[index].isPlay) { - innerAudioContext.onStop(() => { - this.messageList[index].isPlay = false - }) - return - } - this.messageList.map((item) => { if(item.sdkFileUrl) { item.isPlay = false