fix: 修复本地上传资源路径解析
This commit is contained in:
@@ -86,6 +86,7 @@ import { fmt, statusType } from '@/utils/format';
|
||||
import { useTablePage } from '@/composables/useTablePage';
|
||||
import { openMediaViewer } from '@/composables/openMediaViewer';
|
||||
import { useRemoteSort } from '@/utils/tableSort';
|
||||
import { resolveMediaUrl } from '@/utils/mediaUrl';
|
||||
|
||||
const { t } = useI18n();
|
||||
const auth = useAuthStore();
|
||||
@@ -150,7 +151,7 @@ function renderImages(row: any) {
|
||||
width: 38,
|
||||
height: 38,
|
||||
objectFit: 'cover',
|
||||
src: item.url || item.key,
|
||||
src: mediaUrl(item),
|
||||
previewDisabled: true,
|
||||
onClick: () => previewImages(images, index),
|
||||
}),
|
||||
@@ -167,11 +168,15 @@ function renderImages(row: any) {
|
||||
|
||||
function previewImages(images: any[], index: number) {
|
||||
void openMediaViewer(
|
||||
images.map((item) => ({ url: item.url || item.key, name: item.name || item.key, type: item.type || 'image' })),
|
||||
images.map((item) => ({ url: mediaUrl(item), name: item.name || item.key, type: item.type || 'image' })),
|
||||
index,
|
||||
);
|
||||
}
|
||||
|
||||
function mediaUrl(item: any) {
|
||||
return resolveMediaUrl(item?.url || item?.key);
|
||||
}
|
||||
|
||||
async function downloadTemplate() {
|
||||
await downloadFile('/outbound/import/template', 'outbound-import-template.zip');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user