feat: 新增文件内容项,图片时展示,pdf时跳转到预览,其他文件下载

This commit is contained in:
Marvin 2023-12-01 09:50:39 +08:00 committed by YunaiV
parent 19e3297667
commit 2a0b329565

View File

@ -50,17 +50,7 @@
<el-table v-loading="loading" :data="list"> <el-table v-loading="loading" :data="list">
<el-table-column label="文件名" align="center" prop="name" :show-overflow-tooltip="true" /> <el-table-column label="文件名" align="center" prop="name" :show-overflow-tooltip="true" />
<el-table-column label="文件路径" align="center" prop="path" :show-overflow-tooltip="true" /> <el-table-column label="文件路径" align="center" prop="path" :show-overflow-tooltip="true" />
<el-table-column label="URL" align="center" prop="url" width="110px"> <el-table-column label="URL" align="center" prop="url" :show-overflow-tooltip="true" />
<template #default="{ row }">
<el-image
class="h-80px w-80px"
:src="row.url"
:preview-src-list="[row.url]"
preview-teleported
fit="cover"
/>
</template>
</el-table-column>
<el-table-column <el-table-column
label="文件大小" label="文件大小"
align="center" align="center"
@ -69,6 +59,21 @@
:formatter="fileSizeFormatter" :formatter="fileSizeFormatter"
/> />
<el-table-column label="文件类型" align="center" prop="type" width="180px" /> <el-table-column label="文件类型" align="center" prop="type" width="180px" />
<el-table-column label="文件内容" align="center" prop="url" width="110px">
<template #default="{ row }">
<el-image
v-if="row.type.includes('image')"
class="h-80px w-80px"
lazy
:src="row.url"
:preview-src-list="[row.url]"
preview-teleported
fit="cover"
/>
<el-link v-else-if="row.type.includes('pdf')" type="primary" :href="row.url" :underline="false">预览</el-link>
<el-link v-else type="primary" download :href="row.url" :underline="false" target="_blank">下载</el-link>
</template>
</el-table-column>
<el-table-column <el-table-column
label="上传时间" label="上传时间"
align="center" align="center"