提交 4edaec0b authored 作者: 钟是志's avatar 钟是志

签章组件修改

上级 eb5b7caf
...@@ -80,27 +80,13 @@ export default function PictureSignature({ ...@@ -80,27 +80,13 @@ export default function PictureSignature({
...others ...others
}) { }) {
let imageRef = useRef(); let imageRef = useRef();
const [fileInfo, setFileInfo] = useState({ }); const [fileInfo, setFileInfo] = useState({});
// const [fileInfo, setFileInfo] = useState(fakeFileInfo); // const [fileInfo, setFileInfo] = useState(fakeFileInfo);
const [openEdit, setOpenEdit] = useState(false); const [openEdit, setOpenEdit] = useState(false);
const [originSignConfig, setOriginConfig] = useState([]); const [originSignConfig, setOriginConfig] = useState([]);
const [showModal, setShowModal] = useState(false); const [showModal, setShowModal] = useState(false);
const [otherProps, setOtherProps] = useState({}); const [otherProps, setOtherProps] = useState({});
const [imageInfo, setImageInfo] = useState(null); const [imageInfo, setImageInfo] = useState(null);
useEffect(() => {
let fileInfo = {};
if(others?.fileInfo?.originPath){
setFileInfo({
...others?.fileInfo,
path: others?.fileInfo?.originPath,
})
}else{
setFileInfo({...others?.fileInfo});
}
}, []);
const changeShowModal = () => { const changeShowModal = () => {
if (!showModal) { if (!showModal) {
if (!imageInfo && !disabled) { if (!imageInfo && !disabled) {
...@@ -126,6 +112,8 @@ export default function PictureSignature({ ...@@ -126,6 +112,8 @@ export default function PictureSignature({
}; };
// console.log(json); // console.log(json);
useEffect(() => { useEffect(() => {
if (otherProps?.signConfig && !imageRef?.current) { if (otherProps?.signConfig && !imageRef?.current) {
imageRef.current = true; imageRef.current = true;
...@@ -133,6 +121,12 @@ export default function PictureSignature({ ...@@ -133,6 +121,12 @@ export default function PictureSignature({
} }
}, [otherProps]); }, [otherProps]);
useEffect(() => {
setFileInfo({
...others?.fileInfo,
})
}, [others?.fileInfo]);
useEffect(() => { useEffect(() => {
if (json.otherProps) { if (json.otherProps) {
try { try {
...@@ -287,7 +281,7 @@ export default function PictureSignature({ ...@@ -287,7 +281,7 @@ export default function PictureSignature({
if (!fileInfo) { if (!fileInfo) {
return null; return null;
} }
// console.log(imageInfo, fileInfo); console.log(imageInfo, fileInfo);
return ( return (
<div className={styles.outSideDiv}> <div className={styles.outSideDiv}>
{fileInfo && fileInfo?.path && ( {fileInfo && fileInfo?.path && (
...@@ -298,8 +292,7 @@ export default function PictureSignature({ ...@@ -298,8 +292,7 @@ export default function PictureSignature({
onClick={changeShowModal} onClick={changeShowModal}
/> />
)} )}
{showModal && {showModal && (
(
<Modal <Modal
visible={true} visible={true}
destroyOnClose={true} destroyOnClose={true}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论