提交 916a50d0 authored 作者: 钟是志's avatar 钟是志

签名组件优化,

utils 优化
上级 a1637d47
......@@ -49,19 +49,17 @@ function blobToFile(Blob, fileName) {
return Blob;
}
export default class Index extends Component {
export default class Signature extends Component {
constructor(props) {
super(props);
const value = props.value;
this.state = {
url: value || getUserInfo().userSign,
// url: value,
showModal: false,
};
}
triggerChange = (changedValue) => {
// Should provide an event to pass value to Form.
const onChange = this.props.onChange;
if (onChange) {
onChange(changedValue);
......@@ -72,9 +70,9 @@ export default class Index extends Component {
// Should be a controlled component.
if ('value' in nextProps && nextProps.value) {
const value = nextProps.value;
this.setState({ url: value });
//
if (value !== this.state.url) {
this.setState({ url: value });
}
}
}
......@@ -141,8 +139,10 @@ export default class Index extends Component {
};
componentDidMount() {
if (!this.props.value && this.state.value) {
this.triggerChange(this.state.value);
if (!this.props.value && this.state.url) {
setTimeout(() => {
this.triggerChange(this.state.url);
}, 2000);
}
}
......@@ -191,19 +191,19 @@ export default class Index extends Component {
padding: '24px 12px',
}}
>
<div className={styles.borderDiv}>
<SignatureCanvas
penColor='black'
ref={(ref) => {
this.sigCanvas = ref;
}}
canvasProps={{
width: width + 'px',
height: height + 'px',
className: 'sigCanvas',
}}
/>
</div>
<div className={styles.borderDiv}>
<SignatureCanvas
penColor="black"
ref={(ref) => {
this.sigCanvas = ref;
}}
canvasProps={{
width: width + 'px',
height: height + 'px',
className: 'sigCanvas',
}}
/>
</div>
</Modal>);
};
......@@ -225,7 +225,7 @@ export default class Index extends Component {
>
<div className={styles.borderDiv}>
<SignatureCanvas
penColor='black'
penColor="black"
ref={(ref) => {
this.sigCanvas = ref;
}}
......@@ -284,70 +284,14 @@ export default class Index extends Component {
// const MobileSign = this.MobileSign;
// const MobileModal = this.MobileModal;
return <>
<this.MobileSign />
<this.MobileModal />
<this.MobileSign/>
<this.MobileModal/>
</>;
}else{
} else {
return <>
<this.WebSign />
<this.WebModal />
<this.WebSign/>
<this.WebModal/>
</>;
}
// return (
// <div id='canvas_signature' style={{
// width: '100%',
// height: '100%',
// marginLeft: 5,
// }}>
// <div
// style={{
// width: width,
// textAlign: 'center',
// height: height,
// border: '1px dashed gray',
// position: 'relative',
// }}>
// {url ? (
// <img src={config.httpServer + url} style={{
// width: width,
// height: height - 20,
// }} />
// ) : (
// <SignatureCanvas
// penColor='black'
// ref={(ref) => {
// this.sigCanvas = ref;
// }}
// canvasProps={{
// width: width || 400,
// height: height ? height - 20 : 200,
// className: 'sigCanvas',
// }}
// />
// )}
// <div style={{
// position: 'absolute',
// left: 5,
// bottom: 5,
// }}>
// {url ? (
// <Button type='danger' size='small' onClick={this.delete}>
// 重写
// </Button>
// ) : (
// <>
// <Button style={{ marginLeft: 12 }} type='danger' size='small' onClick={this.clear}>
// 清除
// </Button>
// <Button style={{ marginLeft: 12 }} onClick={this.trim} size='small' type='primary'>
// 保存
// </Button>
// </>
// )}
// </div>
// </div>
// </div>
// );
}
}
......@@ -1138,6 +1138,7 @@ export default class TableCom extends Component {
render: getRender,
base64: getBase64,
form: this.props.form,
preHandle,
},
functionObj,
this.props.routerState,
......
......@@ -122,10 +122,6 @@ export function preHandle(values) {
// childObj[j][index] = childObj[j][index].valueOf();
}
});
if(j === 'LckrMFujFgw$LckrXpIoQdc'){
// console.log(values[key][k]['LckrMFujFgw'], key, k, j);
// console.log(values[key][k]['LckrXpIoQdc'], key, k, j);
}
delete childObj[j];
// 我写的代码
......
......@@ -175,7 +175,7 @@ export const requestOrigin = (url, data, options = {}) => {
// method: "POST",
requestType: 'form',
...getHeaders(),
...getHeaders(url),
...options,
})
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论