|
@@ -51,6 +51,7 @@ function CreativePup(props: Props) {
|
|
|
const [textData, setTextData] = useState<any[]>([])
|
|
|
const [isShowSc, set_isShowSc] = useState(false)//是否展示素材选项
|
|
|
const [infoSet, set_infoSet] = useState(false)//回填设置已完成
|
|
|
+ const [isShowXd, setIsShowXd] = useState(false)
|
|
|
const [videoImgs, set_videoImgs] = useState<{//视频封面图设置
|
|
|
activeUrl: string,//选中的视频封面图地址
|
|
|
preview: boolean,//是否开启图片点击预览
|
|
@@ -277,24 +278,18 @@ function CreativePup(props: Props) {
|
|
|
campaignType: 'CAMPAIGN_TYPE_NORMAL',
|
|
|
}).then(res => {
|
|
|
let newArr: any = []
|
|
|
+ let newData: any[] = []
|
|
|
// 过滤掉相同的和即将下线的
|
|
|
if (!res) {
|
|
|
return
|
|
|
}
|
|
|
//
|
|
|
Object.values(res)?.forEach((arr: any) => {
|
|
|
+ newData.push(arr)
|
|
|
Array.isArray(arr) && arr?.forEach((item: any) => {
|
|
|
if (newArr.length > 0) {//假如已存在ID,需要过滤相同
|
|
|
if (outAdcreativeTemplateIdFun(item.adcreativeTemplateId) && newArr.every((i: { adcreativeTemplateId: any }) => i.adcreativeTemplateId !== item.adcreativeTemplateId)) {//不重复的添加
|
|
|
newArr.push(item)
|
|
|
- } else {
|
|
|
- // 找出通用创意
|
|
|
- newArr = newArr?.map((arr: { adcreativeTemplateId: any }) => {
|
|
|
- if (arr.adcreativeTemplateId === item.adcreativeTemplateId) {
|
|
|
- return { ...arr, isGeneral: true }
|
|
|
- }
|
|
|
- return arr
|
|
|
- })
|
|
|
}
|
|
|
} else {//不存在ID直接过滤掉即将下线的
|
|
|
if (outAdcreativeTemplateIdFun(item.adcreativeTemplateId)) {
|
|
@@ -307,12 +302,25 @@ function CreativePup(props: Props) {
|
|
|
if (siteSet.some((i: string) => i === 'SITE_SET_MOMENTS')) {
|
|
|
newArr = newArr.filter((item: { adcreativeTemplateId: number }) => item.adcreativeTemplateId !== 910 && item.adcreativeTemplateId !== 925)
|
|
|
}
|
|
|
- set_adcreative_template_list(newArr)
|
|
|
+ /*****暂时排除出框形态 视频合约广告******/
|
|
|
+ if (siteSet.some((i: string) => i === 'SITE_SET_WECHAT')) {
|
|
|
+ newArr = newArr.filter((item: { adcreativeTemplateId: number }) => item.adcreativeTemplateId !== 1945)
|
|
|
+ }
|
|
|
+ let newArr1: any[] = []
|
|
|
+ let newArr2: any[] = []
|
|
|
+ newArr?.forEach((arr: { adcreativeTemplateId: any, isGeneral?: boolean }) => {
|
|
|
+ if (newData.every((item: { adcreativeTemplateId: any }[]) => item.find(i => i.adcreativeTemplateId === arr.adcreativeTemplateId))) {
|
|
|
+ newArr1.push({ ...arr, isGeneral: true })
|
|
|
+ } else {
|
|
|
+ newArr2.push(arr)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ set_adcreative_template_list([...newArr1, ...newArr2])
|
|
|
})
|
|
|
}
|
|
|
}, [siteSet, promotedObjectType])
|
|
|
// 获取创意形式详情
|
|
|
- const getTemplate = useCallback((id: any, ok?: any) => {
|
|
|
+ const getTemplate = (id: any, ok?: any) => {
|
|
|
// CAMPAIGN_TYPE_NORMAL
|
|
|
if (siteSet?.length > 0 && promotedObjectType && id) {
|
|
|
if (id) {
|
|
@@ -348,7 +356,7 @@ function CreativePup(props: Props) {
|
|
|
})
|
|
|
}
|
|
|
}
|
|
|
- }, [siteSet, promotedObjectType, pupState])
|
|
|
+ }
|
|
|
// 获取对应落地页按钮
|
|
|
const pageTypeList = useMemo(() => {
|
|
|
if (adcreativeTemplateId) {
|
|
@@ -385,7 +393,7 @@ function CreativePup(props: Props) {
|
|
|
}, [adcreative_template_list])
|
|
|
|
|
|
//每次选中创意设置该展示的界面
|
|
|
- const templateChange = useCallback((adcreative_template, ok?: any) => {
|
|
|
+ const templateChange = (adcreative_template: any, ok?: any) => {
|
|
|
let states = {
|
|
|
kp_show: false,
|
|
|
xd_show: true,
|
|
@@ -417,7 +425,8 @@ function CreativePup(props: Props) {
|
|
|
|
|
|
//行动按钮组件存在
|
|
|
if (states.xd_show) {
|
|
|
- let linkNameList = (pageList?.filter((item: { pageType: any; }) => item.pageType === pageType)[0] as any)?.supportLinkNameType?.list
|
|
|
+ let supportLinkNameTypeData = (pageList?.filter((item: { pageType: any; }) => item.pageType === pageType)[0] as any)?.supportLinkNameType
|
|
|
+ let linkNameList = supportLinkNameTypeData?.list
|
|
|
let linkPageList = (pageList?.filter((item: { pageType: any; }) => item.pageType === pageType)[0] as any)?.supportLinkPageType?.list
|
|
|
if (linkNameList && !linkPageType) {
|
|
|
if (!ok) {
|
|
@@ -428,6 +437,13 @@ function CreativePup(props: Props) {
|
|
|
} else {
|
|
|
states = { ...states, xd_show: false }
|
|
|
}
|
|
|
+ if (supportLinkNameTypeData?.required) {
|
|
|
+ states = { ...states, xd_show: true }
|
|
|
+ values = { ...values, actionBtn: true }
|
|
|
+ setIsShowXd(true)
|
|
|
+ } else {
|
|
|
+ setIsShowXd(false)
|
|
|
+ }
|
|
|
}
|
|
|
// 特殊行动按钮
|
|
|
if (adcreative_template.adcreativeElements?.find((item: { name: string }) => item.name === 'button_text') && !ok) {
|
|
@@ -444,7 +460,7 @@ function CreativePup(props: Props) {
|
|
|
setPupState(states)
|
|
|
form.setFieldsValue(values)
|
|
|
}
|
|
|
- }, [pageType, linkPageType])
|
|
|
+ }
|
|
|
// 版位改变清空数据
|
|
|
useEffect(() => {
|
|
|
if (imgMaterialConfig.adcreativeTemplateId && adcreativeTemplateId !== imgMaterialConfig.adcreativeTemplateId) {
|
|
@@ -670,8 +686,8 @@ function CreativePup(props: Props) {
|
|
|
}
|
|
|
{/* ============================================================普通行动按钮============================================================= */}
|
|
|
{
|
|
|
- pupState.xd_show && <Form.Item label={<strong>行动按钮</strong>} name='actionBtn' valuePropName="checked">
|
|
|
- <Switch checkedChildren="开启" unCheckedChildren="关闭" />
|
|
|
+ pupState.xd_show && <Form.Item hidden={isShowXd} label={<strong>行动按钮</strong>} name='actionBtn' valuePropName="checked">
|
|
|
+ <Switch checkedChildren="开启" unCheckedChildren="关闭" disabled={isShowXd}/>
|
|
|
</Form.Item>
|
|
|
}
|
|
|
{
|
|
@@ -713,14 +729,14 @@ function CreativePup(props: Props) {
|
|
|
}
|
|
|
{/* ============================================================特殊行动按钮============================================================= */}
|
|
|
{
|
|
|
- adcreative_template?.adcreativeElements?.find(item => item.name === 'button_text') && <Form.Item label={<strong>行动按钮</strong>} >
|
|
|
+ !pupState.xd_show && adcreative_template?.adcreativeElements?.find(item => item.name === 'button_text') && <Form.Item label={<strong>行动按钮</strong>} >
|
|
|
<Form.Item valuePropName="checked" noStyle >
|
|
|
<Switch checkedChildren="开启" unCheckedChildren="关闭" checked={true} disabled defaultChecked={true} />
|
|
|
</Form.Item>
|
|
|
</Form.Item>
|
|
|
}
|
|
|
{
|
|
|
- adcreative_template?.adcreativeElements?.find(item => item.name === 'button_text') && <Form.Item name='buttonText' label={<strong>按钮文案</strong>} rules={[{ required: true, message: '请选择按钮文案!' }]}>
|
|
|
+ !pupState.xd_show && adcreative_template?.adcreativeElements?.find(item => item.name === 'button_text') && <Form.Item name='buttonText' label={<strong>按钮文案</strong>} rules={[{ required: true, message: '请选择按钮文案!' }]}>
|
|
|
<Select style={{ width: 200 }} showSearch filterOption={(input, option) =>
|
|
|
(option!.children as unknown as string).toLowerCase().includes(input.toLowerCase())
|
|
|
} allowClear>
|