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

代理修改

上级 3979db01
/**
* web端文件预览功能
*/
import React, {Component} from 'react';
import {checkIsImage} from '@/webPublic/one_stop_public/libs/UploadCom';
import React, { Component } from 'react';
import { checkIsImage } from '@/webPublic/one_stop_public/libs/UploadCom';
import { getModal, getPopconfirm, isFromIframe } from '@/webPublic/one_stop_public/utils/utils';
// const FileViewer = CLIENT_TYPE === 'mobile' ? null : require('react-file-viewer');
......@@ -21,7 +21,7 @@ export default class index extends Component {
}
showModal = () => {
if(isFromIframe()){
if (isFromIframe()) {
return false;
}
this.setState({
......@@ -41,18 +41,26 @@ export default class index extends Component {
});
};
download = () => {
let {path, pathName} = this.props;
if(window?.parent?.open && typeof window.parent.open === 'function'){
let {
path,
pathName
} = this.props;
if (window?.parent?.open && typeof window.parent.open === 'function') {
window.parent.open(path, '_blank');
}else{
} else {
window.open(path, '_blank');
}
};
render() {
let {path, pathName, width, height} = this.props;
let {
path,
pathName,
width,
height
} = this.props;
const {visible} = this.state;
const { visible } = this.state;
let isShow = false;
let type;
let isImg = checkIsImage(pathName);
......@@ -77,15 +85,17 @@ export default class index extends Component {
<>
{isShow ? (
<Popconfirm
title='查看附件'
title="查看附件"
onConfirm={this.download}
okText='下载'
okText="下载"
onCancel={this.showModal}
cancelText={ isFromIframe() ? '取消' : '预览'}>
cancelText={isFromIframe() ? '取消' : '预览'}>
{isImg ? (
<img
ref={(node)=>{ this.imageDom = node;}}
ref={(node) => {
this.imageDom = node;
}}
style={{
width: width ? width : '100px',
height: height ? height : 'auto',
......@@ -94,13 +104,13 @@ export default class index extends Component {
alt={pathName}
/>
) : (
<a target='_blank' href={path}>
<a target="_blank" href={path}>
{pathName}
</a>
)}
</Popconfirm>
) : (
<a target='_blank' href={path}>
<a target="_blank" href={path}>
{pathName}
</a>
)}
......@@ -131,6 +141,10 @@ export default class index extends Component {
<a onClick={this.download}>
下载文件
</a>
{
!!checkIsImage(path) &&
<img src={path} style={{ maxWidth: '100%', }}/>
}
{/* {FileViewer && (
<FileViewer
fileType={type}
......
......@@ -21,7 +21,7 @@ export function checkIsImage(path) {
}
let p = path.toLowerCase();
let find = ['.jpg', '.png', '.jpeg', '.bmp', '.gif', '.bmp', '.svg'].find((x) => {
return path.indexOf(x) > -1;
return p.indexOf(x) > -1;
});
return !!find;
}
......
......@@ -234,11 +234,11 @@ export default class TableCom extends Component {
}}
/>
<Button
type='primary'
type="primary"
onClick={() => this.handleSearch(selectedKeys, confirm)}
icon='search'
icon="search"
loading={this.props.loading}
size='small'
size="small"
style={{
width: 90,
marginRight: 8,
......@@ -248,14 +248,14 @@ export default class TableCom extends Component {
<Button
loading={this.props.loading}
onClick={() => this.handleReset(clearFilters)}
size='small'
size="small"
style={{ width: 90 }}>
重置
</Button>
</div>
),
filterIcon: (filtered) => (
<Icon type='search' style={{ color: filtered ? '#1890ff' : 'red' }} />
<Icon type="search" style={{ color: filtered ? '#1890ff' : 'red' }}/>
),
onFilter: (value, record) =>
record[dataIndex]
......@@ -863,7 +863,7 @@ export default class TableCom extends Component {
};
sqlUtil = (base52, json, orgCallback, sqlKey, params, p1, p2, p3) => {
let callback = p1;
let options = p2 || {};
let options = typeof p2 === 'undefined' ? {} : p2;
let otherParams = {};
if (p1 && typeof p1 === 'object') {
callback = p2;
......@@ -892,7 +892,8 @@ export default class TableCom extends Component {
}
if (!isChange) {
const os = sqlKeys[sqlKey].options;
if (Object.keys(options).length != Object.keys(os).length) {
if (JSON.stringify(options) !== JSON.stringify(os)) {
sqlKeys[sqlKey].options = options;
isChange = true;
} else {
for (var k in options) {
......@@ -976,7 +977,7 @@ export default class TableCom extends Component {
...this.props.defaultValues[this.props.formKey],
...options,
});
console.log(JSON.stringify(allValues));
let pp = {
sqlKey,
......@@ -1124,7 +1125,7 @@ export default class TableCom extends Component {
this.props.fatherCode,
{ // utils函数的参数
moment,
sql: this.sqlUtil.bind(this, base52, json, callback),
sql: this.sqlUtil.bind(this, base52, json, callback), // utils.sql xxx
message,
importExcel: this.props.importExcel,
router: router,
......@@ -1248,7 +1249,7 @@ export default class TableCom extends Component {
isMeta,
filterSql,
} = json;
if(isMeta){ // 2022年7月5日 2022 姚鑫国说的 如果是元数据 不需要传这个allValues
if (isMeta) { // 2022年7月5日 2022 姚鑫国说的 如果是元数据 不需要传这个allValues
// 解决禅道bug 28017
allValues = {};
}
......@@ -1259,9 +1260,9 @@ export default class TableCom extends Component {
allValues,
isMeta,
filterSql: isMeta ? filterSql || '' : undefined,
}
};
let getSqlOptionsCache = JSON.stringify(params);
if(isMeta && getSqlOptionsCache === this.state.getSqlOptionsCache){ // 当上次的请求参数和这次的相同时 不再发起请求
if (isMeta && getSqlOptionsCache === this.state.getSqlOptionsCache) { // 当上次的请求参数和这次的相同时 不再发起请求
return false;
}
......@@ -1308,10 +1309,10 @@ export default class TableCom extends Component {
valueName,
allValues,
isMeta,
}
};
let getSqlOptionsCache = JSON.stringify(params);
if(isMeta && getSqlOptionsCache === this.state.getSqlOptionsCache){ // 当上次的请求参数和这次的相同时 不再发起请求
if (isMeta && getSqlOptionsCache === this.state.getSqlOptionsCache) { // 当上次的请求参数和这次的相同时 不再发起请求
return false;
}
......@@ -1337,7 +1338,7 @@ export default class TableCom extends Component {
};
// console.log('1332', this.state.getSqlOptionsCache, JSON.stringify(params));
let getSqlOptionsCache = JSON.stringify(params);
if(isMeta && getSqlOptionsCache === this.state.getSqlOptionsCache){ // 当上次的请求参数和这次的相同时 不再发起请求
if (isMeta && getSqlOptionsCache === this.state.getSqlOptionsCache) { // 当上次的请求参数和这次的相同时 不再发起请求
return false;
}
dispatch({
......@@ -1576,7 +1577,7 @@ export default class TableCom extends Component {
) {
return <></>;
}
return <QRCode {...this.state.option} key={uuid} />;
return <QRCode {...this.state.option} key={uuid}/>;
}
if (json.comName == 'Echart') {
return (
......@@ -1592,7 +1593,7 @@ export default class TableCom extends Component {
);
}
if (json.comName == 'Graph') {
return <Neo4jD3Com key={uuid} json={json} option={this.state.option || []} />;
return <Neo4jD3Com key={uuid} json={json} option={this.state.option || []}/>;
}
if (json.comName == 'PartForm') {
......@@ -1607,7 +1608,7 @@ export default class TableCom extends Component {
<>
{this.props.form.getFieldDecorator(uuid, {
initialValue: fk,
})(<Input type='hidden' />)}
})(<Input type="hidden"/>)}
{' '}
<ZdyTable
taskId={this.props.taskId}
......@@ -1683,7 +1684,7 @@ export default class TableCom extends Component {
<>
{this.props.form.getFieldDecorator(uid, {
initialValue: obj[uuid] || json.initialValue,
})(<Input type='hidden' />)}
})(<Input type="hidden"/>)}
<span
style={{
fontWeight: get === 'mobile' ? 'bold' : '',
......@@ -1699,7 +1700,7 @@ export default class TableCom extends Component {
<>
{this.props.form.getFieldDecorator(uid, {
initialValue: this.props.form.getFieldsValue()[uid] || json.initialValue,
})(<Input type='hidden' />)}
})(<Input type="hidden"/>)}
<span
style={{
fontWeight: get === 'mobile' ? 'bold' : '',
......@@ -1747,7 +1748,7 @@ export default class TableCom extends Component {
cm = (
<span style={{ paddingRight: get === 'mobile' ? 8 : '' }}>
{value}
{get === 'mobile' ? <br /> : ''}
{get === 'mobile' ? <br/> : ''}
</span>
);
break;
......@@ -1755,7 +1756,7 @@ export default class TableCom extends Component {
cm = (
<span>
{value}
{get === 'mobile' ? <br /> : ''}
{get === 'mobile' ? <br/> : ''}
</span>
);
......@@ -1773,7 +1774,7 @@ export default class TableCom extends Component {
cm = (
<span style={{ paddingRight: get == 'mobile' ? 8 : '' }}>
{value}
{get === 'mobile' ? <br /> : ''}
{get === 'mobile' ? <br/> : ''}
</span>
);
......@@ -1782,7 +1783,7 @@ export default class TableCom extends Component {
cm = (
<span>
{value}
{get === 'mobile' ? <br /> : ''}
{get === 'mobile' ? <br/> : ''}
</span>
);
......@@ -1792,7 +1793,7 @@ export default class TableCom extends Component {
<span>
{moment(parseInt(value))
.format('YYYY-MM-DD HH:mm:ss')}
{get === 'mobile' ? <br /> : ''}
{get === 'mobile' ? <br/> : ''}
</span>
) : (
''
......@@ -1807,14 +1808,14 @@ export default class TableCom extends Component {
{filesX.map((f, index2) => {
return (
<li key={index2}>
<a target='_blank' key={f.path} href={queryApiActionPath() + f.path}>
<a target="_blank" key={f.path} href={queryApiActionPath() + f.path}>
{f.name}
</a>
</li>
);
})}
</ul>
{get === 'mobile' ? <br /> : ''}
{get === 'mobile' ? <br/> : ''}
</>
);
......@@ -1827,14 +1828,14 @@ export default class TableCom extends Component {
{files.map((f, index2) => {
return (
<li key={index2}>
<a target='_blank' key={f.path} href={queryApiActionPath() + f.path}>
<a target="_blank" key={f.path} href={queryApiActionPath() + f.path}>
{f.name}
</a>
</li>
);
})}
</ul>
{get === 'mobile' ? <br /> : ''}
{get === 'mobile' ? <br/> : ''}
</>
);
......@@ -1859,7 +1860,7 @@ export default class TableCom extends Component {
height: json.height,
}}
/>
{get === 'mobile' ? <br /> : ''}
{get === 'mobile' ? <br/> : ''}
</>
);
}
......@@ -1885,7 +1886,7 @@ export default class TableCom extends Component {
height: json.height,
}}
/>
{get === 'mobile' ? <br /> : ''}
{get === 'mobile' ? <br/> : ''}
</>
);
}
......@@ -1918,7 +1919,7 @@ export default class TableCom extends Component {
</MobileItem>
{this.props.form.getFieldDecorator(`defaultValues.${formKey}.${key}`, {
initialValue: value,
})(<Input type='hidden' />)}
})(<Input type="hidden"/>)}
</>
);
}
......@@ -1931,7 +1932,7 @@ export default class TableCom extends Component {
{cm}
{this.props.form.getFieldDecorator(`defaultValues.${formKey}.${key}`, {
initialValue: value,
})(<Input type='hidden' />)}
})(<Input type="hidden"/>)}
</>
);
}
......@@ -2018,7 +2019,7 @@ export default class TableCom extends Component {
</Form.Item>
{this.props.form.getFieldDecorator(`defaultValues.${formKey}.${key}`, {
initialValue: value,
})(<Input type='hidden' />)}
})(<Input type="hidden"/>)}
</>
);
}
......@@ -2031,7 +2032,7 @@ export default class TableCom extends Component {
{cm}
{this.props.form.getFieldDecorator(`defaultValues.${formKey}.${key}`, {
initialValue: value,
})(<Input type='hidden' />)}
})(<Input type="hidden"/>)}
</>
);
}
......@@ -2125,7 +2126,7 @@ export default class TableCom extends Component {
case 'WangEditor':
let textV = obj[dataColumn.base52];
if (!textV || textV === 'null') {
return <div />;
return <div/>;
}
cm = (
<div
......@@ -2228,7 +2229,7 @@ ${obj[dataColumn.base52]}
<Table
get={get}
columns={this.state.columns}
size='small'
size="small"
dataSource={ds}
pagination={false}
/>
......@@ -2400,7 +2401,7 @@ ${obj[dataColumn.base52]}
}
return (
<li key={index2}>
<a target='_blank' key={f.path} href={queryApiActionPath() + f.path}>
<a target="_blank" key={f.path} href={queryApiActionPath() + f.path}>
{f.name}
</a>
</li>
......@@ -2437,7 +2438,7 @@ ${obj[dataColumn.base52]}
return (
<li key={index2}>
<a
target='_blank'
target="_blank"
key={f.filePath}
href={queryApiActionPath() + f.filePath}>
{f.fileName}
......@@ -2595,7 +2596,7 @@ ${obj[dataColumn.base52]}
if (json.isLink) {
cm = <a {...ev} />;
} else {
cm = <Button loading={this.props.loading} type='primary' {...ev} />;
cm = <Button loading={this.props.loading} type="primary" {...ev} />;
}
}
......@@ -2678,7 +2679,7 @@ ${obj[dataColumn.base52]}
if (json.isLink) {
cm = <a {...ev} />;
} else {
cm = <Button loading={this.props.loading} type='primary' {...ev} />;
cm = <Button loading={this.props.loading} type="primary" {...ev} />;
}
}
......@@ -2740,7 +2741,7 @@ ${obj[dataColumn.base52]}
},
],
})(
<SwitchWeb json={json} disabled={disabled} />,
<SwitchWeb json={json} disabled={disabled}/>,
);
break;
......@@ -2876,7 +2877,7 @@ ${obj[dataColumn.base52]}
case 'InputHidden':
cm = getFieldDecorator(dataColumn.base52, {
initialValue: initValue,
})(<Input type='hidden' />);
})(<Input type="hidden"/>);
break;
case 'InputNumber':
cm = getFieldDecorator(dataColumn.base52, {
......@@ -2935,7 +2936,7 @@ ${obj[dataColumn.base52]}
message: '请选择' + dataColumn.title,
},
],
})(<Radio.Group options={options} disabled={disabled} />);
})(<Radio.Group options={options} disabled={disabled}/>);
if (get == 'mobile') {
cm = <div>{cm}</div>;
if (
......@@ -2962,7 +2963,7 @@ ${obj[dataColumn.base52]}
case 'Checkbox':
if (get === 'mobile') {
cm = (
<Flex direction='column' align='start'>
<Flex direction="column" align="start">
{getFieldDecorator(dataColumn.base52, {
initialValue: initValue, // 默认值
rules:
......@@ -2974,7 +2975,7 @@ ${obj[dataColumn.base52]}
message: '请选择' + dataColumn.title,
},
],
})(<Checkbox.Group options={options} disabled={disabled} />)}
})(<Checkbox.Group options={options} disabled={disabled}/>)}
</Flex>
);
......@@ -3044,7 +3045,7 @@ ${obj[dataColumn.base52]}
disabled={selectDis || disabled}
placeholder={json.placeholder}
style={{ width: json.width }}
optionFilterProp='children'
optionFilterProp="children"
getPopupContainer={
this.props.isDynamic && document.querySelector('#dynamic_div')
? () => {
......@@ -3174,7 +3175,7 @@ ${obj[dataColumn.base52]}
message: '请选择' + dataColumn.title,
},
],
})(<MobileCascader options={options} label={title} disabled={disabled} json={json} />);
})(<MobileCascader options={options} label={title} disabled={disabled} json={json}/>);
}
if (
......@@ -3542,7 +3543,7 @@ ${obj[dataColumn.base52]}
message: '请输入',
},
],
})(<DraftEditorCom placeholder={json.placeholder} disabled={json.disabled} />);
})(<DraftEditorCom placeholder={json.placeholder} disabled={json.disabled}/>);
if (
get === 'mobile' &&
((json.isMobileLabel != null && json.isMobileLabel) ||
......@@ -3572,7 +3573,7 @@ ${obj[dataColumn.base52]}
message: '请输入' + title,
},
],
})(<CronEditorDiy />);
})(<CronEditorDiy/>);
break;
case 'LocationCom':
cm = getFieldDecorator(dataColumn.base52, {
......@@ -3686,7 +3687,7 @@ ${obj[dataColumn.base52]}
message: '请上传图片',
},
],
})(<ImgUploadCom json={json} disabled={disabled} />);
})(<ImgUploadCom json={json} disabled={disabled}/>);
if (
get === 'mobile' &&
((json.isMobileLabel != null && json.isMobileLabel) ||
......@@ -3716,7 +3717,7 @@ ${obj[dataColumn.base52]}
message: '请上传视频',
},
],
})(<VideoUploadCom json={json} disabled={disabled} />);
})(<VideoUploadCom json={json} disabled={disabled}/>);
if (
get === 'mobile' &&
((json.isMobileLabel != null && json.isMobileLabel) ||
......@@ -3962,7 +3963,7 @@ ${obj[dataColumn.base52]}
wrapperCol={{ span: json.wrapperSpan }}
label={title}
data-cell-component-name={json.comName || 'no_com'}>
<ShowComName json={json} />
<ShowComName json={json}/>
{cm}
</Form.Item>
</>
......@@ -4054,12 +4055,12 @@ ${obj[dataColumn.base52]}
wrapperCol={{ span: json.wrapperSpan }}
label={title}
>
<ShowComName json={json} />
<ShowComName json={json}/>
{cm}
</Form.Item>
) : (
<Form.Item>
<ShowComName json={json} />
<ShowComName json={json}/>
{cm}
</Form.Item>
)
......
......@@ -44,7 +44,7 @@ const queryConfig = (key) => {
if (typeof key === 'undefined') return dynamicConfig;
if(dynamicConfig[key] && typeof dynamicConfig[key] === 'string' && process.env.NODE_ENV === 'development'){
let url = dynamicConfig[key];
url = url.replace('https://yx.bpi.edu.cn/produce', 'http://localhost:8000/produce');
url = url.replace('https://yx.bpi.edu.cn/produce', 'http://localhost:8010/produce');
url = url.replace('http://scjoyedu.eicp.net:51352/produce', 'http://localhost:8000/produce');
return url;
}
......
......@@ -14,6 +14,9 @@ export function setToken(value, time) {
localStorage.setItem('wisdom-school-token', value);
return getOneStopMyInfo();
} else {
if (value && value.length > 10) {
setCookie('token', value, 1);
}
return new Promise((resolve, reject) => {
resolve(true);
});
......@@ -65,22 +68,18 @@ export const getUserInfo = () => {
};
export function setFetchUrl(data) {
return localStorage.setItem('fetch-url-data', data);
}
export function getFetchUrl() {
return localStorage.getItem('fetch-url-data');
}
export function getType() {
return localStorage.getItem('antd-pro-type') || '';
}
export function setType(type) {
return localStorage.setItem('antd-pro-type', type);
}
......@@ -93,8 +92,8 @@ export function getCurrentUser() {
}
}
export function setCurrentUser(v){
if(v && typeof v === 'object'){
export function setCurrentUser(v) {
if (v && typeof v === 'object') {
sessionStorage.setItem('currentUser', JSON.stringify(v));
}
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论