From d02061c40771e50aa44731404ae0f5e7cbbd99eb Mon Sep 17 00:00:00 2001 From: zhangyahui Date: Mon, 1 Jun 2026 13:34:45 +0800 Subject: [PATCH] =?UTF-8?q?bugfix:=20=E5=8F=82=E6=95=B0=E4=BC=A0=E9=80=92?= =?UTF-8?q?=E6=94=B9=E4=B8=BA=E7=94=A8sessionStorage?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MyListings/EditDetail/index.vue | 23 +++++++++++++------ .../MyListings/createSelectItem/index.vue | 15 +++++++----- 2 files changed, 25 insertions(+), 13 deletions(-) diff --git a/src/views/SellerDashboard/MyListings/EditDetail/index.vue b/src/views/SellerDashboard/MyListings/EditDetail/index.vue index 82aa514d..a97c9550 100644 --- a/src/views/SellerDashboard/MyListings/EditDetail/index.vue +++ b/src/views/SellerDashboard/MyListings/EditDetail/index.vue @@ -594,13 +594,18 @@ if (!validatePublishRequired()) return await handleSaveForm(status) + + // 从 sessionStorage 获取参数 + const paramsStr = sessionStorage.getItem('listingEditParams') + const params = paramsStr ? JSON.parse(paramsStr) : {} + if (status === "draft") { ROUTER.push({ name: "Status", params: { status: "draft" }, state: { - type: history.state?.type, - collectionId: history.state?.collectionId + type: params.type, + collectionId: params.collectionId } }) } else if (status === "publish") { @@ -608,8 +613,8 @@ name: "Status", params: { status: "publish" }, state: { - type: history.state?.type, - collectionId: history.state?.collectionId + type: params.type, + collectionId: params.collectionId } }) } @@ -642,12 +647,15 @@ } onMounted(() => { - const data = history.state + // 从 sessionStorage 获取参数 + const paramsStr = sessionStorage.getItem('listingEditParams') + const data = paramsStr ? JSON.parse(paramsStr) : {} + if (data?.type === "edit") { - itemId.value = history.state?.id + itemId.value = data?.id handleGetDetailById() } else { - const designItemIds = history.state?.designItemIds || [] + const designItemIds = data?.designItemIds || [] if (!designItemIds.length) return @@ -659,6 +667,7 @@ // console.log("list", list.length, list) handleFetchItemDetial(list) } + }) diff --git a/src/views/SellerDashboard/MyListings/createSelectItem/index.vue b/src/views/SellerDashboard/MyListings/createSelectItem/index.vue index c224b527..bed7dcc7 100644 --- a/src/views/SellerDashboard/MyListings/createSelectItem/index.vue +++ b/src/views/SellerDashboard/MyListings/createSelectItem/index.vue @@ -57,13 +57,16 @@ const chooseItem = (item:any)=>{ const next = ()=>{ if(chooseList.value.length == 0)return let designItemIds = chooseList.value.map((item:any)=>({designOutfitUrl:item.designOutfitUrl,designItemId:item.designItemId})) + + // 使用 sessionStorage 传递参数 + sessionStorage.setItem('listingEditParams', JSON.stringify({ + designItemIds, + type:'create', + collectionId: route.params.collectionId + })) + router.push({ - path:'/home/seller/myListings/edit', - state: { - designItemIds, - type:'create', - collectionId: route.params.collectionId - } + path:'/home/seller/myListings/edit' }) }