Commit f12404d6 authored by 刘斌's avatar 刘斌

fix: 测试文件预览3

parent 4d07056f
...@@ -46,6 +46,7 @@ ...@@ -46,6 +46,7 @@
"@vueuse/core": "catalog:", "@vueuse/core": "catalog:",
"ant-design-vue": "catalog:", "ant-design-vue": "catalog:",
"dayjs": "catalog:", "dayjs": "catalog:",
"js-base64": "3.7.8",
"lodash-es": "^4.17.21", "lodash-es": "^4.17.21",
"pinia": "catalog:", "pinia": "catalog:",
"tinymce": "7.9.1", "tinymce": "7.9.1",
......
...@@ -3,9 +3,9 @@ import { ref } from 'vue'; ...@@ -3,9 +3,9 @@ import { ref } from 'vue';
import { useVbenModal } from '@vben/common-ui'; import { useVbenModal } from '@vben/common-ui';
import { ossInfo } from '#/api/system/oss'; import { Base64 } from 'js-base64';
import { urlToBase64 } from '../../../utils/file/base64Conver'; import { ossInfo } from '#/api/system/oss';
// const emit = defineEmits<{ // const emit = defineEmits<{
// success: []; // success: [];
...@@ -74,11 +74,16 @@ const [BasicModal, modalApi] = useVbenModal({ ...@@ -74,11 +74,16 @@ const [BasicModal, modalApi] = useVbenModal({
if (ossId) { if (ossId) {
const resp = await ossInfo(ossId); const resp = await ossInfo(ossId);
const ossData = resp[0]; const ossData = resp[0];
ossData.url = (ossData?.url as string).replace( // ossData.url = (ossData?.url as string).replace(
'http://cdn.hr.antaikeji.top', // 'http://cdn.hr.antaikeji.top',
'/oss-proxy', // '/oss-proxy',
); // );
url.value = `/file-preview/onlinePreview?url=${encodeURIComponent(await urlToBase64(ossData.url))}`; // console.log('[ossData.url)]', ossData.url);
const base64 = encodeURIComponent(Base64.encode(ossData.url));
// console.log('[base64]', base64);
url.value = `/file-preview/onlinePreview?url=${encodeURIComponent(base64)}`;
// url.value = `http://119.184.127.215:18010/file-preview/onlinePreview?url=${base64}`;
// url.value = `http://172.16.200.110:8012/onlinePreview?url=${base64}`;
// console.log('[url.value]', url.value); // console.log('[url.value]', url.value);
// formData.value = data; // formData.value = data;
// await formApi.setValues(formData.value); // await formApi.setValues(formData.value);
......
...@@ -13,6 +13,13 @@ export default defineConfig(async () => { ...@@ -13,6 +13,13 @@ export default defineConfig(async () => {
target: 'http://localhost:9000/api', target: 'http://localhost:9000/api',
ws: true, ws: true,
}, },
'/file-preview': {
changeOrigin: true,
rewrite: (path) => path.replace(/^\/file-preview/, ''),
// mock代理目标地址
target: 'http://119.184.127.215:18010/file-preview',
ws: true,
},
}, },
}, },
}, },
......
This diff is collapsed.
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