diff --git a/src/components/editor/CustomEditor.vue b/src/components/editor/CustomEditor.vue index 5dcd1ad..9a1caf8 100644 --- a/src/components/editor/CustomEditor.vue +++ b/src/components/editor/CustomEditor.vue @@ -1,149 +1,218 @@ @@ -1734,7 +2294,7 @@ const handleEditorClick = (event) => { 使用动态样式定位列表位置 -->
@@ -2202,6 +2762,35 @@ html[theme-mode='dark'] { } } +/** + * 图片上传加载样式 + */ +:deep(.editor-image-wrapper.image-upload-loading::before) { + content: ''; + position: absolute; + top: 50%; + left: 50%; + width: 24px; + height: 24px; + margin-top: -12px; + margin-left: -12px; + border: 2px solid rgba(0, 0, 0, 0.1); + border-top-color: #333; + border-radius: 50%; + animation: spin 0.6s linear infinite; + z-index: 1; +} + +:deep(.editor-image-wrapper.image-upload-loading img) { + opacity: 0.5; +} + +@keyframes spin { + to { + transform: rotate(360deg); + } +} + /** * 隐藏滚动条样式 * 保留滚动功能但隐藏滚动条的视觉显示 diff --git a/src/components/talk/message/FileMessage.vue b/src/components/talk/message/FileMessage.vue index de5004e..d892ee1 100644 --- a/src/components/talk/message/FileMessage.vue +++ b/src/components/talk/message/FileMessage.vue @@ -62,6 +62,15 @@ const fileInfo = computed(() => { return fileTypes[extension] || fileTypes.DEFAULT }) +// 判断文件是否可以预览 +const canPreview = computed(() => { + const extension = getFileExtension(props.extra.path) + return extension === 'PDF' || + EXCEL_EXTENSIONS.includes(extension) || + WORD_EXTENSIONS.includes(extension) || + PPT_EXTENSIONS.includes(extension) +}) + // 获取文件扩展名 function getFileExtension(filepath) { const parts = filepath?.split('.') @@ -86,14 +95,19 @@ const strokeDashoffset = computed(() => // 处理文件点击事件 const handleClick = () => { - if(!props.extra.is_uploading){ - window.open( - `${import.meta.env.VITE_PAGE_URL}/office?url=${props.extra.path}`, - '_blank', - 'width=1200,height=900,left=200,top=200,toolbar=no,menubar=no,scrollbars=yes,resizable=yes,location=no,status=no' - ); + // 只有在不上传中且文件类型支持预览时才打开预览窗口 + if(!props.extra.is_uploading) { + if(canPreview.value){ + window.open( + `${import.meta.env.VITE_PAGE_URL}/office?url=${props.extra.path}`, + '_blank', + 'width=1200,height=900,left=200,top=200,toolbar=no,menubar=no,scrollbars=yes,resizable=yes,location=no,status=no' + ); + }else{ + window['$message'].warning('暂不支持在线预览该类型文件') + } + } - } function downloadFileWithProgress(resourceUrl, filename) { @@ -114,7 +128,7 @@ const handleDownload = () => {