diff --git a/src/components/talk/message/FileMessage.vue b/src/components/talk/message/FileMessage.vue index 5991598..854a134 100644 --- a/src/components/talk/message/FileMessage.vue +++ b/src/components/talk/message/FileMessage.vue @@ -2,17 +2,78 @@ import { fileFormatSize } from '@/utils/strings' import { download, getFileNameSuffix } from '@/utils/functions' import { ITalkRecordExtraFile, ITalkRecord } from '@/types/chat' +import filePaperPDF from '@/static/image/chat/file-paper-pdf.png' +import filePaperPPT from '@/static/image/chat/file-paper-ppt.png' +import filePaperWord from '@/static/image/chat/file-paper-word.png' +import filePaperExcel from '@/static/image/chat/file-paper-excel.png' +import filePaperOther from '@/static/image/chat/file-paper-other.png' +import filePaperPDFBlank from '@/static/image/chat/file-paper-pdf-blank.png' +import filePaperPPTBlank from '@/static/image/chat/file-paper-ppt-blank.png' +import filePaperWordBlank from '@/static/image/chat/file-paper-word-blank.png' +import filePaperExcelBlank from '@/static/image/chat/file-paper-excel-blank.png' +import filePaperOtherBlank from '@/static/image/chat/file-paper-other-blank.png' defineProps<{ extra: ITalkRecordExtraFile data: ITalkRecord maxWidth?: Boolean }>() + +const getFileTypeIMG = (fileName: string) => { + const suffix = fileName.split('.').pop()?.toLowerCase() || '' + let objT = { + finishedImg: '', + blankImg: '' + }; + + switch (suffix) { + case 'pdf': + objT.finishedImg = filePaperPDF + objT.blankImg = filePaperPDFBlank + break; + case 'doc': + case 'docx': + objT.finishedImg = filePaperWord + objT.blankImg = filePaperWordBlank + break; + case 'xls': + case 'xlsx': + objT.finishedImg = filePaperExcel + objT.blankImg = filePaperExcelBlank + break; + case 'ppt': + case 'pptx': + objT.finishedImg = filePaperPPT + objT.blankImg = filePaperPPTBlank + break; + default: + objT.finishedImg = filePaperOther + objT.blankImg = filePaperOtherBlank + } + return objT +} + + diff --git a/src/components/talk/message/ImageMessage.vue b/src/components/talk/message/ImageMessage.vue index 839a9aa..bf3278d 100644 --- a/src/components/talk/message/ImageMessage.vue +++ b/src/components/talk/message/ImageMessage.vue @@ -54,6 +54,11 @@ const img = (src: string, width = 200) => { :class="{ left: data.float === 'left' }" >
+
diff --git a/src/components/talk/message/VideoMessage.vue b/src/components/talk/message/VideoMessage.vue index a1f23e3..17b610b 100644 --- a/src/components/talk/message/VideoMessage.vue +++ b/src/components/talk/message/VideoMessage.vue @@ -18,11 +18,15 @@ const videoContext = ref() const open = ref(false) const img = (src: string, width = 200) => { - // console.log(props); - const info: any = getImageInfo(src) if (info.width == 0 || info.height == 0) { + if (props.extra.width) { + return { + width: props.extra.width, + height: props.extra.height + } + } return {} } @@ -42,6 +46,7 @@ const img = (src: string, width = 200) => { const fullscreenchange = (e) => { if(!e.detail.fullScreen){ videoContext.value.stop() + videoContext.value.seek(0) open.value = false } } @@ -55,11 +60,24 @@ async function onPlay() {