|
@@ -1,4 +1,4 @@
|
|
|
-import { Button, Card, Form, Modal, Radio, Space, Spin, message } from "antd"
|
|
|
+import { Button, Card, Form, Modal, Radio, Space, Spin, Switch, Typography, message } from "antd"
|
|
|
import React, { useContext, useEffect, useState } from "react"
|
|
|
import '../../index.less'
|
|
|
import { getCreativeDetailsApi, getCreativeTemplateListApi } from "@/services/adqV3/global";
|
|
@@ -12,7 +12,7 @@ import { processData, randomString } from "@/utils/utils";
|
|
|
import CreativeTemplateContent from "./creativeTemplateContent";
|
|
|
import CreativeConversionAssistant from "./creativeConversionAssistant";
|
|
|
import CreativeTemplateSetup from "./creativeTemplateSetup";
|
|
|
-
|
|
|
+const { Text } = Typography;
|
|
|
|
|
|
export const DispatchDynamic = React.createContext<PULLIN.DynamicReactContent | null>(null);
|
|
|
|
|
@@ -38,6 +38,7 @@ const NewDynamic: React.FC<Props> = ({ putInType, value: newValue, visible, onCl
|
|
|
const [form] = Form.useForm();
|
|
|
const creativeTemplateStyle = Form.useWatch('creativeTemplateStyle', form);
|
|
|
const deliveryMode = Form.useWatch('deliveryMode', form);
|
|
|
+ const dynamicCreativeSwitch = Form.useWatch('dynamicCreativeSwitch', form);
|
|
|
|
|
|
const [marketingGoalTypeList, setMarketingGoalTypeList] = useState<PULLIN.DataType[]>([])
|
|
|
const [adcreativeTemplateList, setAdcreativeTemplateList] = useState<PULLIN.AdcreativeTemplateList[]>([])
|
|
@@ -55,7 +56,7 @@ const NewDynamic: React.FC<Props> = ({ putInType, value: newValue, visible, onCl
|
|
|
/**********************************/
|
|
|
|
|
|
useEffect(() => {
|
|
|
- if (deliveryMode === 'DELIVERY_MODE_CUSTOMIZE') { // 自定义创意
|
|
|
+ if (deliveryMode === 'DELIVERY_MODE_CUSTOMIZE' || dynamicCreativeSwitch) { // 自定义创意
|
|
|
let params: any = {
|
|
|
marketingGoal,
|
|
|
marketingTargetType: marketingAssetOuterSpec.marketingTargetType,
|
|
@@ -141,7 +142,7 @@ const NewDynamic: React.FC<Props> = ({ putInType, value: newValue, visible, onCl
|
|
|
} else if (deliveryMode === 'DELIVERY_MODE_COMPONENT') { // 组件化创意
|
|
|
getTemplate()
|
|
|
}
|
|
|
- }, [deliveryMode, marketingGoal, marketingAssetOuterSpec, marketingCarrierType, siteSet, sceneSpec?.wechatPosition, value, automaticSiteEnabled, putInType])
|
|
|
+ }, [deliveryMode, dynamicCreativeSwitch, marketingGoal, marketingAssetOuterSpec, marketingCarrierType, siteSet, sceneSpec?.wechatPosition, value, automaticSiteEnabled, putInType])
|
|
|
|
|
|
useEffect(() => {
|
|
|
if (!(value && Object.keys(value).length > 0) && adcreativeTemplateList?.length > 0 && marketingGoalTypeList?.length > 0) {
|
|
@@ -171,7 +172,7 @@ const NewDynamic: React.FC<Props> = ({ putInType, value: newValue, visible, onCl
|
|
|
deliveryMode,
|
|
|
creativeTemplateId: id,
|
|
|
wechatSceneSpecPosition: sceneSpec?.wechatPosition,
|
|
|
- dynamicCreativeType: deliveryMode === 'DELIVERY_MODE_COMPONENT' ? 'DYNAMIC_CREATIVE_TYPE_PROGRAM' : 'DYNAMIC_CREATIVE_TYPE_COMMON'
|
|
|
+ dynamicCreativeType: (deliveryMode === 'DELIVERY_MODE_COMPONENT' && !dynamicCreativeSwitch) ? 'DYNAMIC_CREATIVE_TYPE_PROGRAM' : 'DYNAMIC_CREATIVE_TYPE_COMMON'
|
|
|
}
|
|
|
if (automaticSiteEnabled) {
|
|
|
params.automaticSiteEnabled = automaticSiteEnabled
|
|
@@ -653,6 +654,17 @@ const NewDynamic: React.FC<Props> = ({ putInType, value: newValue, visible, onCl
|
|
|
<Card
|
|
|
title={<strong style={{ fontSize: 18 }}>创意形式</strong>}
|
|
|
className="cardResetCss"
|
|
|
+ extra={deliveryMode === 'DELIVERY_MODE_COMPONENT' ? <Space>
|
|
|
+ <Form.Item name="dynamicCreativeSwitch" valuePropName="checked" className="formItemResetCss" style={{ marginBottom: 0 }}>
|
|
|
+ <Switch size="small" onChange={(checked) => {
|
|
|
+ if (checked) {
|
|
|
+ setTimeout(() => { setIsUpdate(true) }, 50)
|
|
|
+ setValue(undefined)
|
|
|
+ }
|
|
|
+ }} />
|
|
|
+ </Form.Item>
|
|
|
+ <div style={{ paddingTop: 2 }}><Text style={{ fontSize: 12 }}>指定创意形式</Text></div>
|
|
|
+ </Space> : null}
|
|
|
>
|
|
|
<Form.Item name="deliveryMode" label={<strong>投放模式</strong>} rules={[{ required: true, message: '请选择投放模式!' }]}>
|
|
|
<Radio.Group onChange={() => {
|
|
@@ -662,7 +674,7 @@ const NewDynamic: React.FC<Props> = ({ putInType, value: newValue, visible, onCl
|
|
|
{Object.keys(DELIVERY_MODE_ENUM).map(key => <Radio value={key} key={key}>{DELIVERY_MODE_ENUM[key as keyof typeof DELIVERY_MODE_ENUM]}</Radio>)}
|
|
|
</Radio.Group>
|
|
|
</Form.Item>
|
|
|
- {deliveryMode === 'DELIVERY_MODE_CUSTOMIZE' && <>
|
|
|
+ {(deliveryMode === 'DELIVERY_MODE_CUSTOMIZE' || dynamicCreativeSwitch) && <>
|
|
|
<Form.Item name="creativeTemplateStyle" label={<strong>创意形式类型</strong>} rules={[{ required: true, message: '请选择营销目的!' }]}>
|
|
|
<New1Radio data={marketingGoalTypeList} onChange={(e) => { typeChange(e === 'video' ? '视频' : '图片', true); }} />
|
|
|
</Form.Item>
|