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