pdf预览修改

This commit is contained in:
2026-09-04 17:18:26 +08:00
parent fa268fec92
commit 607a36a1fb
3 changed files with 19 additions and 6 deletions
@@ -10,7 +10,7 @@ import { AiError, aiTypeJudge, aiLevelScore } from "@/service/api/ai";
import { uploadFileApi, deleteFileApi } from "@/service/api/file";
import Footer from './footer.vue'
import VuePdfEmbed from 'vue-pdf-embed';
import PDF from 'pdf-vue3'
import { VueOfficeDocx, VueOfficeExcel } from 'vue3-office-preview'
import 'vue3-office-preview/lib/style.css'
@@ -720,7 +720,7 @@ defineExpose({form})
:show="previewFile !== null"
preset="card"
:auto-focus="false"
:style="{ width: '1000px', height: 'auto' }"
:style="{ width: '1100px', height: 'auto' }"
:segmented="{ content: true, footer: true }"
@update:show="(v) => !v && (previewFile = null)"
>
@@ -736,10 +736,12 @@ defineExpose({form})
<span>上传时间{{ previewFile?.created_at }}</span>
<span v-if="previewFile?.version">{{ `版本${previewFile?.version}受控` }}</span>
</div>
<div v-if="previewFile" class="flex max-h-[70vh] overflow-x-auto items-center justify-center rounded-lg border py-2">
<div v-if="previewFile" class="max-h-[70vh] overflow-x-auto rounded-lg border">
<!-- 图片预览 -->
<template v-if="handleFileType(previewFile?.file_type) === 'image'">
<NImage :src="previewFile?.file_url" />
<div class="flex items-center justify-center py-2">
<NImage :src="previewFile?.file_url" />
</div>
</template>
<!-- Word 预览 -->
<template v-if="handleFileType(previewFile?.file_type) === 'word'">
@@ -751,7 +753,9 @@ defineExpose({form})
</template>
<!-- PDF 预览 -->
<template v-if="handleFileType(previewFile?.file_type) === 'pdf'">
<VuePdfEmbed :source="previewFile?.file_url" annotation-layer text-layer class="w-full" />
<div class="h-[68vh]">
<PDF :src="previewFile?.file_url" class="w-full h-full" />
</div>
</template>
</div>
</div>
@@ -772,7 +776,7 @@ defineExpose({form})
align-items: center;
}
.scroll {
height: calc(100vh - 393px);
height: calc(100vh - 395px);
overflow-y: auto;
}
</style>