From 478336c2fedff0ec95370e091e6f05d60c689ea5 Mon Sep 17 00:00:00 2001 From: Phoenix <64720302+Concur-max@users.noreply.github.com> Date: Fri, 16 May 2025 15:20:35 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E7=BB=84=E4=BB=B6=E5=92=8CAP?= =?UTF-8?q?I=EF=BC=8C=E6=96=B0=E5=A2=9E=E8=AF=AD=E9=9F=B3=E8=BD=AC?= =?UTF-8?q?=E6=96=87=E6=9C=AC=E5=8A=9F=E8=83=BD=EF=BC=8C=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E9=9F=B3=E9=A2=91=E6=B6=88=E6=81=AF=E7=BB=84=E4=BB=B6=EF=BC=8C?= =?UTF-8?q?=E8=B0=83=E6=95=B4=E5=8F=B3=E9=94=AE=E8=8F=9C=E5=8D=95=E9=80=BB?= =?UTF-8?q?=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components.d.ts | 1 + src/api/chat.js | 5 +- src/components/talk/message/AudioMessage.vue | 77 +++++++++++++++---- src/types/chat.ts | 5 +- .../message/inner/panel/PanelContent.vue | 24 +++--- src/views/message/inner/panel/menu.ts | 13 +++- 6 files changed, 96 insertions(+), 29 deletions(-) diff --git a/components.d.ts b/components.d.ts index d79fbb5..f68af7f 100644 --- a/components.d.ts +++ b/components.d.ts @@ -60,6 +60,7 @@ declare module 'vue' { NoticeTab: typeof import('./src/components/group/manage/NoticeTab.vue')['default'] NotificationApi: typeof import('./src/components/common/NotificationApi.vue')['default'] NRadio: typeof import('naive-ui')['NRadio'] + NSpin: typeof import('naive-ui')['NSpin'] NVirtualList: typeof import('naive-ui')['NVirtualList'] RevokeMessage: typeof import('./src/components/talk/message/RevokeMessage.vue')['default'] RouterLink: typeof import('vue-router')['RouterLink'] diff --git a/src/api/chat.js b/src/api/chat.js index ad87e6b..acb06fe 100644 --- a/src/api/chat.js +++ b/src/api/chat.js @@ -9,7 +9,10 @@ export const ServeGetTalkList = (data = {}) => { export const ServeCreateTalkList = (data = {}) => { return post('/api/v1/talk/create', data) } - +// 聊天列表创建服务接口 +export const voiceToText = (data = {}) => { + return post('/api/v1/talk/message/voice-to-text', data) +} // 删除聊天列表服务接口 export const ServeDeleteTalkList = (data = {}) => { return post('/api/v1/talk/delete', data) diff --git a/src/components/talk/message/AudioMessage.vue b/src/components/talk/message/AudioMessage.vue index 3a6d8ce..9000b9b 100644 --- a/src/components/talk/message/AudioMessage.vue +++ b/src/components/talk/message/AudioMessage.vue @@ -3,7 +3,7 @@ import { ref, reactive } from 'vue' import { PlayOne, PauseOne } from '@icon-park/vue-next' import { ITalkRecordExtraAudio, ITalkRecord } from '@/types/chat' -defineProps<{ +const props = defineProps<{ extra: ITalkRecordExtraAudio data: ITalkRecord maxWidth?: Boolean @@ -18,7 +18,8 @@ const state = reactive({ progress: 0, duration: 0, currentTime: 0, - loading: true + loading: true, + showText: false }) const onPlay = () => { @@ -40,6 +41,12 @@ const onCanplay = () => { state.duration = audioRef.value.duration durationDesc.value = formatTime(parseInt(audioRef.value.duration)) state.loading = false + + if (props.data.is_convert_text === 1 && props.data.extra.content) { + setTimeout(() => { + state.showText = true + }, 300) + } } const onError = (e: any) => { @@ -61,17 +68,12 @@ const formatTime = (value: number = 0) => { return '-' } - const minutes = Math.floor(value / 60) - let seconds = value - if (minutes > 0) { - seconds = Math.floor(value - minutes * 60) - } - - return `${minutes}'${seconds}"` + return `${Math.floor(value)}"` }