修改文件预览组件的文件下载方式为接口方式下载,解决了下载时整个页面闪烁的问题;优化相册样式。

This commit is contained in:
Zhou Mingfa 2024-04-11 20:24:59 +08:00
parent 2e0cb6a96d
commit 9100dc1225
3 changed files with 8 additions and 8 deletions

View File

@ -24,7 +24,6 @@
<script setup> <script setup>
import { ref } from 'vue'; import { ref } from 'vue';
import { getDownload } from '/@/lib/axios';
import { fileApi } from '/src/api/support/file-api'; import { fileApi } from '/src/api/support/file-api';
import { smartSentry } from '/@/lib/smart-sentry'; import { smartSentry } from '/@/lib/smart-sentry';
import { SmartLoading } from '/@/components/framework/smart-loading'; import { SmartLoading } from '/@/components/framework/smart-loading';
@ -62,7 +61,7 @@
setVisible(true); setVisible(true);
return; return;
} }
window.open(fileItem.fileUrl); fileApi.downLoadFile(fileItem.fileKey);
} }
// //

View File

@ -22,8 +22,9 @@
v-for="(item, index) in fileList" v-for="(item, index) in fileList"
:key="index" :key="index"
:src="item.fileUrl" :src="item.fileUrl"
:style="{ display: type === 'text' ? 'none' : '' }" :style="{ display: type === 'text' ? 'none' : '', padding: '2px', height: '100px' }"
:width="width" :width="width"
@click="preview(item, index)"
/> />
</a-image-preview-group> </a-image-preview-group>
</a-space> </a-space>
@ -31,7 +32,7 @@
</template> </template>
<script setup> <script setup>
import { ref } from 'vue'; import { ref } from 'vue';
import { getDownload } from '/@/lib/axios'; import { fileApi } from '/src/api/support/file-api';
let props = defineProps({ let props = defineProps({
fileList: { fileList: {
@ -48,7 +49,7 @@
// image // image
width: { width: {
type: Number, type: Number,
default: 150, default: 100,
}, },
// html <br/> // html <br/>
separator: { separator: {
@ -64,7 +65,7 @@
previewCurrent.value = index; previewCurrent.value = index;
visible.value = true; visible.value = true;
} else { } else {
window.open(file.fileUrl); fileApi.downLoadFile(file.fileKey);
} }
} }

View File

@ -45,7 +45,7 @@
<a-table rowKey="feedbackId" :dataSource="tableData" :columns="tableColumns" :pagination="false" :loading="tableLoading" size="small" bordered> <a-table rowKey="feedbackId" :dataSource="tableData" :columns="tableColumns" :pagination="false" :loading="tableLoading" size="small" bordered>
<template #bodyCell="{ text, column }"> <template #bodyCell="{ text, column }">
<template v-if="column.dataIndex === 'feedbackAttachment'"> <template v-if="column.dataIndex === 'feedbackAttachment'">
<FilePreview :fileList="text" /> <FilePreview :fileList="text" type="picture" />
</template> </template>
<template v-if="column.dataIndex === 'userType'"> <template v-if="column.dataIndex === 'userType'">
<span>{{ $smartEnumPlugin.getDescByValue('USER_TYPE_ENUM', text) }}</span> <span>{{ $smartEnumPlugin.getDescByValue('USER_TYPE_ENUM', text) }}</span>