bugfix: 参数传递改为用sessionStorage
This commit is contained in:
@@ -594,13 +594,18 @@
|
|||||||
if (!validatePublishRequired()) return
|
if (!validatePublishRequired()) return
|
||||||
|
|
||||||
await handleSaveForm(status)
|
await handleSaveForm(status)
|
||||||
|
|
||||||
|
// 从 sessionStorage 获取参数
|
||||||
|
const paramsStr = sessionStorage.getItem('listingEditParams')
|
||||||
|
const params = paramsStr ? JSON.parse(paramsStr) : {}
|
||||||
|
|
||||||
if (status === "draft") {
|
if (status === "draft") {
|
||||||
ROUTER.push({
|
ROUTER.push({
|
||||||
name: "Status",
|
name: "Status",
|
||||||
params: { status: "draft" },
|
params: { status: "draft" },
|
||||||
state: {
|
state: {
|
||||||
type: history.state?.type,
|
type: params.type,
|
||||||
collectionId: history.state?.collectionId
|
collectionId: params.collectionId
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
} else if (status === "publish") {
|
} else if (status === "publish") {
|
||||||
@@ -608,8 +613,8 @@
|
|||||||
name: "Status",
|
name: "Status",
|
||||||
params: { status: "publish" },
|
params: { status: "publish" },
|
||||||
state: {
|
state: {
|
||||||
type: history.state?.type,
|
type: params.type,
|
||||||
collectionId: history.state?.collectionId
|
collectionId: params.collectionId
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -642,12 +647,15 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
const data = history.state
|
// 从 sessionStorage 获取参数
|
||||||
|
const paramsStr = sessionStorage.getItem('listingEditParams')
|
||||||
|
const data = paramsStr ? JSON.parse(paramsStr) : {}
|
||||||
|
|
||||||
if (data?.type === "edit") {
|
if (data?.type === "edit") {
|
||||||
itemId.value = history.state?.id
|
itemId.value = data?.id
|
||||||
handleGetDetailById()
|
handleGetDetailById()
|
||||||
} else {
|
} else {
|
||||||
const designItemIds = history.state?.designItemIds || []
|
const designItemIds = data?.designItemIds || []
|
||||||
|
|
||||||
if (!designItemIds.length) return
|
if (!designItemIds.length) return
|
||||||
|
|
||||||
@@ -659,6 +667,7 @@
|
|||||||
// console.log("list", list.length, list)
|
// console.log("list", list.length, list)
|
||||||
handleFetchItemDetial(list)
|
handleFetchItemDetial(list)
|
||||||
}
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -57,13 +57,16 @@ const chooseItem = (item:any)=>{
|
|||||||
const next = ()=>{
|
const next = ()=>{
|
||||||
if(chooseList.value.length == 0)return
|
if(chooseList.value.length == 0)return
|
||||||
let designItemIds = chooseList.value.map((item:any)=>({designOutfitUrl:item.designOutfitUrl,designItemId:item.designItemId}))
|
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({
|
router.push({
|
||||||
path:'/home/seller/myListings/edit',
|
path:'/home/seller/myListings/edit'
|
||||||
state: {
|
|
||||||
designItemIds,
|
|
||||||
type:'create',
|
|
||||||
collectionId: route.params.collectionId
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user