1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
import React from 'react';
import Loading from '../loadThree';
import { Slider, Row, Col } from 'antd';
import { connect } from 'dva';
import classNames from 'classnames/bind';
import { getUaaServicesNomal } from '../../../Services/services';
import { getDetailsApi } from '../../../Services/apiConfig';
const names = classNames.bind(require('./style.less'));
let width;
let sliNum = 0;
@connect()
export default class PortalFlowExamineModalImage extends React.Component {
state = {
visible: true,
slider: 0,
isImgLoading: true,
canvasIMg: '', // canvas转换的图片
configValue: false, // 配置信息
flowInfo: '', // 获取流程图的信息
};
handleCancel = () => this.setState({ visible: false });
handlePreview = () => {
// const {width} = this.img;
// this.setState({visible: true, width})
};
sliderChange = num => {
if (sliNum === 0) {
width = document.querySelector('.img').width;
}
sliNum++;
if (num == 0 && sliNum != 0) {
document.querySelector('.img').width = width;
return;
}
if (num > 0) {
document.querySelector('.img').width = width * `${1}.${num}`;
} else {
document.querySelector('.img').width = width * `${0}.${Math.abs(num + 10)}`;
}
};
getCanvasImg = imgSrc => {
this.setState(
{
canvasIMg: imgSrc,
},
() => {
this.setState({
visible: false,
});
},
);
};
componentDidMount = () => {
const { appid, code } = this.props;
this.props.dispatch({
// 获取配置信息
type: 'DataGgEditor/getNewProcessImg',
payload: {
appid,
code,
},
callback: val => {
this.setState({
flowInfo: val,
});
},
});
// 获取配置信息
getUaaServicesNomal(getDetailsApi, {
configKeys: 'IsOldFlow',
}).then(val => {
this.setState({
configValue: val[0].configValue == 'true',
});
});
};
onLoad = () => {
this.setState({
isImgLoading: false,
visible: false,
});
};
render() {
const { src, appid } = this.props;
const { visible, width, isImgLoading, canvasIMg, configValue, flowInfo } = this.state;
const GetEditor = () => {
if(flowInfo?.model?.id && isImgLoading){
const GgEditor = require('../ggEditor');
return GgEditor;
}else{
return null;
}
}
return (
<>
{configValue ? (
<div
className={names('image-warp')}
style={{ overflow: 'hidden', width: '1300px', height: '630px' }}
>
{flowInfo?.model?.id ? (
<>
<div
style={{
width: '100%',
height: '630px',
textAlign: 'center',
overflow: 'auto',
}}
>
<img onLoad={this.onLoad} src={canvasIMg}></img>
</div>
{flowInfo?.model?.id && isImgLoading ? (
<div
style={{
width: '1600px',
height: '670px',
visibility: 'hidden',
position: 'relative',
}}
>
<GetEditor
flowModelId={flowInfo.model.id}
taskKeys={flowInfo.taskKeys}
getCanvasImg={this.getCanvasImg}
isShow={false}
/>
</div>
) : null}
</>
) : (
<div style={{ marginTop: '350px' }}>
{' '}
<Loading />
</div>
)}
</div>
) : (
<div className={names('image-warp')}>
<Row>
<Col span={6} style={{ paddingLeft: 24, lineHeight: '36px' }}>
图片展示比例:
</Col>
<Col span={6}>
<Slider defaultValue={0} max={5} min={-5} onChange={this.sliderChange} />
</Col>
</Row>
<div
style={{
display: isImgLoading ? 'none' : 'block',
}}
>
<img
onLoad={this.onLoad}
className="img"
src={src}
style={{ overflow: 'auto', transition: 'all 0.5s', position: 'relative' }}
ref={node => (this.img = node)}
alt=""
onClick={this.handlePreview}
/>
</div>
{isImgLoading ? (
<div
style={{
width: '90%',
height: '610px',
display: 'flex',
justifyContent: 'center',
alignItems: 'center',
paddingLeft: '10%',
}}
>
<Loading />
</div>
) : null}
{/* <Modal
width={width >= 1200 ? 1200 : width}
wrapClassName={names("image-modal-warp")}
visible={visible} footer={null}
onCancel={this.handleCancel}
destroyOnClose
>
<img alt="example" style={{ width: '100%' }} src={src} />
</Modal> */}
</div>
)}
</>
);
}
}