储存签名后的pdf
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -23,6 +23,7 @@ const UI9: React.FC = () => {
|
||||
localStorage.removeItem("package_code");
|
||||
localStorage.removeItem("consentSignatureList");
|
||||
localStorage.removeItem("consentSignature");
|
||||
localStorage.removeItem("tongyishuSignedPdfUrls");
|
||||
navigate("/");
|
||||
}, [navigate]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user