文件选择器的url和附件管理的url优化
This commit is contained in:
@@ -13,15 +13,16 @@
|
|||||||
import { defineComponent } from 'vue';
|
import { defineComponent } from 'vue';
|
||||||
import { ref, defineProps, PropType, watch, onMounted, h } from 'vue';
|
import { ref, defineProps, PropType, watch, onMounted, h } from 'vue';
|
||||||
import { successNotification } from '/@/utils/message';
|
import { successNotification } from '/@/utils/message';
|
||||||
|
import { getBaseURL } from '/@/utils/baseUrl';
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
fileData: { type: Object as PropType<any>, required: true },
|
fileData: { type: Object as PropType<any>, required: true },
|
||||||
api: { 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 _OtherFileComponent = defineComponent({ template: '<el-icon><Files /></el-icon>' });
|
||||||
const FileTypes = [
|
const FileTypes = [
|
||||||
{ tag: 'img', attr: { src: props.fileData.url, draggable: false } },
|
{ tag: 'img', attr: { src: getBaseURL(props.fileData.url), draggable: false } },
|
||||||
{ tag: 'video', attr: { src: props.fileData.url, controls: false, autoplay: true, muted: true, loop: true } },
|
{ tag: 'video', attr: { src: getBaseURL(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: 'audio', attr: { src: getBaseURL(props.fileData.url), controls: true, autoplay: false, muted: false, loop: false, volume: 0 } },
|
||||||
{ tag: _OtherFileComponent, attr: { style: { fontSize: '2rem' } } },
|
{ tag: _OtherFileComponent, attr: { style: { fontSize: '2rem' } } },
|
||||||
];
|
];
|
||||||
const isShow = ref<boolean>(false);
|
const isShow = ref<boolean>(false);
|
||||||
|
|||||||
@@ -12,15 +12,17 @@
|
|||||||
</template>
|
</template>
|
||||||
<template #cell_preview="scope">
|
<template #cell_preview="scope">
|
||||||
<div v-if="scope.row.file_type === 0">
|
<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]"
|
<el-image style="width: 100%; aspect-ratio: 1 /1 ;" :src="getBaseURL(scope.row.url)"
|
||||||
:preview-teleported="true" />
|
:preview-src-list="[getBaseURL(scope.row.url)]" :preview-teleported="true" />
|
||||||
</div>
|
</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">
|
<el-icon :size="60">
|
||||||
<VideoCamera />
|
<VideoCamera />
|
||||||
</el-icon>
|
</el-icon>
|
||||||
</div>
|
</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">
|
<el-icon :size="60">
|
||||||
<Headset />
|
<Headset />
|
||||||
</el-icon>
|
</el-icon>
|
||||||
|
|||||||
Reference in New Issue
Block a user