From fa9b89139f34809b7bf01ca2052fbaa3d1ea64e6 Mon Sep 17 00:00:00 2001
From: wangzhibo <wangzhibo@shsening.com>
Date: 星期二, 28 七月 2026 10:58:29 +0800
Subject: [PATCH] add pdfjs and traderecord
---
src/plugins/upload/components/upload-item/viewer.vue | 37 ++++++++++++++++++++-----------------
1 files changed, 20 insertions(+), 17 deletions(-)
diff --git a/src/plugins/upload/components/upload-item/viewer.vue b/src/plugins/upload/components/upload-item/viewer.vue
index 1e1f0dc..05ab1d3 100644
--- a/src/plugins/upload/components/upload-item/viewer.vue
+++ b/src/plugins/upload/components/upload-item/viewer.vue
@@ -1,23 +1,11 @@
<template>
<div class="viewer-image">
<!-- 鍥剧墖 -->
- <el-image-viewer
- v-if="img.visible"
- :url-list="[img.url]"
- infinite
- teleported
- @close="close"
- />
+ <el-image-viewer v-if="img.visible" :url-list="[img.url]" infinite teleported @close="close" />
</div>
<!-- 鏂囨。 -->
- <cl-dialog
- v-model="doc.visible"
- :title="$t('鏂囨。棰勮')"
- height="70vh"
- width="80%"
- :scrollbar="false"
- >
+ <cl-dialog v-model="doc.visible" :title="$t('鏂囨。棰勮')" height="70vh" width="80%" :scrollbar="false">
<div v-loading="doc.loading" class="viewer-doc">
<iframe :ref="setRefs('docIframe')" :src="doc.url" />
</div>
@@ -65,11 +53,26 @@
return true;
}
- // 鏂囨。棰勮
- if (['word', 'excel', 'ppt', 'pdf'].includes(type)) {
+ if (type === 'pdf') {
doc.visible = true;
doc.loading = true;
- doc.url = `https://view.officeapps.live.com/op/view.aspx?src=${decodeURIComponent(url)}`;
+ // pdf.js viewer 璺緞锛堟斁鍦� public/pdfjs/锛�
+ doc.url = `/pdfjs/web/viewer.html?file=${encodeURIComponent(url)}`;
+
+ nextTick(() => {
+ refs.docIframe.onload = () => {
+ doc.loading = false;
+ };
+ });
+
+ return true;
+ }
+
+ // 鏂囨。棰勮
+ if (['word', 'excel', 'ppt'].includes(type)) {
+ doc.visible = true;
+ doc.loading = true;
+ doc.url = `https://view.officeapps.live.com/op/view.aspx?src=${encodeURIComponent(url)}`;
nextTick(() => {
refs.docIframe.onload = () => {
--
Gitblit v1.9.1