储存签名后的pdf

This commit is contained in:
xianyi
2025-12-22 15:42:46 +08:00
parent 6c1bed796c
commit 4a46a289b8
2 changed files with 33 additions and 0 deletions

View File

@@ -228,6 +228,7 @@ const UI7: React.FC = () => {
useEffect(() => {
localStorage.removeItem("consentSignatureList");
localStorage.removeItem("tongyishuSignedPdfUrls");
}, []);
useEffect(() => {
@@ -508,6 +509,37 @@ const UI7: React.FC = () => {
if (tongyishuRes.Status !== 200) {
throw new Error(tongyishuRes.Message || "提交知情同意书签名失败");
}
// 保存签名后的知情同意书 PDF URL可能返回多个
try {
const returnedList = Array.isArray(
tongyishuRes.Data?.list_pdf_url
)
? tongyishuRes.Data.list_pdf_url
: [];
const urls = returnedList
.map((item) =>
typeof item === "string" ? item : item?.pdf_url || ""
)
.filter((url): url is string => Boolean(url));
const storedRaw = localStorage.getItem("tongyishuSignedPdfUrls");
const storedList: string[] = storedRaw ? JSON.parse(storedRaw) : [];
const merged = [...storedList];
urls.forEach((url) => {
if (!merged.includes(url)) {
merged.push(url);
}
});
localStorage.setItem(
"tongyishuSignedPdfUrls",
JSON.stringify(merged)
);
} catch (cacheErr) {
window.electronAPI?.log(
"warn",
`[UI7] 知情同意书 PDF URL 缓存失败: ${(cacheErr as Error).message}`
);
}
}
if (currentStep >= pdfInfoList.length) {

View File

@@ -23,6 +23,7 @@ const UI9: React.FC = () => {
localStorage.removeItem("package_code");
localStorage.removeItem("consentSignatureList");
localStorage.removeItem("consentSignature");
localStorage.removeItem("tongyishuSignedPdfUrls");
navigate("/");
}, [navigate]);