未签名按钮置灰
This commit is contained in:
@@ -33,3 +33,19 @@
|
|||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
line-height: 51px;
|
line-height: 51px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.confirm-button--disabled {
|
||||||
|
filter: grayscale(1);
|
||||||
|
opacity: 0.5;
|
||||||
|
cursor: not-allowed;
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.confirm-button--disabled:hover {
|
||||||
|
transform: none;
|
||||||
|
opacity: 0.5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.confirm-button--disabled:active {
|
||||||
|
transform: none;
|
||||||
|
}
|
||||||
@@ -4,11 +4,26 @@ import "./ConfirmButton.css";
|
|||||||
interface ConfirmButtonProps {
|
interface ConfirmButtonProps {
|
||||||
text: string;
|
text: string;
|
||||||
onClick?: () => void;
|
onClick?: () => void;
|
||||||
|
disabled?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
const ConfirmButton: React.FC<ConfirmButtonProps> = ({ text, onClick }) => {
|
const ConfirmButton: React.FC<ConfirmButtonProps> = ({
|
||||||
|
text,
|
||||||
|
onClick,
|
||||||
|
disabled = false,
|
||||||
|
}) => {
|
||||||
|
const handleClick = () => {
|
||||||
|
if (!disabled && onClick) {
|
||||||
|
onClick();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="confirm-button" onClick={onClick}>
|
<div
|
||||||
|
className={`confirm-button${disabled ? " confirm-button--disabled" : ""}`}
|
||||||
|
onClick={handleClick}
|
||||||
|
aria-disabled={disabled}
|
||||||
|
>
|
||||||
<span className="confirm-button-text">{text}</span>
|
<span className="confirm-button-text">{text}</span>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -101,6 +101,7 @@ const UI7: React.FC = () => {
|
|||||||
const [isDrawing, setIsDrawing] = useState(false);
|
const [isDrawing, setIsDrawing] = useState(false);
|
||||||
const [isSubmitting, setIsSubmitting] = useState(false);
|
const [isSubmitting, setIsSubmitting] = useState(false);
|
||||||
const [currentStep, setCurrentStep] = useState(0);
|
const [currentStep, setCurrentStep] = useState(0);
|
||||||
|
const [hasSignature, setHasSignature] = useState(false);
|
||||||
const [currentPdfPageCount, setCurrentPdfPageCount] = useState(0);
|
const [currentPdfPageCount, setCurrentPdfPageCount] = useState(0);
|
||||||
|
|
||||||
const totalRequiredSignatures = pdfInfoList.length + 1;
|
const totalRequiredSignatures = pdfInfoList.length + 1;
|
||||||
@@ -240,6 +241,10 @@ const UI7: React.FC = () => {
|
|||||||
setCurrentPdfPageCount(0);
|
setCurrentPdfPageCount(0);
|
||||||
}, [currentStep, currentPdfFile]);
|
}, [currentStep, currentPdfFile]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
setHasSignature(false);
|
||||||
|
}, [currentStep]);
|
||||||
|
|
||||||
const resetCountdown = useCallback(() => {
|
const resetCountdown = useCallback(() => {
|
||||||
setCountdown(5);
|
setCountdown(5);
|
||||||
setShowWaitButton(true);
|
setShowWaitButton(true);
|
||||||
@@ -327,6 +332,7 @@ const UI7: React.FC = () => {
|
|||||||
ctx.quadraticCurveTo(lastPoint.x, lastPoint.y, midX, midY);
|
ctx.quadraticCurveTo(lastPoint.x, lastPoint.y, midX, midY);
|
||||||
ctx.stroke();
|
ctx.stroke();
|
||||||
lastPointRef.current = { x, y };
|
lastPointRef.current = { x, y };
|
||||||
|
setHasSignature(true);
|
||||||
},
|
},
|
||||||
[getCoordinates, isDrawing]
|
[getCoordinates, isDrawing]
|
||||||
);
|
);
|
||||||
@@ -355,6 +361,7 @@ const UI7: React.FC = () => {
|
|||||||
ctx.lineWidth = 10;
|
ctx.lineWidth = 10;
|
||||||
ctx.lineCap = "round";
|
ctx.lineCap = "round";
|
||||||
ctx.lineJoin = "round";
|
ctx.lineJoin = "round";
|
||||||
|
setHasSignature(false);
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const isCanvasBlank = useCallback(() => {
|
const isCanvasBlank = useCallback(() => {
|
||||||
@@ -586,6 +593,7 @@ const UI7: React.FC = () => {
|
|||||||
<ConfirmButton
|
<ConfirmButton
|
||||||
text={isSubmitting ? "提交中..." : "确定"}
|
text={isSubmitting ? "提交中..." : "确定"}
|
||||||
onClick={handleConfirm}
|
onClick={handleConfirm}
|
||||||
|
disabled={!hasSignature || isSubmitting}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user