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)}"` }