提交 4fa93916 authored 作者: 王鹏飞's avatar 王鹏飞

chore: 修改预览地址

上级 282b1d43
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
"element-plus": "^2.2.19", "element-plus": "^2.2.19",
"file-saver": "^2.0.5", "file-saver": "^2.0.5",
"format-duration": "^2.0.0", "format-duration": "^2.0.0",
"js-base64": "^3.7.7",
"lodash-es": "^4.17.21", "lodash-es": "^4.17.21",
"pinia": "^2.0.23", "pinia": "^2.0.23",
"qs": "^6.11.0", "qs": "^6.11.0",
...@@ -1042,6 +1043,12 @@ ...@@ -1042,6 +1043,12 @@
"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==",
"dev": true
},
"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.npmjs.org/ms/-/ms-2.0.0.tgz", "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
...@@ -2931,10 +2938,9 @@ ...@@ -2931,10 +2938,9 @@
"dev": true "dev": true
}, },
"node_modules/js-base64": { "node_modules/js-base64": {
"version": "2.6.4", "version": "3.7.7",
"resolved": "https://registry.npmjs.org/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=="
"dev": true
}, },
"node_modules/js-yaml": { "node_modules/js-yaml": {
"version": "4.1.0", "version": "4.1.0",
...@@ -5596,6 +5602,12 @@ ...@@ -5596,6 +5602,12 @@
"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==",
"dev": true
},
"ms": { "ms": {
"version": "2.0.0", "version": "2.0.0",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
...@@ -6971,10 +6983,9 @@ ...@@ -6971,10 +6983,9 @@
"dev": true "dev": true
}, },
"js-base64": { "js-base64": {
"version": "2.6.4", "version": "3.7.7",
"resolved": "https://registry.npmjs.org/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=="
"dev": true
}, },
"js-yaml": { "js-yaml": {
"version": "4.1.0", "version": "4.1.0",
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
"element-plus": "^2.2.19", "element-plus": "^2.2.19",
"file-saver": "^2.0.5", "file-saver": "^2.0.5",
"format-duration": "^2.0.0", "format-duration": "^2.0.0",
"js-base64": "^3.7.7",
"lodash-es": "^4.17.21", "lodash-es": "^4.17.21",
"pinia": "^2.0.23", "pinia": "^2.0.23",
"qs": "^6.11.0", "qs": "^6.11.0",
......
<script setup lang="ts"> <script setup lang="ts">
import { getOnlinePreviewUrl } from '@/utils/onlinePreview'
import { useLog } from '@/composables/useLog' import { useLog } from '@/composables/useLog'
const log = useLog({ hasKey: true }) const log = useLog({ hasKey: true })
...@@ -14,7 +15,8 @@ const fileExtensionName = $computed(() => { ...@@ -14,7 +15,8 @@ const fileExtensionName = $computed(() => {
}) })
const officeUrl = $computed(() => { const officeUrl = $computed(() => {
if (['pptx', 'doc', 'docx', 'xls', 'xlsx'].includes(fileExtensionName)) { if (['pptx', 'doc', 'docx', 'xls', 'xlsx'].includes(fileExtensionName)) {
return `https://view.officeapps.live.com/op/view.aspx?src=${url}` return getOnlinePreviewUrl(url)
// return `https://view.officeapps.live.com/op/view.aspx?src=${url}`
} else { } else {
return '' return ''
} }
......
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 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论