提交 c2bd8db5 authored 作者: 钟是志's avatar 钟是志

文件预览地址修改

上级 c103fb31
import React from 'react'; import React from 'react';
import { queryApiActionPath } from '@/webPublic/one_stop_public/utils/queryConfig'; import { queryApiActionPath, queryFileUrl } from '@/webPublic/one_stop_public/utils/queryConfig';
import { getToken } from '@/webPublic/one_stop_public/utils/token'; import { getToken } from '@/webPublic/one_stop_public/utils/token';
import { isFromIframe } from '@/webPublic/one_stop_public/utils/utils'; import { isFromIframe } from '@/webPublic/one_stop_public/utils/utils';
import getOneStopUploadUrl from '@/webPublic/one_stop_public/Base16/getOneStopUploadUrl'; import getOneStopUploadUrl from '@/webPublic/one_stop_public/Base16/getOneStopUploadUrl';
const oneSetItemP = { const oneSetItemP = {
marginBottom: 0, marginBottom: 0,
userSelect: 'none', userSelect: 'none',
...@@ -157,7 +158,7 @@ export const uploadFile = (file) => { ...@@ -157,7 +158,7 @@ export const uploadFile = (file) => {
export const zipImage = (path, fileName, limitWidth = 1200) => { export const zipImage = (path, fileName, limitWidth = 1200) => {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
let image = new Image(); //新建一个img标签(还没嵌入DOM节点) let image = new Image(); //新建一个img标签(还没嵌入DOM节点)
let imageUrl = queryApiActionPath() + path; let imageUrl = queryFileUrl(path);
image.setAttribute('crossOrigin', 'Anonymous'); image.setAttribute('crossOrigin', 'Anonymous');
image.src = imageUrl; image.src = imageUrl;
image.onload = () => { image.onload = () => {
......
...@@ -139,4 +139,18 @@ export const queryIsBinary = () => queryConfig('IS_BINARY'); // 是否开启接 ...@@ -139,4 +139,18 @@ export const queryIsBinary = () => queryConfig('IS_BINARY'); // 是否开启接
export const resetLoginUrl = () => queryConfig('resetLoginUrl'); // 是否退出登录注销token 解决北电科安全测评 export const resetLoginUrl = () => queryConfig('resetLoginUrl'); // 是否退出登录注销token 解决北电科安全测评
export const hiddenExitButton = () => queryConfig('hiddenExitButton'); export const hiddenExitButton = () => queryConfig('hiddenExitButton');
export const queryFileUrl = (url = '') => {
console.log(url);
if (url && typeof url === 'string' && url.length > 10) {
if(url.indexOf('http') > -1){
return url;
}
const prefix = window.CONFIG['FILE_PATH'] || window.CONFIG['API_ACTION_PATH'];
return prefix + url;
} else {
console.log('没有找到文件路径');
return '';
}
};
export default queryConfig; export default queryConfig;
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论