文件选择器的url和附件管理的url优化

This commit is contained in:
阿辉
2024-12-04 15:31:26 +08:00
parent 1d02f3e138
commit 36a8471dd0
2 changed files with 10 additions and 7 deletions

View File

@@ -13,15 +13,16 @@
import { defineComponent } from 'vue';
import { ref, defineProps, PropType, watch, onMounted, h } from 'vue';
import { successNotification } from '/@/utils/message';
import { getBaseURL } from '/@/utils/baseUrl';
const props = defineProps({
fileData: { type: Object as PropType<any>, required: true },
api: { type: Object as PropType<any>, required: true },
});
const _OtherFileComponent = defineComponent({ template: '<el-icon><Files /></el-icon>' });
const FileTypes = [
{ tag: 'img', attr: { src: props.fileData.url, draggable: false } },
{ tag: 'video', attr: { src: props.fileData.url, controls: false, autoplay: true, muted: true, loop: true } },
{ tag: 'audio', attr: { src: props.fileData.url, controls: true, autoplay: false, muted: false, loop: false, volume: 0 } },
{ tag: 'img', attr: { src: getBaseURL(props.fileData.url), draggable: false } },
{ tag: 'video', attr: { src: getBaseURL(props.fileData.url), controls: false, autoplay: true, muted: true, loop: true } },
{ tag: 'audio', attr: { src: getBaseURL(props.fileData.url), controls: true, autoplay: false, muted: false, loop: false, volume: 0 } },
{ tag: _OtherFileComponent, attr: { style: { fontSize: '2rem' } } },
];
const isShow = ref<boolean>(false);

View File

@@ -12,15 +12,17 @@
</template>
<template #cell_preview="scope">
<div v-if="scope.row.file_type === 0">
<el-image style="width: 100%; aspect-ratio: 1 /1 ;" :src="scope.row.url" :preview-src-list="[scope.row.url]"
:preview-teleported="true" />
<el-image style="width: 100%; aspect-ratio: 1 /1 ;" :src="getBaseURL(scope.row.url)"
:preview-src-list="[getBaseURL(scope.row.url)]" :preview-teleported="true" />
</div>
<div v-if="scope.row.file_type === 1" class="_preview" @click="openPreviewHandle(scope.row.url, 'video')">
<div v-if="scope.row.file_type === 1" class="_preview"
@click="openPreviewHandle(getBaseURL(scope.row.url), 'video')">
<el-icon :size="60">
<VideoCamera />
</el-icon>
</div>
<div v-if="scope.row.file_type === 2" class="_preview" @click="openPreviewHandle(scope.row.url, 'video')">
<div v-if="scope.row.file_type === 2" class="_preview"
@click="openPreviewHandle(getBaseURL(scope.row.url), 'video')">
<el-icon :size="60">
<Headset />
</el-icon>