下载逻辑
This commit is contained in:
@@ -635,7 +635,11 @@ import {
|
|||||||
|
|
||||||
const SUCCESS_CODE = "0000";
|
const SUCCESS_CODE = "0000";
|
||||||
const CALLBACK_HOST = "http://47.110.50.12:7005";
|
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) {
|
function isSuccessResponse(res) {
|
||||||
return String(res?.code || "") === SUCCESS_CODE;
|
return String(res?.code || "") === SUCCESS_CODE;
|
||||||
@@ -739,6 +743,10 @@ function getBusinessCacheKey(record) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getCurrentStorageKey() {
|
||||||
|
return getStorageKey(businessRecord.value);
|
||||||
|
}
|
||||||
|
|
||||||
function updateBusinessStatusByContractStatus(status) {
|
function updateBusinessStatusByContractStatus(status) {
|
||||||
if (!businessRecord.value || status === undefined || status === null) return;
|
if (!businessRecord.value || status === undefined || status === null) return;
|
||||||
businessRecord.value = {
|
businessRecord.value = {
|
||||||
@@ -772,7 +780,7 @@ function restoreContractState(saved) {
|
|||||||
function saveContractState() {
|
function saveContractState() {
|
||||||
try {
|
try {
|
||||||
localStorage.setItem(
|
localStorage.setItem(
|
||||||
STORAGE_KEY,
|
getCurrentStorageKey(),
|
||||||
JSON.stringify({
|
JSON.stringify({
|
||||||
contractId: contractId.value,
|
contractId: contractId.value,
|
||||||
contractName: contractName.value,
|
contractName: contractName.value,
|
||||||
@@ -788,7 +796,7 @@ function saveContractState() {
|
|||||||
|
|
||||||
function clearContractState() {
|
function clearContractState() {
|
||||||
try {
|
try {
|
||||||
localStorage.removeItem(STORAGE_KEY);
|
localStorage.removeItem(getCurrentStorageKey());
|
||||||
} catch {}
|
} catch {}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -933,7 +941,8 @@ async function showModal(contractIdParam, businessRecordParam) {
|
|||||||
|
|
||||||
if (contextRecord) {
|
if (contextRecord) {
|
||||||
try {
|
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 savedBusinessKey = saved.businessKey || "";
|
||||||
const currentBusinessKey = getBusinessCacheKey(contextRecord);
|
const currentBusinessKey = getBusinessCacheKey(contextRecord);
|
||||||
if (
|
if (
|
||||||
@@ -1035,7 +1044,7 @@ async function loadContract(cid) {
|
|||||||
}
|
}
|
||||||
} catch {
|
} catch {
|
||||||
try {
|
try {
|
||||||
const saved = JSON.parse(localStorage.getItem(STORAGE_KEY) || "{}");
|
const saved = JSON.parse(localStorage.getItem(getCurrentStorageKey()) || "{}");
|
||||||
if (saved.contractId === cid) {
|
if (saved.contractId === cid) {
|
||||||
restoreContractState(saved);
|
restoreContractState(saved);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user