fix: use preview-mode signed URLs and graceful media preview fallback

This commit is contained in:
2026-02-17 19:36:49 +08:00
parent 2b700978ad
commit f0e7381c1d
3 changed files with 58 additions and 8 deletions

View File

@@ -1937,7 +1937,10 @@ handleDragLeave(e) {
if (this.storageType === 'oss' && this.user?.oss_config_source !== 'none') {
try {
const { data } = await axios.get(`${this.apiBase}/api/files/download-url`, {
params: { path: filePath }
params: {
path: filePath,
mode: 'preview'
}
});
if (data.success) {
return data.downloadUrl;
@@ -1995,6 +1998,17 @@ handleDragLeave(e) {
}
},
handleMediaPreviewError(type = 'file') {
const typeTextMap = {
image: '图片',
video: '视频',
audio: '音频'
};
const typeText = typeTextMap[type] || '文件';
this.showToast('error', '预览失败', `${typeText}预览失败,请尝试下载后查看`);
this.closeMediaViewer();
},
// 打开视频播放器
async openVideoPlayer(file) {
const url = await this.getMediaUrl(file);