fix: use preview-mode signed URLs and graceful media preview fallback
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user