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

1

......@@ -28,6 +28,7 @@ import {
RichUtils,
} from 'draft-js';
import { getToken } from '@/webPublic/one_stop_public/utils/token';
import { queryFileUrl } from '@/webPublic/one_stop_public/utils/queryConfig';
const FormItem = Form.Item;
function getBlockStyle(block) {
......@@ -507,7 +508,7 @@ class AttrForm extends React.Component {
onChangemultiple={false}
style={{ padding: 0 }}>
{url ? (
<a href={config.httpServer + url} target="_blank">
<a href={queryFileUrl(url)} target="_blank">
{name}
</a>
) : (
......@@ -600,7 +601,7 @@ class VideoForm extends React.Component {
onChangemultiple={false}
style={{ padding: 0 }}>
{url ? (
<video src={config.httpServer + url} controls="controls">
<video src={queryFileUrl(url)} controls="controls">
您的浏览器不支持 video 标签。
</video>
) : (
......@@ -692,7 +693,7 @@ class PicForm extends React.Component {
multiple={false}
style={{ padding: 0 }}>
{url ? (
<img src={config.httpServer + url} style={{ height: 400, width: '100%' }} />
<img src={queryFileUrl(url)} style={{ height: 400, width: '100%' }} />
) : (
<p className="ant-upload-drag-icon" style={{ marginBottom: 0, height: 400 }}>
<Icon type="video" />
......
......@@ -27,6 +27,7 @@ import {
CompositeDecorator,
RichUtils,
} from 'draft-js';
import { queryFileUrl } from '@/webPublic/one_stop_public/utils/queryConfig';
const FormItem = Form.Item;
function getBlockStyle(block) {
......@@ -510,7 +511,7 @@ class AttrForm extends React.Component {
onChangemultiple={false}
style={{ padding: 0 }}>
{url ? (
<a href={config.httpServer + url} target="_blank">
<a href={queryFileUrl(url)} target="_blank">
{name}
</a>
) : (
......@@ -603,7 +604,7 @@ class VideoForm extends React.Component {
}}
style={{ padding: 0 }}>
{url ? (
<video src={config.httpServer + url} controls="controls">
<video src={queryFileUrl(url)} controls="controls">
您的浏览器不支持 video 标签。
</video>
) : (
......@@ -695,7 +696,7 @@ class PicForm extends React.Component {
multiple={false}
style={{ padding: 0 }}>
{url ? (
<img src={config.httpServer + url} style={{ height: 400, width: '100%' }} />
<img src={queryFileUrl(url)} style={{ height: 400, width: '100%' }} />
) : (
<p className="ant-upload-drag-icon" style={{ marginBottom: 0, height: 400 }}>
<Icon type="video" />
......
......@@ -4,6 +4,7 @@ import table from '../assets/专家经验系统切图/智能报告/table.png';
import chart from '../assets/专家经验系统切图/智能报告/chart.png';
import React from 'react';
import { connect } from 'dva';
import { queryFileUrl } from '@/webPublic/one_stop_public/utils/queryConfig';
const ReactHighcharts = config.ReactHighcharts;
@connect(({ Report, loading }) => ({
......@@ -200,14 +201,14 @@ const AtomicComponent = (props) => {
const { src } = entity.getData();
return (
<div>
<img src={config.httpServer + src} style={{ maxWidth: '100%' }} />
<img src={queryFileUrl(src)} style={{ maxWidth: '100%' }} />
</div>
);
}
if (type === 'attr') {
const { src, name } = entity.getData();
return (
<a href={config.httpServer + src} target="_blank">
<a href={queryFileUrl(src)} target="_blank">
{name}
</a>
);
......@@ -215,7 +216,7 @@ const AtomicComponent = (props) => {
const { src } = entity.getData();
return (
<div>
<video src={config.httpServer + src} controls="controls">
<video src={queryFileUrl(src)} controls="controls">
您的浏览器不支持 video 标签。
</video>
</div>
......
......@@ -42,7 +42,11 @@ import {
submitValues,
checkNeedWriteAuditInfo,
} 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 HistoryFormList from '@/webPublic/one_stop_public/DetailForAudit/HistoryFormList';
......@@ -758,11 +762,7 @@ class DetailSplit extends Component {
marginTop: -25,
border: item.taskVariable?.sign ? '1px solid #ccc' : '',
}}
src={
item.taskVariable?.sign
? queryApiActionPath() + item.taskVariable?.sign
: ''
}
src={queryFileUrl(item.taskVariable?.sign)}
alt=""
/>
) : (
......@@ -828,11 +828,7 @@ class DetailSplit extends Component {
marginTop: -25,
border: item.taskVariable?.sign ? '1px solid #ccc' : '',
}}
src={
item.taskVariable?.sign
? queryApiActionPath() + item.taskVariable?.sign
: ''
}
src={queryFileUrl(item.taskVariable?.sign)}
alt=""
/>
) : (
......
......@@ -115,7 +115,7 @@ export default class Signature extends Component {
Modal.info({
title: '查看签名',
content: <div className={styles.showDiv}>
<img src={config.httpServer + url}/>
<img src={queryFileUrl(url)}/>
</div>,
footer: null,
});
......@@ -138,7 +138,7 @@ export default class Signature extends Component {
className={styles.reSign}>
重新签名
</Button>*/}
<img src={config.httpServer + url} className={styles.littleSign} onClick={this.showSignImage}/>
<img src={queryFileUrl(url)} className={styles.littleSign} onClick={this.showSignImage}/>
</div>
);
} else {
......@@ -233,7 +233,7 @@ export default class Signature extends Component {
<this.EditIcon />
<img
onClick={this.showSignImage}
src={config.httpServer + url}
src={queryFileUrl(url)}
style={{
height,
width,
......
......@@ -3,6 +3,7 @@ import {Upload, message} from 'antd';
import config from '@/webPublic/one_stop_public/config';
import {zipImage} from "@/webPublic/zyd_public/utils/handlePhoto";
import { getToken } from '@/webPublic/one_stop_public/utils/token';
import { queryFileUrl } from '@/webPublic/one_stop_public/utils/queryConfig';
export default class ImgUploadCom extends React.Component {
constructor(props) {
......@@ -75,7 +76,7 @@ export default class ImgUploadCom extends React.Component {
style={{padding: 0}}
>
{url ? (
<img src={config.httpServer + url} style={{
<img src={queryFileUrl(url)} style={{
height: json.height,
width: json.width,
maxWidth: '60vw', // 解决图片在移动端过宽的bug
......
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 { isFromIframe } from '@/webPublic/one_stop_public/utils/utils';
import getOneStopUploadUrl from '@/webPublic/one_stop_public/Base16/getOneStopUploadUrl';
const oneSetItemP = {
marginBottom: 0,
userSelect: 'none',
......@@ -157,7 +158,7 @@ export const uploadFile = (file) => {
export const zipImage = (path, fileName, limitWidth = 1200) => {
return new Promise((resolve, reject) => {
let image = new Image(); //新建一个img标签(还没嵌入DOM节点)
let imageUrl = queryApiActionPath() + path;
let imageUrl = queryFileUrl(path);
image.setAttribute('crossOrigin', 'Anonymous');
image.src = imageUrl;
image.onload = () => {
......
// 图片上传组件
import React from 'react';
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 styles from './style.less';
import UploadComDiyForQnZy from '@/webPublic/one_stop_public/libs/UploadComDiyForQnZy';
......@@ -211,14 +211,13 @@ class UploadCom extends React.Component {
<img
style={{ width: '100px', height: 'auto' }}
className={styles.img}
src={queryApiActionPath() + f.path}
src={queryFileUrl(f.path)}
/>
<div
className={styles.mask}
onClick={() => {
// window.open(queryApiActionPath() + f.path);
this.setState({
previewImage: queryApiActionPath() + f.path,
previewImage: queryFileUrl(f.path),
previewImageName : f.name,
previewVisible: true,
});
......@@ -238,7 +237,7 @@ class UploadCom extends React.Component {
}
return (
<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}
</a>{' '}
{!disabled && (
......
import React from "react";
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 styles from "./style.less";
import { checkIsImage } from "./UploadCom";
......@@ -140,15 +140,14 @@ export default class UploadComDiyForQnZy extends React.Component {
<img
style={{ width: 100, height: 100 }}
className={styles.img}
src={queryApiActionPath() + f.path}
src={queryFileUrl(f.path)}
/>
<div
className={styles.mask}
onClick={() => {
// window.open(queryApiActionPath() + f.path);
this.setState({
previewVisible: true,
previewImage: queryApiActionPath() + f.path,
previewImage: queryFileUrl(f.path),
previewImageName: f.name,
});
}}>
......@@ -167,7 +166,7 @@ export default class UploadComDiyForQnZy extends React.Component {
}
return (
<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}
</a>{" "}
{!disabled && (
......
......@@ -30,7 +30,7 @@ import SearchInfo from '../../App/SearchInfo';
import { Base16Encode } from '../../Base16/index';
import { isEmpty } from 'lodash';
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 { getModal, getPopconfirm } from '@/webPublic/one_stop_public/utils/utils';
......@@ -494,7 +494,7 @@ class TreeList extends React.Component {
{files.map((f, index2) => {
return (
<li key={index2}>
<FilePreview path={queryApiActionPath() + f.path} pathName={f.name} />
<FilePreview path={queryFileUrl(f.path)} pathName={f.name} />
</li>
);
})}
......
......@@ -29,7 +29,7 @@ import SearchInfo from '../../App/SearchInfo';
import { Base16Encode } from '../../Base16/index';
import { isEmpty } from 'lodash';
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 { cloneDeep } from '../../copy/index';
import { getPopconfirm, getModal } from '@/webPublic/one_stop_public/utils/utils';
......@@ -538,7 +538,7 @@ class FormList extends React.Component {
{files.map((f, index2) => {
return (
<li key={index2}>
<FilePreview path={queryApiActionPath() + f.path} pathName={f.name} />
<FilePreview path={queryFileUrl(f.path)} pathName={f.name} />
</li>
);
})}
......
......@@ -5,6 +5,7 @@ import { isNaN } from 'lodash';
import React from 'react';
import config from '@/webPublic/one_stop_public/config';
import { isJSON } from '@/webPublic/one_stop_public/2022beidianke/isJSON';
import { queryFileUrl } from '@/webPublic/one_stop_public/utils/queryConfig';
const codeMessage = {
200: '服务器成功返回请求的数据。',
......@@ -184,12 +185,7 @@ const getRender = (com, props) => {
if (com == 'canvas') return <canvas {...props} />;
if (com == 'iframe') return <iframe {...props} />;
if (com == 'img') {
const src =
props.src != null
? props.src.indexOf('http') > -1
? props.src
: config.httpServer + props.src
: null;
const src = queryFileUrl(props.src)
const pp = {
...props,
src: src
......
......@@ -139,4 +139,19 @@ export const queryIsBinary = () => queryConfig('IS_BINARY'); // 是否开启接
export const resetLoginUrl = () => queryConfig('resetLoginUrl'); // 是否退出登录注销token 解决北电科安全测评
export const hiddenExitButton = () => queryConfig('hiddenExitButton');
export const queryFileUrl = (url = '', defaultFile = '') => {
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 {
if (defaultFile) {
return defaultFile;
}
return '';
}
};
export default queryConfig;
......@@ -35,8 +35,8 @@ export const dispatch = (type, payload, callback) => {
});
};
export const isFromIframe = () => { // 判断是否来自iframe 嵌入页面 暂时放弃使用
export const isFromIframe = () => {
// 判断是否来自iframe 嵌入页面 暂时放弃使用
return false;
let isFromIframe = window.frames.length !== parent.frames.length;
if (window.location.origin.indexOf('localhost') > -1) {
......@@ -58,18 +58,14 @@ export const getMessage = () => {
};
export const getOneStopMyInfo = (params = {}) => {
return uaaRequest('/UserApi/getMy', params)
.then((res) => {
return uaaRequest('/UserApi/getMy', params).then((res) => {
if (res) {
if (!res.groupsId) {
res.groupsId = 'pub';
}
return getTime()
.then((t) => {
res.differenceBetweenServerAndClientTime = t;
res.differenceBetweenServerAndClientTime = -50;
localStorage.setItem('user', JSON.stringify(res));
return res;
});
}
});
};
......@@ -2,7 +2,7 @@
import Editor from '@/webPublic/zyd_public/WangEditor/includes/wangEditor.min';
import { message } from 'antd';
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 { BtnMenu } = E;
......@@ -43,7 +43,7 @@ export default class PdfMenu extends BtnMenu {
.then((res) => {
setTimeout(() => {
if (res && res.length > 10) {
let url = queryApiActionPath() + res;
let url = queryFileUrl(res);
window.message.success('上传文件成功');
this.editor.txt.append(`
<p class='wangEditor-pdfReader'>
......
......@@ -6,7 +6,7 @@
import Editor from '@/webPublic/zyd_public/WangEditor/includes/wangEditor.min';
import { message } from 'antd';
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';
const E = Editor;
......@@ -38,7 +38,7 @@ export default class VideoMenu extends BtnMenu {
const fileName = file.name;
uploadFile(file).then((res) => {
if (res && res.length > 10) {
let url = queryApiActionPath() + res;
let url = queryFileUrl(res);
setTimeout(()=>{
window.message.success('上传成功');
this.editor.txt.append(`
......
......@@ -16,7 +16,7 @@
import React, { useState, useEffect } from 'react';
import WangEditor from './includes/wangEditor.min';
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 VideoMenu from '@/webPublic/zyd_public/WangEditor/DiyMenu/VideoMenu';
let editor = null;
......@@ -61,7 +61,7 @@ export default function Index({
// 重写上传图片的方法
uploadFile(resultFiles[0]).then((y) => {
if (y && y.length) {
insertImgFn(queryApiActionPath() + y);
insertImgFn(queryFileUrl(y));
}
});
// insertImgFn(imgUrl);
......
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 { isJSON } from '@/webPublic/one_stop_public/tableCompon/Split_Index/staticInfo';
......@@ -45,7 +45,7 @@ class MyMenu {
.then((res) => {
setTimeout(() => {
if (res && typeof res === 'string' && res.length > 10 && res.indexOf('errMsg') <= -1) {
let url = queryApiActionPath() + res;
let url = queryFileUrl(res);
message.success('上传文件成功');
const v = `<p class='wangEditor-pdfReader'><embed width='100%'
height='768px'
......
......@@ -8,7 +8,7 @@
import styles from './css/style.less';
import React, { useEffect, useState, useRef } from 'react';
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 loadCss from '@/webPublic/zyd_public/WangEditor/WangEditor5/css/cssLoader';
import myMenuConf from '@/webPublic/zyd_public/WangEditor/WangEditor5/DiyMenu/pdfMenu';
......@@ -58,7 +58,7 @@ function WangEditorReactComponent(props) {
uploadOnestopFile(fileNew).then((y) => {
// 使用一站式的文件上传接口
if (y && y.length) {
insertFn(queryApiActionPath() + y, file.name);
insertFn(queryFileUrl(y), file.name);
}
});
});
......
......@@ -10,8 +10,7 @@ export const getTime = () => {
method: 'POST',
body: {},
},
)
.then(t => {
).then(t => {
if (t) {
return t - new Date().getTime(); // 服务器时间 与 客户端时间的差值;
} else {
......@@ -19,7 +18,7 @@ export const getTime = () => {
}
});
} else {
return new Promise((resolve) => {
return new Promise(resolve => {
resolve(0);
return 0;
});
......@@ -27,23 +26,19 @@ export const getTime = () => {
};
export async function queryCurrent() {
// let t = await getTime();
const config = window.specialImportantSystemConfig || {};
let token = getToken();
let userInfo = getCurrentUser();
if (token && userInfo.token === token) {
return new Promise((resolve) => {
return new Promise(resolve => {
resolve(userInfo);
return userInfo;
});
}
if (config.mockServer) {
return request(
`${config.mockServer}/${config.gateWayUrl.zydxg}/UserApi/queryCurrent`,
{
return request(`${config.mockServer}/${config.gateWayUrl.zydxg}/UserApi/queryCurrent`, {
method: 'POST',
body: {},
},
);
});
}
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论