下载逻辑

This commit is contained in:
2026-06-03 16:46:31 +08:00
parent 87fcc6d732
commit 0803029797
+14 -5
View File
@@ -635,7 +635,11 @@ import {
const SUCCESS_CODE = "0000";
const CALLBACK_HOST = "http://47.110.50.12:7005";
const STORAGE_KEY = "mixed_presign_contract";
const STORAGE_KEY_PREFIX = "mixed_presign_contract";
function getStorageKey(record) {
const id = record?.id || record?.contractCode || "";
return id ? `${STORAGE_KEY_PREFIX}_${id}` : STORAGE_KEY_PREFIX;
}
function isSuccessResponse(res) {
return String(res?.code || "") === SUCCESS_CODE;
@@ -739,6 +743,10 @@ function getBusinessCacheKey(record) {
);
}
function getCurrentStorageKey() {
return getStorageKey(businessRecord.value);
}
function updateBusinessStatusByContractStatus(status) {
if (!businessRecord.value || status === undefined || status === null) return;
businessRecord.value = {
@@ -772,7 +780,7 @@ function restoreContractState(saved) {
function saveContractState() {
try {
localStorage.setItem(
STORAGE_KEY,
getCurrentStorageKey(),
JSON.stringify({
contractId: contractId.value,
contractName: contractName.value,
@@ -788,7 +796,7 @@ function saveContractState() {
function clearContractState() {
try {
localStorage.removeItem(STORAGE_KEY);
localStorage.removeItem(getCurrentStorageKey());
} catch {}
}
@@ -933,7 +941,8 @@ async function showModal(contractIdParam, businessRecordParam) {
if (contextRecord) {
try {
const saved = JSON.parse(localStorage.getItem(STORAGE_KEY) || "{}");
const key = getStorageKey(contextRecord);
const saved = JSON.parse(localStorage.getItem(key) || "{}");
const savedBusinessKey = saved.businessKey || "";
const currentBusinessKey = getBusinessCacheKey(contextRecord);
if (
@@ -1035,7 +1044,7 @@ async function loadContract(cid) {
}
} catch {
try {
const saved = JSON.parse(localStorage.getItem(STORAGE_KEY) || "{}");
const saved = JSON.parse(localStorage.getItem(getCurrentStorageKey()) || "{}");
if (saved.contractId === cid) {
restoreContractState(saved);
}