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

签名组件查看

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