Commit c5b88c5f by yuzhenWang

预约附件用pdf插件看

parent 493c352a
......@@ -235,7 +235,7 @@
</template>
<script setup name="FileUpload">
import { ref } from 'vue'
import { ref, nextTick } from 'vue'
import { ElMessage } from 'element-plus'
import { downloadFilesAsZip } from '@/utils/zipDownload' // 引入刚才封装的工具
import CommonDialog from '@/components/commonDialog'
......@@ -284,7 +284,7 @@ const pdfCanvasRef = ref(null) // canvas 元素引用
const pdfDoc = ref(null) // pdf 文档实例
const pdfCurrentPage = ref(1) // 当前页
const pdfTotalPages = ref(0) // 总页数
const pdfScale = ref(1.0) // 缩放比例
const pdfScale = ref(1.2) // 缩放比例
// 渲染指定页
const renderPdfPage = async pageNum => {
......@@ -404,12 +404,6 @@ const previewFileType = ref('') // 'image', 'pdf', 'unsupported'
// }
function previewFile(file) {
const url = file.url || file.fileUrl
// let url = ''
// if (file.fileKey) {
// url = `https://csf-hk.oss-cn-hongkong.aliyuncs.com/PC/test/pdf/2026/05/13/a482331b118142d782ac6ba7697eae15.pdf`
// } else {
// url = file.url
// }
if (!url) {
ElMessage.warning('文件地址不存在')
return
......@@ -424,7 +418,7 @@ function previewFile(file) {
} else if (ext === 'pdf') {
previewFileType.value = 'pdf'
previewDialogVisible.value = true
// 动态加载 PDF(使用 nextTick 确保 canvas 已挂载)
// 确保 DOM 更新后再加载 PDF
nextTick(() => {
loadPdf(previewUrl.value)
})
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment