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

文件预览地址修改

上级 c2bd8db5
...@@ -42,7 +42,11 @@ import { ...@@ -42,7 +42,11 @@ import {
submitValues, submitValues,
checkNeedWriteAuditInfo, checkNeedWriteAuditInfo,
} from './splitDetailSplit'; } from './splitDetailSplit';
import { queryApiVersion, queryApiActionPath } from '@/webPublic/one_stop_public/utils/queryConfig'; import {
queryApiVersion,
queryApiActionPath,
queryFileUrl,
} from '@/webPublic/one_stop_public/utils/queryConfig';
import { isJSON } from '@/webPublic/zyd_public/utils/utils'; import { isJSON } from '@/webPublic/zyd_public/utils/utils';
import HistoryFormList from '@/webPublic/one_stop_public/DetailForAudit/HistoryFormList'; import HistoryFormList from '@/webPublic/one_stop_public/DetailForAudit/HistoryFormList';
...@@ -758,11 +762,7 @@ class DetailSplit extends Component { ...@@ -758,11 +762,7 @@ class DetailSplit extends Component {
marginTop: -25, marginTop: -25,
border: item.taskVariable?.sign ? '1px solid #ccc' : '', border: item.taskVariable?.sign ? '1px solid #ccc' : '',
}} }}
src={ src={queryFileUrl(item.taskVariable?.sign)}
item.taskVariable?.sign
? queryApiActionPath() + item.taskVariable?.sign
: ''
}
alt="" alt=""
/> />
) : ( ) : (
...@@ -828,11 +828,7 @@ class DetailSplit extends Component { ...@@ -828,11 +828,7 @@ class DetailSplit extends Component {
marginTop: -25, marginTop: -25,
border: item.taskVariable?.sign ? '1px solid #ccc' : '', border: item.taskVariable?.sign ? '1px solid #ccc' : '',
}} }}
src={ src={queryFileUrl(item.taskVariable?.sign)}
item.taskVariable?.sign
? queryApiActionPath() + item.taskVariable?.sign
: ''
}
alt="" alt=""
/> />
) : ( ) : (
......
// 图片上传组件 // 图片上传组件
import React from 'react'; import React from 'react';
import { Button, Icon, message, Upload } from 'antd'; import { Button, Icon, message, Upload } from 'antd';
import { queryApiActionPath } from '../utils/queryConfig'; import { queryApiActionPath, queryFileUrl } from '../utils/queryConfig';
import config from '@/webPublic/one_stop_public/config'; import config from '@/webPublic/one_stop_public/config';
import styles from './style.less'; import styles from './style.less';
import UploadComDiyForQnZy from '@/webPublic/one_stop_public/libs/UploadComDiyForQnZy'; import UploadComDiyForQnZy from '@/webPublic/one_stop_public/libs/UploadComDiyForQnZy';
...@@ -211,14 +211,13 @@ class UploadCom extends React.Component { ...@@ -211,14 +211,13 @@ class UploadCom extends React.Component {
<img <img
style={{ width: '100px', height: 'auto' }} style={{ width: '100px', height: 'auto' }}
className={styles.img} className={styles.img}
src={queryApiActionPath() + f.path} src={queryFileUrl(f.path)}
/> />
<div <div
className={styles.mask} className={styles.mask}
onClick={() => { onClick={() => {
// window.open(queryApiActionPath() + f.path);
this.setState({ this.setState({
previewImage: queryApiActionPath() + f.path, previewImage: queryFileUrl(f.path),
previewImageName : f.name, previewImageName : f.name,
previewVisible: true, previewVisible: true,
}); });
...@@ -238,7 +237,7 @@ class UploadCom extends React.Component { ...@@ -238,7 +237,7 @@ class UploadCom extends React.Component {
} }
return ( return (
<li key={f.path}> <li key={f.path}>
<a target="_blank" key={f.path} href={queryApiActionPath() + f.path}> <a target="_blank" key={f.path} href={queryFileUrl(f.path)}>
{f.name} {f.name}
</a>{' '} </a>{' '}
{!disabled && ( {!disabled && (
......
import React from "react"; import React from "react";
import { Button, Icon, message, Upload } from "antd"; import { Button, Icon, message, Upload } from "antd";
import { queryApiActionPath } from "../utils/queryConfig"; import { queryApiActionPath, queryFileUrl } from '../utils/queryConfig';
import config from "@/webPublic/one_stop_public/config"; import config from "@/webPublic/one_stop_public/config";
import styles from "./style.less"; import styles from "./style.less";
import { checkIsImage } from "./UploadCom"; import { checkIsImage } from "./UploadCom";
...@@ -140,15 +140,14 @@ export default class UploadComDiyForQnZy extends React.Component { ...@@ -140,15 +140,14 @@ export default class UploadComDiyForQnZy extends React.Component {
<img <img
style={{ width: 100, height: 100 }} style={{ width: 100, height: 100 }}
className={styles.img} className={styles.img}
src={queryApiActionPath() + f.path} src={queryFileUrl(f.path)}
/> />
<div <div
className={styles.mask} className={styles.mask}
onClick={() => { onClick={() => {
// window.open(queryApiActionPath() + f.path);
this.setState({ this.setState({
previewVisible: true, previewVisible: true,
previewImage: queryApiActionPath() + f.path, previewImage: queryFileUrl(f.path),
previewImageName: f.name, previewImageName: f.name,
}); });
}}> }}>
...@@ -167,7 +166,7 @@ export default class UploadComDiyForQnZy extends React.Component { ...@@ -167,7 +166,7 @@ export default class UploadComDiyForQnZy extends React.Component {
} }
return ( return (
<li key={f.path}> <li key={f.path}>
<a target="_blank" key={f.path} href={queryApiActionPath() + f.path}> <a target="_blank" key={f.path} href={queryFileUrl(f.path)}>
{f.name} {f.name}
</a>{" "} </a>{" "}
{!disabled && ( {!disabled && (
......
...@@ -30,7 +30,7 @@ import SearchInfo from '../../App/SearchInfo'; ...@@ -30,7 +30,7 @@ import SearchInfo from '../../App/SearchInfo';
import { Base16Encode } from '../../Base16/index'; import { Base16Encode } from '../../Base16/index';
import { isEmpty } from 'lodash'; import { isEmpty } from 'lodash';
import FilePreview from '@/webPublic/one_stop_public/filePreview'; import FilePreview from '@/webPublic/one_stop_public/filePreview';
import { queryApiActionPath } from '@/webPublic/one_stop_public/utils/queryConfig'; import { queryApiActionPath, queryFileUrl } from '@/webPublic/one_stop_public/utils/queryConfig';
import UploadCom from '@/webPublic/one_stop_public/libs/UploadCom'; import UploadCom from '@/webPublic/one_stop_public/libs/UploadCom';
import { getModal, getPopconfirm } from '@/webPublic/one_stop_public/utils/utils'; import { getModal, getPopconfirm } from '@/webPublic/one_stop_public/utils/utils';
...@@ -494,7 +494,7 @@ class TreeList extends React.Component { ...@@ -494,7 +494,7 @@ class TreeList extends React.Component {
{files.map((f, index2) => { {files.map((f, index2) => {
return ( return (
<li key={index2}> <li key={index2}>
<FilePreview path={queryApiActionPath() + f.path} pathName={f.name} /> <FilePreview path={queryFileUrl(f.path)} pathName={f.name} />
</li> </li>
); );
})} })}
......
...@@ -29,7 +29,7 @@ import SearchInfo from '../../App/SearchInfo'; ...@@ -29,7 +29,7 @@ import SearchInfo from '../../App/SearchInfo';
import { Base16Encode } from '../../Base16/index'; import { Base16Encode } from '../../Base16/index';
import { isEmpty } from 'lodash'; import { isEmpty } from 'lodash';
import FilePreview from '@/webPublic/one_stop_public/filePreview'; import FilePreview from '@/webPublic/one_stop_public/filePreview';
import { queryApiActionPath } from '@/webPublic/one_stop_public/utils/queryConfig'; import { queryApiActionPath, queryFileUrl } from '@/webPublic/one_stop_public/utils/queryConfig';
import UploadCom from '@/webPublic/one_stop_public/libs/UploadCom'; import UploadCom from '@/webPublic/one_stop_public/libs/UploadCom';
import { cloneDeep } from '../../copy/index'; import { cloneDeep } from '../../copy/index';
import { getPopconfirm, getModal } from '@/webPublic/one_stop_public/utils/utils'; import { getPopconfirm, getModal } from '@/webPublic/one_stop_public/utils/utils';
...@@ -538,7 +538,7 @@ class FormList extends React.Component { ...@@ -538,7 +538,7 @@ class FormList extends React.Component {
{files.map((f, index2) => { {files.map((f, index2) => {
return ( return (
<li key={index2}> <li key={index2}>
<FilePreview path={queryApiActionPath() + f.path} pathName={f.name} /> <FilePreview path={queryFileUrl(f.path)} pathName={f.name} />
</li> </li>
); );
})} })}
......
...@@ -47,7 +47,7 @@ import TableList from '../libs/TableList'; ...@@ -47,7 +47,7 @@ import TableList from '../libs/TableList';
import styles from './style.less'; import styles from './style.less';
import config from '@/webPublic/one_stop_public/config'; import config from '@/webPublic/one_stop_public/config';
import { cloneDeep, isEmpty, isNaN } from 'lodash'; import { cloneDeep, isEmpty, isNaN } from 'lodash';
import { queryApiActionPath } from '../utils/queryConfig'; import { queryApiActionPath, queryFileUrl } from '../utils/queryConfig';
import Highlighter from 'react-highlight-words'; import Highlighter from 'react-highlight-words';
import Signature from '../Signature'; import Signature from '../Signature';
import { changeToDraftState, deepCopy, preHandle } from '../utils/myutils'; import { changeToDraftState, deepCopy, preHandle } from '../utils/myutils';
...@@ -1812,7 +1812,7 @@ export default class TableCom extends Component { ...@@ -1812,7 +1812,7 @@ export default class TableCom extends Component {
{filesX.map((f, index2) => { {filesX.map((f, index2) => {
return ( return (
<li key={index2}> <li key={index2}>
<a target="_blank" key={f.path} href={queryApiActionPath() + f.path}> <a target="_blank" key={f.path} href={queryFileUrl(f.path)}>
{f.name} {f.name}
</a> </a>
</li> </li>
...@@ -1832,7 +1832,7 @@ export default class TableCom extends Component { ...@@ -1832,7 +1832,7 @@ export default class TableCom extends Component {
{files.map((f, index2) => { {files.map((f, index2) => {
return ( return (
<li key={index2}> <li key={index2}>
<a target="_blank" key={f.path} href={queryApiActionPath() + f.path}> <a target="_blank" key={f.path} href={queryFileUrl(f.path)}>
{f.name} {f.name}
</a> </a>
</li> </li>
...@@ -2114,7 +2114,6 @@ export default class TableCom extends Component { ...@@ -2114,7 +2114,6 @@ export default class TableCom extends Component {
switch (json.comName) { switch (json.comName) {
// 电子签章展示 // 电子签章展示
// case 'Signature': // case 'Signature':
// cm = <img src={queryApiActionPath()+obj[dataColumn.base52]} />
// break; // break;
case 'RichText': case 'RichText':
cm = ( cm = (
...@@ -2395,7 +2394,7 @@ ${obj[dataColumn.base52]} ...@@ -2395,7 +2394,7 @@ ${obj[dataColumn.base52]}
return ( return (
<li key={index2}> <li key={index2}>
<FilePreview <FilePreview
path={queryApiActionPath() + f.path} path={queryFileUrl(f.path)}
pathName={f.name} pathName={f.name}
type={'UploadCom'} type={'UploadCom'}
/> />
...@@ -2404,7 +2403,7 @@ ${obj[dataColumn.base52]} ...@@ -2404,7 +2403,7 @@ ${obj[dataColumn.base52]}
} }
return ( return (
<li key={index2}> <li key={index2}>
<a target="_blank" key={f.path} href={queryApiActionPath() + f.path}> <a target="_blank" key={f.path} href={queryFileUrl(f.path)}>
{f.name} {f.name}
</a> </a>
</li> </li>
...@@ -2418,20 +2417,11 @@ ${obj[dataColumn.base52]} ...@@ -2418,20 +2417,11 @@ ${obj[dataColumn.base52]}
<ul className={styles.imageUl}> <ul className={styles.imageUl}>
{Array.isArray(files) && {Array.isArray(files) &&
files.map((f, index2) => { files.map((f, index2) => {
// if (f.filePath.indexOf('.png') != -1 || f.filePath.indexOf('.jpg') != -1) {
// return (
// <img
// key={index2}
// style={{ width: 100, height: 100 }}
// src={queryApiActionPath() + f.filePath}
// />
// );
// }
if (get === 'web' || !this.props.isPrint) { if (get === 'web' || !this.props.isPrint) {
return ( return (
<li key={index2}> <li key={index2}>
<FilePreview <FilePreview
path={queryApiActionPath() + f.path} path={queryFileUrl(f.path)}
pathName={f.name} pathName={f.name}
type={'UploadCom'} type={'UploadCom'}
/> />
...@@ -2443,7 +2433,7 @@ ${obj[dataColumn.base52]} ...@@ -2443,7 +2433,7 @@ ${obj[dataColumn.base52]}
<a <a
target="_blank" target="_blank"
key={f.filePath} key={f.filePath}
href={queryApiActionPath() + f.filePath}> href={queryFileUrl(f.filePath)}>
{f.fileName} {f.fileName}
</a> </a>
</li> </li>
......
...@@ -139,16 +139,17 @@ export const queryIsBinary = () => queryConfig('IS_BINARY'); // 是否开启接 ...@@ -139,16 +139,17 @@ 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 = '') => { export const queryFileUrl = (url = '', defaultFile = '') => {
console.log(url);
if (url && typeof url === 'string' && url.length > 10) { if (url && typeof url === 'string' && url.length > 10) {
if(url.indexOf('http') > -1){ if (url.indexOf('http') > -1) {
return url; return url;
} }
const prefix = window.CONFIG['FILE_PATH'] || window.CONFIG['API_ACTION_PATH']; const prefix = window.CONFIG['FILE_PATH'] || window.CONFIG['API_ACTION_PATH'];
return prefix + url; return prefix + url;
} else { } else {
console.log('没有找到文件路径'); if (defaultFile) {
return defaultFile;
}
return ''; return '';
} }
}; };
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
import Editor from '@/webPublic/zyd_public/WangEditor/includes/wangEditor.min'; import Editor from '@/webPublic/zyd_public/WangEditor/includes/wangEditor.min';
import { message } from 'antd'; import { message } from 'antd';
import { uploadFile } from '@/webPublic/one_stop_public/libs/PictureSignature/ShowItem'; import { uploadFile } from '@/webPublic/one_stop_public/libs/PictureSignature/ShowItem';
import { queryApiActionPath } from '@/webPublic/one_stop_public/utils/queryConfig'; import { queryApiActionPath, queryFileUrl } from '@/webPublic/one_stop_public/utils/queryConfig';
const E = Editor; const E = Editor;
const { BtnMenu } = E; const { BtnMenu } = E;
...@@ -43,7 +43,7 @@ export default class PdfMenu extends BtnMenu { ...@@ -43,7 +43,7 @@ export default class PdfMenu extends BtnMenu {
.then((res) => { .then((res) => {
setTimeout(() => { setTimeout(() => {
if (res && res.length > 10) { if (res && res.length > 10) {
let url = queryApiActionPath() + res; let url = queryFileUrl(res);
window.message.success('上传文件成功'); window.message.success('上传文件成功');
this.editor.txt.append(` this.editor.txt.append(`
<p class='wangEditor-pdfReader'> <p class='wangEditor-pdfReader'>
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
import Editor from '@/webPublic/zyd_public/WangEditor/includes/wangEditor.min'; import Editor from '@/webPublic/zyd_public/WangEditor/includes/wangEditor.min';
import { message } from 'antd'; import { message } from 'antd';
import { uploadFile } from "@/webPublic/one_stop_public/libs/PictureSignature/ShowItem"; import { uploadFile } from "@/webPublic/one_stop_public/libs/PictureSignature/ShowItem";
import { queryApiActionPath } from '@/webPublic/one_stop_public/utils/queryConfig'; import { queryApiActionPath, queryFileUrl } from '@/webPublic/one_stop_public/utils/queryConfig';
import videoSvg from './video.svg'; import videoSvg from './video.svg';
const E = Editor; const E = Editor;
...@@ -38,7 +38,7 @@ export default class VideoMenu extends BtnMenu { ...@@ -38,7 +38,7 @@ export default class VideoMenu extends BtnMenu {
const fileName = file.name; const fileName = file.name;
uploadFile(file).then((res) => { uploadFile(file).then((res) => {
if (res && res.length > 10) { if (res && res.length > 10) {
let url = queryApiActionPath() + res; let url = queryFileUrl(res);
setTimeout(()=>{ setTimeout(()=>{
window.message.success('上传成功'); window.message.success('上传成功');
this.editor.txt.append(` this.editor.txt.append(`
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect } from 'react';
import WangEditor from './includes/wangEditor.min'; import WangEditor from './includes/wangEditor.min';
import { uploadFile } from "@/webPublic/one_stop_public/libs/PictureSignature/ShowItem"; import { uploadFile } from "@/webPublic/one_stop_public/libs/PictureSignature/ShowItem";
import { queryApiActionPath } from '@/webPublic/one_stop_public/utils/queryConfig'; import { queryApiActionPath, queryFileUrl } from '@/webPublic/one_stop_public/utils/queryConfig';
import PdfMenu from '@/webPublic/zyd_public/WangEditor/DiyMenu/PdfMenu'; import PdfMenu from '@/webPublic/zyd_public/WangEditor/DiyMenu/PdfMenu';
import VideoMenu from '@/webPublic/zyd_public/WangEditor/DiyMenu/VideoMenu'; import VideoMenu from '@/webPublic/zyd_public/WangEditor/DiyMenu/VideoMenu';
let editor = null; let editor = null;
...@@ -61,7 +61,7 @@ export default function Index({ ...@@ -61,7 +61,7 @@ export default function Index({
// 重写上传图片的方法 // 重写上传图片的方法
uploadFile(resultFiles[0]).then((y) => { uploadFile(resultFiles[0]).then((y) => {
if (y && y.length) { if (y && y.length) {
insertImgFn(queryApiActionPath() + y); insertImgFn(queryFileUrl(y));
} }
}); });
// insertImgFn(imgUrl); // insertImgFn(imgUrl);
......
import { uploadFile } from '@/webPublic/one_stop_public/libs/PictureSignature/ShowItem'; import { uploadFile } from '@/webPublic/one_stop_public/libs/PictureSignature/ShowItem';
import { queryApiActionPath } from '@/webPublic/one_stop_public/utils/queryConfig'; import { queryApiActionPath, queryFileUrl } from '@/webPublic/one_stop_public/utils/queryConfig';
import { message } from 'antd'; import { message } from 'antd';
import { isJSON } from '@/webPublic/one_stop_public/tableCompon/Split_Index/staticInfo'; import { isJSON } from '@/webPublic/one_stop_public/tableCompon/Split_Index/staticInfo';
...@@ -45,7 +45,7 @@ class MyMenu { ...@@ -45,7 +45,7 @@ class MyMenu {
.then((res) => { .then((res) => {
setTimeout(() => { setTimeout(() => {
if (res && typeof res === 'string' && res.length > 10 && res.indexOf('errMsg') <= -1) { if (res && typeof res === 'string' && res.length > 10 && res.indexOf('errMsg') <= -1) {
let url = queryApiActionPath() + res; let url = queryFileUrl(res);
message.success('上传文件成功'); message.success('上传文件成功');
const v = `<p class='wangEditor-pdfReader'><embed width='100%' const v = `<p class='wangEditor-pdfReader'><embed width='100%'
height='768px' height='768px'
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
import styles from './css/style.less'; import styles from './css/style.less';
import React, { useEffect, useState, useRef } from 'react'; import React, { useEffect, useState, useRef } from 'react';
import compressImage from '@/webPublic/zyd_public/WangEditor/compressImage'; import compressImage from '@/webPublic/zyd_public/WangEditor/compressImage';
import { queryApiActionPath } from '@/webPublic/one_stop_public/utils/queryConfig'; import { queryApiActionPath, queryFileUrl } from '@/webPublic/one_stop_public/utils/queryConfig';
import { uploadFile as uploadOnestopFile } from '@/webPublic/one_stop_public/libs/PictureSignature/ShowItem'; import { uploadFile as uploadOnestopFile } from '@/webPublic/one_stop_public/libs/PictureSignature/ShowItem';
import loadCss from '@/webPublic/zyd_public/WangEditor/WangEditor5/css/cssLoader'; import loadCss from '@/webPublic/zyd_public/WangEditor/WangEditor5/css/cssLoader';
import myMenuConf from '@/webPublic/zyd_public/WangEditor/WangEditor5/DiyMenu/pdfMenu'; import myMenuConf from '@/webPublic/zyd_public/WangEditor/WangEditor5/DiyMenu/pdfMenu';
...@@ -58,7 +58,7 @@ function WangEditorReactComponent(props) { ...@@ -58,7 +58,7 @@ function WangEditorReactComponent(props) {
uploadOnestopFile(fileNew).then((y) => { uploadOnestopFile(fileNew).then((y) => {
// 使用一站式的文件上传接口 // 使用一站式的文件上传接口
if (y && y.length) { if (y && y.length) {
insertFn(queryApiActionPath() + y, file.name); insertFn(queryFileUrl(y), file.name);
} }
}); });
}); });
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论