bugfix: 参数传递改为用sessionStorage

This commit is contained in:
2026-06-01 13:34:45 +08:00
parent 5a85ff0189
commit d02061c407
2 changed files with 25 additions and 13 deletions

View File

@@ -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)
}
})
</script>

View File

@@ -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'
})
}