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

签名组件查看

上级 a028fa82
......@@ -174,7 +174,7 @@ export default class userButton extends Component {
let dom = document.getElementById('btnsModalMountDiv');
return dom || document.body;
}}
title={isSecond ? '重新发起' : '通过审批'}
title={isSecond ? '重新发起' : '审批'}
width={600}
handleCancel={this.handleCancelOk}>
<div className={styles.is_ok}>
......
......@@ -20,6 +20,7 @@ function dataURLtoBlob(toDataURL) {
}
return new Blob([u8arr], { type: mime });
}
function blobToFile(Blob, fileName) {
Blob.lastModifiedDate = new Date();
Blob.name = fileName;
......@@ -34,6 +35,7 @@ export default class Index extends Component {
url: value,
};
}
triggerChange = (changedValue) => {
// Should provide an event to pass value to Form.
const onChange = this.props.onChange;
......@@ -41,6 +43,7 @@ export default class Index extends Component {
onChange(changedValue);
}
};
componentWillReceiveProps(nextProps) {
// Should be a controlled component.
if ('value' in nextProps) {
......@@ -51,8 +54,10 @@ export default class Index extends Component {
//
}
}
sigCanvas = {
clear: () => {},
clear: () => {
},
toDataURL: (param) => {
return '';
},
......@@ -103,11 +108,19 @@ export default class Index extends Component {
//let trimmedCanvas = this.sigCanvas.getTrimmedCanvas();
// this.setState({trimmedDataURL: this.sigCanvas.toDataURL('image/png')})
};
render() {
const { width, height } = this.props;
const {
width,
height,
} = this.props;
const { url } = this.state;
return (
<div id="canvas_signature" style={{ width: '100%', height: '100%', marginLeft: 5 }}>
<div id='canvas_signature' style={{
width: '100%',
height: '100%',
marginLeft: 5,
}}>
<div
style={{
width: width,
......@@ -117,10 +130,13 @@ export default class Index extends Component {
position: 'relative',
}}>
{url ? (
<img src={config.httpServer + url} style={{ width: width, height: height }} />
<img src={config.httpServer + url} style={{
width: width,
height: height,
}} />
) : (
<SignatureCanvas
penColor="black"
penColor='black'
ref={(ref) => {
this.sigCanvas = ref;
}}
......@@ -131,17 +147,21 @@ export default class Index extends Component {
}}
/>
)}
<div style={{ position: 'absolute', left: 5, bottom: 5 }}>
<div style={{
position: 'absolute',
left: 5,
bottom: 5,
}}>
{url ? (
<Button type="danger" size="small" onClick={this.delete}>
<Button type='danger' size='small' onClick={this.delete}>
重写
</Button>
) : (
<>
<Button style={{ marginLeft: 12 }} type="danger" size="small" onClick={this.clear}>
<Button style={{ marginLeft: 12 }} type='danger' size='small' onClick={this.clear}>
清除
</Button>
<Button style={{ marginLeft: 12 }} onClick={this.trim} size="small" type="primary">
<Button style={{ marginLeft: 12 }} onClick={this.trim} size='small' type='primary'>
保存
</Button>
</>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论