提交 7be659e7 authored 作者: 王鹏飞's avatar 王鹏飞

chore: 修改预览地址

上级 8a9ec8db
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
"filesize": "^10.0.7", "filesize": "^10.0.7",
"html-to-image": "^1.11.11", "html-to-image": "^1.11.11",
"html2pdf.js": "^0.10.1", "html2pdf.js": "^0.10.1",
"js-base64": "^3.7.7",
"lodash-es": "^4.17.21", "lodash-es": "^4.17.21",
"pinia": "^2.1.7", "pinia": "^2.1.7",
"print-js": "^1.6.0", "print-js": "^1.6.0",
...@@ -2512,6 +2513,11 @@ ...@@ -2512,6 +2513,11 @@
"ms": "2.0.0" "ms": "2.0.0"
} }
}, },
"node_modules/ali-oss/node_modules/js-base64": {
"version": "2.6.4",
"resolved": "https://registry.npmjs.org/js-base64/-/js-base64-2.6.4.tgz",
"integrity": "sha512-pZe//GGmwJndub7ZghVHz7vjb2LgC1m8B07Au3eYqeqv9emhESByMXxaEgkUkEqJe87oBbSniGYoQNIBklc7IQ=="
},
"node_modules/ali-oss/node_modules/ms": { "node_modules/ali-oss/node_modules/ms": {
"version": "2.0.0", "version": "2.0.0",
"resolved": "https://registry.npmmirror.com/ms/-/ms-2.0.0.tgz", "resolved": "https://registry.npmmirror.com/ms/-/ms-2.0.0.tgz",
...@@ -4416,9 +4422,9 @@ ...@@ -4416,9 +4422,9 @@
} }
}, },
"node_modules/js-base64": { "node_modules/js-base64": {
"version": "2.6.4", "version": "3.7.7",
"resolved": "https://registry.npmmirror.com/js-base64/-/js-base64-2.6.4.tgz", "resolved": "https://registry.npmjs.org/js-base64/-/js-base64-3.7.7.tgz",
"integrity": "sha512-pZe//GGmwJndub7ZghVHz7vjb2LgC1m8B07Au3eYqeqv9emhESByMXxaEgkUkEqJe87oBbSniGYoQNIBklc7IQ==" "integrity": "sha512-7rCnleh0z2CkXhH67J8K1Ytz0b2Y+yxTPL+/KOJoa20hfnVQ/3/T6W/KflYI4bRHRagNeXeU2bkNGI3v1oS/lw=="
}, },
"node_modules/js-tokens": { "node_modules/js-tokens": {
"version": "4.0.0", "version": "4.0.0",
...@@ -8629,6 +8635,11 @@ ...@@ -8629,6 +8635,11 @@
"ms": "2.0.0" "ms": "2.0.0"
} }
}, },
"js-base64": {
"version": "2.6.4",
"resolved": "https://registry.npmjs.org/js-base64/-/js-base64-2.6.4.tgz",
"integrity": "sha512-pZe//GGmwJndub7ZghVHz7vjb2LgC1m8B07Au3eYqeqv9emhESByMXxaEgkUkEqJe87oBbSniGYoQNIBklc7IQ=="
},
"ms": { "ms": {
"version": "2.0.0", "version": "2.0.0",
"resolved": "https://registry.npmmirror.com/ms/-/ms-2.0.0.tgz", "resolved": "https://registry.npmmirror.com/ms/-/ms-2.0.0.tgz",
...@@ -10148,9 +10159,9 @@ ...@@ -10148,9 +10159,9 @@
"peer": true "peer": true
}, },
"js-base64": { "js-base64": {
"version": "2.6.4", "version": "3.7.7",
"resolved": "https://registry.npmmirror.com/js-base64/-/js-base64-2.6.4.tgz", "resolved": "https://registry.npmjs.org/js-base64/-/js-base64-3.7.7.tgz",
"integrity": "sha512-pZe//GGmwJndub7ZghVHz7vjb2LgC1m8B07Au3eYqeqv9emhESByMXxaEgkUkEqJe87oBbSniGYoQNIBklc7IQ==" "integrity": "sha512-7rCnleh0z2CkXhH67J8K1Ytz0b2Y+yxTPL+/KOJoa20hfnVQ/3/T6W/KflYI4bRHRagNeXeU2bkNGI3v1oS/lw=="
}, },
"js-tokens": { "js-tokens": {
"version": "4.0.0", "version": "4.0.0",
......
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
"filesize": "^10.0.7", "filesize": "^10.0.7",
"html-to-image": "^1.11.11", "html-to-image": "^1.11.11",
"html2pdf.js": "^0.10.1", "html2pdf.js": "^0.10.1",
"js-base64": "^3.7.7",
"lodash-es": "^4.17.21", "lodash-es": "^4.17.21",
"pinia": "^2.1.7", "pinia": "^2.1.7",
"print-js": "^1.6.0", "print-js": "^1.6.0",
......
<script setup lang="ts"> <script setup lang="ts">
import { getOnlinePreviewUrl } from '@/utils/onlinePreview'
interface Props { interface Props {
url: string url: string
} }
...@@ -9,9 +10,8 @@ const fileExtensionName = $computed(() => { ...@@ -9,9 +10,8 @@ const fileExtensionName = $computed(() => {
}) })
// office文件 // office文件
const officeUrl = $computed(() => { const officeUrl = $computed(() => {
return ['pptx', 'doc', 'docx', 'xls', 'xlsx'].includes(fileExtensionName) return ['pptx', 'doc', 'docx', 'xls', 'xlsx'].includes(fileExtensionName) ? getOnlinePreviewUrl(props.url) : ''
? `https://view.officeapps.live.com/op/view.aspx?src=${props.url}` // return ['pptx', 'doc', 'docx', 'xls', 'xlsx'].includes(fileExtensionName) ? `https://view.officeapps.live.com/op/view.aspx?src=${props.url}` : ''
: ''
}) })
</script> </script>
......
import { Base64 } from 'js-base64'
export function getOnlinePreviewUrl(url: string) {
return 'http://172.16.3.203:8012/onlinePreview?url=' + encodeURIComponent(Base64.encode(url))
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论