|
|
@@ -14,7 +14,7 @@ import Dynamic from "./Dynamic"
|
|
|
import Material from "./Material"
|
|
|
import MaterialText from "./MaterialText"
|
|
|
import PageList from "./PageList"
|
|
|
-import { cartesianProduct, distributeArray, processData, randomString, splitArrayIntoRandomChunks } from "@/utils/utils"
|
|
|
+import { cartesianProduct, distributeArray, processData, randomString, splitArrayIntoRandomChunks, groupArr } from "@/utils/utils"
|
|
|
import columns from "./tableConfig"
|
|
|
import SubmitModal from "./submitModal"
|
|
|
import { createAdgroupTaskApi, createAdgroupTaskV2Api, getSelectTaskDetailApi } from "@/services/adqV3"
|
|
|
@@ -523,6 +523,7 @@ const Create: React.FC = () => {
|
|
|
return
|
|
|
}
|
|
|
}
|
|
|
+ const mainJumpInfoLength = dynamic?.creativeComponents?.mainJumpInfo?.length || 1
|
|
|
// 落地页平均分配判断数量
|
|
|
if ([910].includes(dynamic.creativeTemplateId) && dynamic?.landingPageType === 1) {
|
|
|
const targetingLength = targeting.length
|
|
|
@@ -530,9 +531,16 @@ const Create: React.FC = () => {
|
|
|
const productListLength = item?.productList?.length || 1
|
|
|
const total = targetingLength * productListLength
|
|
|
const pageLength = item.pageList.length
|
|
|
- if (total > pageLength) {
|
|
|
- message.error(`当前${item.accountId}下的广告总数(${total})大于落地页总数(${pageLength}),平均分配需要落地页总数大于广告总数`)
|
|
|
- return true
|
|
|
+ if (mainJumpInfoLength > 1) {
|
|
|
+ if (!(total * mainJumpInfoLength <= pageLength && pageLength % mainJumpInfoLength === 0)) {
|
|
|
+ message.error(`当前${item.accountId}下的广告总数是:${total},落地页组数是:${mainJumpInfoLength},平均分配需要落地页总数(${pageLength})要大于${total * mainJumpInfoLength}并且要是${mainJumpInfoLength}倍数`)
|
|
|
+ return true
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (total > pageLength) {
|
|
|
+ message.error(`当前${item.accountId}下的广告总数(${total})大于落地页总数(${pageLength}),平均分配需要落地页总数大于广告总数`)
|
|
|
+ return true
|
|
|
+ }
|
|
|
}
|
|
|
return false
|
|
|
})) {
|
|
|
@@ -577,7 +585,7 @@ const Create: React.FC = () => {
|
|
|
},
|
|
|
dynamicDto: dynamic, // 创意信息
|
|
|
averageAdDynamic,
|
|
|
- rowSpan: ((mediaType === 1 || mediaType === 3) && textType !== 4) ? averageAdDynamic.length : ([910].includes(dynamic.creativeTemplateId) ? item.pageList?.length : (textType === 3 ? textDtoLenth * dynamicGroupLength : dynamicGroupLength)) || 1
|
|
|
+ rowSpan: ((mediaType === 1 || mediaType === 3) && textType !== 4) ? averageAdDynamic.length : ([910].includes(dynamic.creativeTemplateId) ? item.pageList?.length / mainJumpInfoLength : (textType === 3 ? textDtoLenth * dynamicGroupLength : dynamicGroupLength)) || 1
|
|
|
}
|
|
|
if (marketingCarrierType === 'MARKETING_CARRIER_TYPE_WECHAT_OFFICIAL_ACCOUNT') { // 营销载体
|
|
|
dat.marketingCarrierDto = item?.wechatChannelList
|
|
|
@@ -591,14 +599,14 @@ const Create: React.FC = () => {
|
|
|
// 激励
|
|
|
if ([910].includes(dynamic.creativeTemplateId)) {
|
|
|
if (dynamic?.landingPageType === 1) {
|
|
|
- const averageAdPageList: any[] = distributeArray(item.pageList, productList.length * targeting.length)
|
|
|
+ const averageAdPageList: any[] = groupArr(item.pageList, productList.length * targeting.length, mainJumpInfoLength)
|
|
|
data.forEach((item, aIndex) => {
|
|
|
const aPageList: any[] = averageAdPageList[aIndex]
|
|
|
aPageList.forEach((page, index) => {
|
|
|
newData.push({
|
|
|
...item,
|
|
|
id: item.id + '_' + index,
|
|
|
- pageListDto: [page],
|
|
|
+ pageListDto: page,
|
|
|
dynamicDto: {
|
|
|
...item.dynamicDto,
|
|
|
dynamicCreativeName: item.dynamicDto.dynamicCreativeName + index
|
|
|
@@ -611,12 +619,12 @@ const Create: React.FC = () => {
|
|
|
|
|
|
})
|
|
|
} else {
|
|
|
- newData = cartesianProduct(data, item.pageList).map((item, index) => {
|
|
|
+ newData = cartesianProduct(data, distributeArray(item.pageList, item.pageList.length / mainJumpInfoLength)).map((item, index) => {
|
|
|
const [d1, pageList, num] = item
|
|
|
return {
|
|
|
...d1,
|
|
|
id: d1.id + '_' + index,
|
|
|
- pageListDto: [pageList],
|
|
|
+ pageListDto: pageList,
|
|
|
dynamicDto: {
|
|
|
...d1.dynamicDto,
|
|
|
dynamicCreativeName: d1.dynamicDto.dynamicCreativeName + num
|
|
|
@@ -712,7 +720,6 @@ const Create: React.FC = () => {
|
|
|
})
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
newdynamicCount = newdynamicCount + newData.length
|
|
|
newTableData[item.accountId] = newData
|
|
|
})
|
|
|
@@ -1039,7 +1046,7 @@ const Create: React.FC = () => {
|
|
|
adLength,
|
|
|
isDqSubmit,
|
|
|
setIsDqSubmit,
|
|
|
- targetRules,
|
|
|
+ targetRules,
|
|
|
setTargetRules
|
|
|
}}>
|
|
|
<div className={style.settingsBody_content_right}>
|