Kaynağa Gözat

Merge branch 'develop' of http://git.zanxiangnet.com/wjx/ad-manage

wjx 4 ay önce
ebeveyn
işleme
4ae38dfec5

+ 18 - 2
src/pages/launchSystemV3/tencentAdPutIn/create/Target/addTarget.tsx

@@ -39,6 +39,7 @@ const AddTarget: React.FC<Props> = ({ isBackVal, putInType, value, visible, onCh
     const networkType = Form.useWatch('networkType', form);
     const devicePrice = Form.useWatch('devicePrice', form);
     const gameConsumptionLevel = Form.useWatch('gameConsumptionLevel', form);
+    const conversionBehaviorType = Form.useWatch('conversionBehaviorType', form);
     const excludedDimension = Form.useWatch(['excludedConvertedAudience', 'excludedDimension'], form);
     const conversionBehaviorList = Form.useWatch(['excludedConvertedAudience', 'conversionBehaviorList'], form);
     const actions = Form.useWatch(['wechatAdBehavior', 'actions'], form);
@@ -184,6 +185,7 @@ const AddTarget: React.FC<Props> = ({ isBackVal, putInType, value, visible, onCh
             networkType,
             maritalStatusType,
             excludedConvertedAudience,
+            conversionBehaviorType,
             deviceBrandModelType,
             deviceBrandModelList,
             isExcludedDeviceBrandModel,
@@ -327,6 +329,13 @@ const AddTarget: React.FC<Props> = ({ isBackVal, putInType, value, visible, onCh
                 wechatAdBehavior,
                 maritalStatus
             }
+            if (excludedConvertedAudience) {
+                if (excludedConvertedAudience?.conversionBehaviorList?.length) {
+                    targetValues.conversionBehaviorType = 'customize'
+                } else {
+                    targetValues.conversionBehaviorType = 'optimization'
+                }
+            }
             if (geoLocation && Object.keys(geoLocation).length > 0) {
                 targetValues.geoLocationType = '1'
                 targetValues.geoLocation = {
@@ -436,6 +445,7 @@ const AddTarget: React.FC<Props> = ({ isBackVal, putInType, value, visible, onCh
                 excludedConvertedAudience: {
                     excludedDimension: '0'
                 },
+                conversionBehaviorType: 'optimization',
                 geoLocation: {
                     locationTypes: ['LIVE_IN']
                 },
@@ -671,7 +681,13 @@ const AddTarget: React.FC<Props> = ({ isBackVal, putInType, value, visible, onCh
                     </Form.Item>
                     {excludedDimension !== '0' && <div className={`${style.newSpace_bottom}`} style={{ marginBottom: 6 }}>
                         <Title level={5} style={{ fontSize: 14 }}>系统自动依照当前广告选择的优化目标作为此定向的转化行为</Title>
-                        <Form.Item label="自定义转化行为" name={['excludedConvertedAudience', 'conversionBehaviorList']} rules={[{ required: true, message: '请选择自定义转化行为' }]}>
+                        <Form.Item label="转化行为" name={'conversionBehaviorType'} rules={[{ required: true, message: '请选择自定义转化行为' }]} style={{ marginBottom: 10 }}>
+                            <Radio.Group>
+                                <Radio value="optimization">优化目标</Radio>
+                                <Radio value="customize">自定义</Radio>
+                            </Radio.Group>
+                        </Form.Item>
+                        {conversionBehaviorType === 'customize' && <Form.Item name={['excludedConvertedAudience', 'conversionBehaviorList']} rules={[{ required: true, message: '请选择自定义转化行为' }]} style={{ marginBottom: 10 }}>
                             <Select
                                 showSearch
                                 filterOption={(input, option) =>
@@ -686,7 +702,7 @@ const AddTarget: React.FC<Props> = ({ isBackVal, putInType, value, visible, onCh
                                     return <Select.Option value={key} key={key} disabled={conversionBehaviorList?.length >= 2 && !conversionBehaviorList.includes(key)}>{OPTIMIZATIONGOAL_ENUM[key as keyof typeof OPTIMIZATIONGOAL_ENUM]}</Select.Option>
                                 })}
                             </Select>
-                        </Form.Item>
+                        </Form.Item>}
                         <Form.Item label="转化时间区间" name={['excludedConvertedAudience', 'excludedDay']}>
                             <Radio.Group>
                                 {Object.keys(EXCLUDED_DAY_ENUM).map(key => <Radio value={key} key={key}>{EXCLUDED_DAY_ENUM[key as keyof typeof EXCLUDED_DAY_ENUM]}</Radio>)}