bugfix: 封面必填校验
This commit is contained in:
@@ -205,7 +205,9 @@
|
|||||||
const videoImageCategories = ["firstFrame", "gif", "video"] as const
|
const videoImageCategories = ["firstFrame", "gif", "video"] as const
|
||||||
type VideoImageCategory = (typeof videoImageCategories)[number]
|
type VideoImageCategory = (typeof videoImageCategories)[number]
|
||||||
|
|
||||||
const isVideoImageCategory = (category: ListingDetailImage["category"]): category is VideoImageCategory =>
|
const isVideoImageCategory = (
|
||||||
|
category: ListingDetailImage["category"]
|
||||||
|
): category is VideoImageCategory =>
|
||||||
videoImageCategories.includes(category as VideoImageCategory)
|
videoImageCategories.includes(category as VideoImageCategory)
|
||||||
|
|
||||||
const normalizeDetailGender = (value: ListingDetailResponse["designFor"]) => {
|
const normalizeDetailGender = (value: ListingDetailResponse["designFor"]) => {
|
||||||
@@ -365,7 +367,7 @@
|
|||||||
|
|
||||||
if (willSelect && listing.firstSelectedIndex === null) {
|
if (willSelect && listing.firstSelectedIndex === null) {
|
||||||
if (target.isVideo) {
|
if (target.isVideo) {
|
||||||
message.warning("The first selected item is the main product image. Videos cannot be used.")
|
message.warning(t("Seller.VideoWarning"))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
listing.mainProductImage = target.url
|
listing.mainProductImage = target.url
|
||||||
@@ -392,7 +394,11 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
const cropType = ref<CropType | "">("")
|
const cropType = ref<CropType | "">("")
|
||||||
const handleClickCrop = (data: string | null, type: CropType, paramThree: number | unknown[] = []) => {
|
const handleClickCrop = (
|
||||||
|
data: string | null,
|
||||||
|
type: CropType,
|
||||||
|
paramThree: number | unknown[] = []
|
||||||
|
) => {
|
||||||
// 处理来自TopImageSection的调用: (data, type, list)
|
// 处理来自TopImageSection的调用: (data, type, list)
|
||||||
// 处理来自ApparelSketchList的调用: (data, type, index)
|
// 处理来自ApparelSketchList的调用: (data, type, index)
|
||||||
const index = typeof paramThree === "number" ? paramThree : undefined
|
const index = typeof paramThree === "number" ? paramThree : undefined
|
||||||
@@ -441,10 +447,9 @@
|
|||||||
value !== null && value !== undefined && String(value).trim() !== ""
|
value !== null && value !== undefined && String(value).trim() !== ""
|
||||||
|
|
||||||
const getMissingRequiredField = (item: ListingItem) => {
|
const getMissingRequiredField = (item: ListingItem) => {
|
||||||
const cover = item.cover || item.mainProductImage || item.sketch
|
|
||||||
const requiredFields = [
|
const requiredFields = [
|
||||||
{ value: item.sketch, label: t("SellerListEdit.sketch") },
|
{ value: item.sketch, label: t("SellerListEdit.sketch") },
|
||||||
{ value: cover, label: t("SellerListEdit.cover") },
|
{ value: item.cover, label: t("SellerListEdit.cover") },
|
||||||
{ value: item.productName, label: t("SellerListEdit.productName") },
|
{ value: item.productName, label: t("SellerListEdit.productName") },
|
||||||
{ value: item.price, label: t("SellerListEdit.price") },
|
{ value: item.price, label: t("SellerListEdit.price") },
|
||||||
{ value: item.desc, label: t("SellerListEdit.productDescription") },
|
{ value: item.desc, label: t("SellerListEdit.productDescription") },
|
||||||
@@ -565,7 +570,12 @@
|
|||||||
videoSortOrder += 1
|
videoSortOrder += 1
|
||||||
const isSelected = Number(!!media.selected)
|
const isSelected = Number(!!media.selected)
|
||||||
|
|
||||||
pushImage("firstFrame", media.firstFrameUrl || media.url, isSelected, videoSortOrder)
|
pushImage(
|
||||||
|
"firstFrame",
|
||||||
|
media.firstFrameUrl || media.url,
|
||||||
|
isSelected,
|
||||||
|
videoSortOrder
|
||||||
|
)
|
||||||
pushImage("gif", media.gifUrl || "", isSelected, videoSortOrder)
|
pushImage("gif", media.gifUrl || "", isSelected, videoSortOrder)
|
||||||
pushImage("video", media.videoUrl || "", isSelected, videoSortOrder)
|
pushImage("video", media.videoUrl || "", isSelected, videoSortOrder)
|
||||||
})
|
})
|
||||||
@@ -589,16 +599,10 @@
|
|||||||
await fetchUpdateListing(paramsList)
|
await fetchUpdateListing(paramsList)
|
||||||
}
|
}
|
||||||
const handleClickMenu = async (status: StatusType) => {
|
const handleClickMenu = async (status: StatusType) => {
|
||||||
if (status === "draft" && !selectList.value[currentIndex.value].cover) {
|
|
||||||
message.error("请先完成封面制作")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if (!validatePublishRequired()) return
|
if (!validatePublishRequired()) return
|
||||||
|
|
||||||
await handleSaveForm(status)
|
await handleSaveForm(status)
|
||||||
if (status === "draft") {
|
if (status === "draft") {
|
||||||
// save draft logic
|
|
||||||
// console.log("Saving draft...", currentListing.value)
|
|
||||||
ROUTER.push({
|
ROUTER.push({
|
||||||
name: "Status",
|
name: "Status",
|
||||||
params: { status: "draft" },
|
params: { status: "draft" },
|
||||||
@@ -608,8 +612,6 @@
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
} else if (status === "publish") {
|
} else if (status === "publish") {
|
||||||
// publish logic
|
|
||||||
// console.log("Publishing...", currentListing.value)
|
|
||||||
ROUTER.push({
|
ROUTER.push({
|
||||||
name: "Status",
|
name: "Status",
|
||||||
params: { status: "publish" },
|
params: { status: "publish" },
|
||||||
|
|||||||
Reference in New Issue
Block a user