|
@@ -1,7 +1,7 @@
|
|
|
import { Button, Card, Checkbox, Form, Input, Modal, Radio, Select, Space, Spin, Tooltip, TreeSelect, Typography, message } from "antd"
|
|
|
import React, { useEffect, useState } from "react"
|
|
|
import style from '../index.less'
|
|
|
-import { DEVICE_PRICE_ENUM, EDUCATION_ENUM, EXCLUDED_DIMENSION_ENUM, GENDER_ENUM, LOCATION_TYPES_ENUM, MARITAL_STATUS_ENUM, NETWORK_ENUM, OPTIMIZATIONGOAL_ENUM, USER_OS_ENUM, WECHAT_AD_NEHAVIOR_ENUM } from "../../const"
|
|
|
+import { DEVICE_PRICE_ENUM, EDUCATION_ENUM, EXCLUDED_DIMENSION_ENUM, GAME_CONSUMPTION_LEVEL_ENUM, GENDER_ENUM, LOCATION_TYPES_ENUM, MARITAL_STATUS_ENUM, NETWORK_ENUM, OPTIMIZATIONGOAL_ENUM, USER_OS_ENUM, WECHAT_AD_NEHAVIOR_ENUM, WECHAT_AD_NEHAVIOR_GAME_ENUM } from "../../const"
|
|
|
import { QuestionCircleFilled } from "@ant-design/icons"
|
|
|
import { getTargetingGagsApi } from "@/services/adqV3/global"
|
|
|
import { useAjax } from "@/Hook/useAjax"
|
|
@@ -16,13 +16,14 @@ const { Title, Paragraph } = Typography;
|
|
|
|
|
|
interface Props {
|
|
|
isBackVal?: boolean
|
|
|
+ putInType?: 'NOVEL' | 'GAME'
|
|
|
value?: any,
|
|
|
visible?: boolean
|
|
|
onClose?: () => void
|
|
|
onChange?: (targeting?: any) => void
|
|
|
}
|
|
|
|
|
|
-const AddTarget: React.FC<Props> = ({ isBackVal, value, visible, onChange, onClose }) => {
|
|
|
+const AddTarget: React.FC<Props> = ({ isBackVal, putInType, value, visible, onChange, onClose }) => {
|
|
|
|
|
|
/******************************/
|
|
|
const [form] = Form.useForm();
|
|
@@ -37,10 +38,12 @@ const AddTarget: React.FC<Props> = ({ isBackVal, value, visible, onChange, onClo
|
|
|
const education = Form.useWatch('education', form);
|
|
|
const networkType = Form.useWatch('networkType', form);
|
|
|
const devicePrice = Form.useWatch('devicePrice', form);
|
|
|
+ const gameConsumptionLevel = Form.useWatch('gameConsumptionLevel', form);
|
|
|
const excludedDimension = Form.useWatch(['excludedConvertedAudience', 'excludedDimension'], form);
|
|
|
const conversionBehaviorList = Form.useWatch(['excludedConvertedAudience', 'conversionBehaviorList'], form);
|
|
|
const actions = Form.useWatch(['wechatAdBehavior', 'actions'], form);
|
|
|
const excludedActions = Form.useWatch(['wechatAdBehavior', 'excludedActions'], form);
|
|
|
+ const taskType: 'NOVEL' | 'GAME' = Form.useWatch('taskType', form) || putInType
|
|
|
|
|
|
const [regionsList, setRegionsList] = useState<any[]>([])
|
|
|
const [modelList, setModelList] = useState([])
|
|
@@ -158,8 +161,13 @@ const AddTarget: React.FC<Props> = ({ isBackVal, value, visible, onChange, onClo
|
|
|
}
|
|
|
}
|
|
|
})
|
|
|
- setOsList([{ label: 'iOS系统', value: 'IOS', children: iosChildren }, { label: 'Android系统', value: 'ANDROID', children: androidChildren }, { label: 'Harmony', value: 'HARMONY', children: harmonyChildren }])
|
|
|
- }, [USER_OS_ENUM])
|
|
|
+ let newOsList = [{ label: 'iOS系统', value: 'IOS', children: iosChildren }, { label: 'Android系统', value: 'ANDROID', children: androidChildren }, { label: 'Harmony', value: 'HARMONY', children: harmonyChildren }]
|
|
|
+ if (taskType === 'GAME') {
|
|
|
+ newOsList.push({ label: 'Windows系统', value: 'WINDOWS', children: [] })
|
|
|
+ newOsList.push({ label: 'Mac系统', value: 'MAC', children: [] })
|
|
|
+ }
|
|
|
+ setOsList(newOsList)
|
|
|
+ }, [USER_OS_ENUM, taskType])
|
|
|
|
|
|
const handleOk = async (values: any) => {
|
|
|
console.log(values)
|
|
@@ -183,7 +191,9 @@ const AddTarget: React.FC<Props> = ({ isBackVal, value, visible, onChange, onClo
|
|
|
os,
|
|
|
isExcludedOs,
|
|
|
devicePrice,
|
|
|
+ gameConsumptionLevel,
|
|
|
wechatAdBehaviorType,
|
|
|
+ taskType,
|
|
|
...surplusValues
|
|
|
} = values
|
|
|
|
|
@@ -243,7 +253,12 @@ const AddTarget: React.FC<Props> = ({ isBackVal, value, visible, onChange, onClo
|
|
|
if (!devicePrice?.includes('0')) {
|
|
|
targetValues.devicePrice = devicePrice
|
|
|
}
|
|
|
+ // 游戏消费能力
|
|
|
+ if (!gameConsumptionLevel?.includes('0')) {
|
|
|
+ targetValues.gameConsumptionLevel = gameConsumptionLevel
|
|
|
+ }
|
|
|
let targetingDTO = {
|
|
|
+ taskType: taskType || putInType,
|
|
|
targetingName,
|
|
|
description,
|
|
|
accountId,
|
|
@@ -258,7 +273,7 @@ const AddTarget: React.FC<Props> = ({ isBackVal, value, visible, onChange, onClo
|
|
|
|
|
|
let checkData = await checkTargeting.run(value?.id ? { ...targetingDTO, id: value?.id } : targetingDTO)
|
|
|
if (checkData?.[0]?.isSame) {
|
|
|
- message.error('存在相同模板名称,请修改')
|
|
|
+ message.error('存在相同模板名称或内容,请修改')
|
|
|
return
|
|
|
}
|
|
|
if (value?.id) {
|
|
@@ -296,6 +311,7 @@ const AddTarget: React.FC<Props> = ({ isBackVal, value, visible, onChange, onClo
|
|
|
excludedOs,
|
|
|
userOs,
|
|
|
devicePrice,
|
|
|
+ gameConsumptionLevel,
|
|
|
wechatAdBehavior,
|
|
|
...surplusValues
|
|
|
} = JSON.parse(JSON.stringify(value))
|
|
@@ -307,6 +323,7 @@ const AddTarget: React.FC<Props> = ({ isBackVal, value, visible, onChange, onClo
|
|
|
networkType: networkType || '0',
|
|
|
excludedConvertedAudience: excludedConvertedAudience || { excludedDimension: '0' },
|
|
|
devicePrice: devicePrice || '0',
|
|
|
+ gameConsumptionLevel: gameConsumptionLevel || '0',
|
|
|
wechatAdBehavior,
|
|
|
maritalStatus
|
|
|
}
|
|
@@ -400,6 +417,7 @@ const AddTarget: React.FC<Props> = ({ isBackVal, value, visible, onChange, onClo
|
|
|
}}
|
|
|
onFinish={handleOk}
|
|
|
initialValues={{
|
|
|
+ taskType: 'NOVEL',
|
|
|
geoLocationType: '0',
|
|
|
maritalStatusType: '0',
|
|
|
deviceBrandModelType: '0',
|
|
@@ -414,6 +432,7 @@ const AddTarget: React.FC<Props> = ({ isBackVal, value, visible, onChange, onClo
|
|
|
education: ['0'],
|
|
|
networkType: ['0'],
|
|
|
devicePrice: ['0'],
|
|
|
+ gameConsumptionLevel: ['0'],
|
|
|
excludedConvertedAudience: {
|
|
|
excludedDimension: '0'
|
|
|
},
|
|
@@ -423,6 +442,29 @@ const AddTarget: React.FC<Props> = ({ isBackVal, value, visible, onChange, onClo
|
|
|
targetingName: (isBackVal ? '定向' : '定向模板') + '_' + localStorage.getItem('userId') + '_' + moment().format('MM_DD_HH:mm:ss')
|
|
|
}}
|
|
|
>
|
|
|
+ {!putInType && <Card
|
|
|
+ title={<strong style={{ fontSize: 18 }}>定向类型</strong>}
|
|
|
+ className="cardResetCss newCss"
|
|
|
+ bodyStyle={{ padding: '4px 6px' }}
|
|
|
+ style={{ marginBottom: 8 }}
|
|
|
+ >
|
|
|
+ <div className={style.newSpace}>
|
|
|
+ <Form.Item name="taskType" label={<strong>投放类型</strong>} style={{ marginBottom: 0 }} rules={[{ required: true, message: '请选择定向类型' }]}>
|
|
|
+ <Radio.Group onChange={(e) => {
|
|
|
+ form.setFieldsValue({
|
|
|
+ excludedConvertedAudience: {
|
|
|
+ excludedDimension: '0'
|
|
|
+ },
|
|
|
+ userOsType: '0',
|
|
|
+ wechatAdBehaviorType: ['0']
|
|
|
+ })
|
|
|
+ }}>
|
|
|
+ <Radio value="NOVEL">小说</Radio>
|
|
|
+ <Radio value="GAME">游戏</Radio>
|
|
|
+ </Radio.Group>
|
|
|
+ </Form.Item>
|
|
|
+ </div>
|
|
|
+ </Card>}
|
|
|
<Card
|
|
|
title={<strong style={{ fontSize: 18 }}>定向选择</strong>}
|
|
|
className="cardResetCss newCss"
|
|
@@ -622,7 +664,7 @@ const AddTarget: React.FC<Props> = ({ isBackVal, value, visible, onChange, onClo
|
|
|
>
|
|
|
<Radio.Group>
|
|
|
<Radio value="0">不限</Radio>
|
|
|
- {Object.keys(EXCLUDED_DIMENSION_ENUM).map(key => {
|
|
|
+ {Object.keys(EXCLUDED_DIMENSION_ENUM).filter(key => taskType === 'GAME' ? ['EXCLUDED_DIMENSION_UID', 'EXCLUDED_DIMENSION_BUSINESS_MANAGER', 'EXCLUDED_DIMENSION_COMPANY_ACCOUNT', 'EXCLUDED_DIMENSION_APP'].includes(key) : true).map(key => {
|
|
|
return <Radio value={key} key={key}>{EXCLUDED_DIMENSION_ENUM[key as keyof typeof EXCLUDED_DIMENSION_ENUM]}</Radio>
|
|
|
})}
|
|
|
</Radio.Group>
|
|
@@ -686,6 +728,28 @@ const AddTarget: React.FC<Props> = ({ isBackVal, value, visible, onChange, onClo
|
|
|
</div>}
|
|
|
</div>
|
|
|
|
|
|
+ {taskType === 'GAME' && <div className={style.newSpace}>
|
|
|
+ <Form.Item
|
|
|
+ name="gameConsumptionLevel"
|
|
|
+ label={<strong>游戏消费能力</strong>}
|
|
|
+ style={{ marginBottom: 0 }}
|
|
|
+ getValueFromEvent={(e: string[]) => {
|
|
|
+ if (e.length > 1 && !gameConsumptionLevel.includes('0') && e.includes('0')) {
|
|
|
+ return ['0'];
|
|
|
+ }
|
|
|
+ return e.length > 0 ? (e.length > 1 && e.includes('0') ? e.filter(item => item !== '0') : e) : ['0'];
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ <Checkbox.Group
|
|
|
+ options={[
|
|
|
+ { label: '不限', value: '0' },
|
|
|
+ ...Object.keys(GAME_CONSUMPTION_LEVEL_ENUM)?.map(key => ({ label: GAME_CONSUMPTION_LEVEL_ENUM[key as keyof typeof GAME_CONSUMPTION_LEVEL_ENUM], value: key }))
|
|
|
+ ]}
|
|
|
+ />
|
|
|
+ </Form.Item>
|
|
|
+ </div>}
|
|
|
+
|
|
|
+
|
|
|
<div className={style.newSpace}>
|
|
|
<Form.Item name="userOsType" label={<strong>操作系统版本</strong>} style={{ marginBottom: 0 }}>
|
|
|
<Radio.Group>
|
|
@@ -771,13 +835,21 @@ const AddTarget: React.FC<Props> = ({ isBackVal, value, visible, onChange, onClo
|
|
|
{wechatAdBehaviorType.includes('actions') && <>
|
|
|
<Title level={5} style={{ fontSize: 14 }}>再营销</Title>
|
|
|
<Form.Item style={{ marginBottom: 10 }} name={['wechatAdBehavior', 'actions']}>
|
|
|
- <Checkbox.Group options={Object.keys(WECHAT_AD_NEHAVIOR_ENUM).filter(item => !['WE_COM_CORP_ID_ADDED', 'WECHAT_WORK_CONTACTS_ADDED'].includes(item)).map(key => ({ label: WECHAT_AD_NEHAVIOR_ENUM[key as keyof typeof WECHAT_AD_NEHAVIOR_ENUM], value: key, disabled: excludedActions?.some((k: string) => k === key) }))} />
|
|
|
+ {taskType === 'GAME' ?
|
|
|
+ <Checkbox.Group options={Object.keys(WECHAT_AD_NEHAVIOR_GAME_ENUM).filter(item => !['WE_COM_CORP_ID_ADDED', 'WECHAT_WORK_CONTACTS_ADDED'].includes(item)).map(key => ({ label: WECHAT_AD_NEHAVIOR_GAME_ENUM[key as keyof typeof WECHAT_AD_NEHAVIOR_GAME_ENUM], value: key, disabled: excludedActions?.some((k: string) => k === key) }))} />
|
|
|
+ :
|
|
|
+ <Checkbox.Group options={Object.keys(WECHAT_AD_NEHAVIOR_ENUM).filter(item => !['WE_COM_CORP_ID_ADDED', 'WECHAT_WORK_CONTACTS_ADDED'].includes(item)).map(key => ({ label: WECHAT_AD_NEHAVIOR_ENUM[key as keyof typeof WECHAT_AD_NEHAVIOR_ENUM], value: key, disabled: excludedActions?.some((k: string) => k === key) }))} />
|
|
|
+ }
|
|
|
</Form.Item>
|
|
|
</>}
|
|
|
{wechatAdBehaviorType.includes('excludedActions') && <>
|
|
|
<Title level={5} style={{ fontSize: 14 }}>排除营销</Title>
|
|
|
<Form.Item name={['wechatAdBehavior', 'excludedActions']}>
|
|
|
- <Checkbox.Group options={Object.keys(WECHAT_AD_NEHAVIOR_ENUM).map(key => ({ label: WECHAT_AD_NEHAVIOR_ENUM[key as keyof typeof WECHAT_AD_NEHAVIOR_ENUM], value: key, disabled: actions?.some((k: string) => k === key) }))} />
|
|
|
+ {taskType === 'GAME' ?
|
|
|
+ <Checkbox.Group options={Object.keys(WECHAT_AD_NEHAVIOR_GAME_ENUM).map(key => ({ label: WECHAT_AD_NEHAVIOR_GAME_ENUM[key as keyof typeof WECHAT_AD_NEHAVIOR_GAME_ENUM], value: key, disabled: actions?.some((k: string) => k === key) }))} />
|
|
|
+ :
|
|
|
+ <Checkbox.Group options={Object.keys(WECHAT_AD_NEHAVIOR_ENUM).map(key => ({ label: WECHAT_AD_NEHAVIOR_ENUM[key as keyof typeof WECHAT_AD_NEHAVIOR_ENUM], value: key, disabled: actions?.some((k: string) => k === key) }))} />
|
|
|
+ }
|
|
|
</Form.Item>
|
|
|
</>}
|
|
|
{excludedActions?.includes('WE_COM_CORP_ID_ADDED') && <>
|