|
@@ -24,6 +24,7 @@ import SubmitModal from "./submitModal"
|
|
|
import columns from "./tableConfig"
|
|
|
import TargetIng from './targeting'
|
|
|
import Creative from './creative'
|
|
|
+import AddGroup from '../../components/addGroup'
|
|
|
|
|
|
const CreateAd: React.FC = () => {
|
|
|
|
|
@@ -46,7 +47,7 @@ const CreateAd: React.FC = () => {
|
|
|
adqPageList: [],//云落地页
|
|
|
})
|
|
|
const [accountCreateLogs, setAccountCreateLogs] = useState<{ adAccountId: number, id: number, userActionSetsList?: number, productList?: any, conversionList?: any, customAudienceList?: any, excludedCustomAudienceList?: any, pageList?: any }[]>([]) // 账户
|
|
|
-
|
|
|
+ const { currentUser: { userId } }: any = useModel('@@initialState', model => ({ currentUser: model.initialState?.currentUser }))
|
|
|
|
|
|
const [goodsVisible, setGoodsVisible] = useState<boolean>(false) // 选择商品弹窗控制
|
|
|
const [sourceVisible, setSourceVisible] = useState<boolean>(false) // 选择数据源弹窗控制
|
|
@@ -62,6 +63,7 @@ const CreateAd: React.FC = () => {
|
|
|
const [modelList, setModelList] = useState<any>({}) // 所有品牌手机
|
|
|
const [targetKey, set_targetKey] = useState('0')//创意key
|
|
|
const [page_checked, set_page_checked] = useState(false)//创意key
|
|
|
+ const [usesArr, setUsersArr] = useState<any>(localStorage.getItem('ADQUSERS' + userId) ? JSON.parse(localStorage.getItem('ADQUSERS' + userId) as any) : [])
|
|
|
const { init, get } = useModel('useLaunchAdq.useBdMediaPup')
|
|
|
|
|
|
|
|
@@ -189,7 +191,7 @@ const CreateAd: React.FC = () => {
|
|
|
sysAdGroupData: queryForm.sysAdgroup,
|
|
|
targetingData: queryForm.sysTargeting,
|
|
|
sysAdcreativeData: task.sysAdcreative,
|
|
|
- pageData: (queryForm.pageList as any)[index] || (queryForm.adqPageList as any)[index]?.find((adq: { adAccountId: any })=>adq.adAccountId === item.adAccountId)?.pageList[0],
|
|
|
+ pageData: (queryForm.pageList as any)[index] || (queryForm.adqPageList as any)[index]?.find((adq: { adAccountId: any }) => adq.adAccountId === item.adAccountId)?.pageList[0],
|
|
|
myId: Number(item.id + '' + index)
|
|
|
}
|
|
|
data.push(obj)
|
|
@@ -199,13 +201,13 @@ const CreateAd: React.FC = () => {
|
|
|
setTableData(data)
|
|
|
}
|
|
|
|
|
|
- const submit = (props: { campaignName: string,count?:number }) => {
|
|
|
+ const submit = (props: { campaignName: string, count?: number }) => {
|
|
|
console.log(111111, tableSelect);
|
|
|
let params = { ...queryForm, ...props }
|
|
|
console.log(accountCreateLogs)
|
|
|
let accountLogs = accountCreateLogs.map((item: any, index) => {
|
|
|
// userActionSetsList 数据源 productList 商品
|
|
|
- let data: any = { adAccountId: item.id ,count:props.count || 1}
|
|
|
+ let data: any = { adAccountId: item.id, count: props.count || 1 }
|
|
|
if (item?.userActionSetsList?.length > 0) { // 数据源
|
|
|
data.userActionSets = item?.userActionSetsList?.map((item: any) => ({ id: item?.id, type: item?.type }))
|
|
|
}
|
|
@@ -368,10 +370,48 @@ const CreateAd: React.FC = () => {
|
|
|
}
|
|
|
}
|
|
|
}, [queryForm, targetKey])
|
|
|
- console.log('queryForm======>',queryForm)
|
|
|
+ // 媒体组更新通知
|
|
|
+ const usersChange=useCallback(()=>{
|
|
|
+ let data = JSON.parse(localStorage.getItem('ADQUSERS' + userId) as any)
|
|
|
+ setUsersArr(data)
|
|
|
+ },[])
|
|
|
+ console.log('queryForm======>111', queryForm)
|
|
|
return <Space direction="vertical" style={{ width: '100%' }}>
|
|
|
- <Card title={<div className={style.cardTitle}>配置区</div>} className={style.createAd} hoverable>
|
|
|
+ <Card
|
|
|
+ title={<div className={style.cardTitle}>配置区</div>}
|
|
|
+ className={style.createAd}
|
|
|
+ hoverable
|
|
|
+ extra={<AddGroup onChange={usersChange} pitcherData={getAdAccount?.data?.data} />}
|
|
|
+ >
|
|
|
<Space>
|
|
|
+ <Selector label="媒体账户组">
|
|
|
+ <Select
|
|
|
+ mode="multiple"
|
|
|
+ style={{ minWidth: 200 }}
|
|
|
+ placeholder="快捷选择媒体账户组"
|
|
|
+ maxTagCount={1}
|
|
|
+ allowClear
|
|
|
+ bordered={false}
|
|
|
+ filterOption={(input: any, option: any) => {
|
|
|
+ return option!.children?.toString().toLowerCase().includes(input.toLowerCase())
|
|
|
+ }}
|
|
|
+ onChange={(e, option) => {
|
|
|
+ console.log(e,option)
|
|
|
+ let userArr:any[] = []
|
|
|
+ e.forEach((key: any)=> {
|
|
|
+ let obj = usesArr.find((item: { id: any })=>item.id === key)
|
|
|
+ if(obj){
|
|
|
+ userArr.push(obj['pitcher'])
|
|
|
+ }
|
|
|
+ })
|
|
|
+ userArr = [...new Set(userArr.flat())]
|
|
|
+ setAccountCreateLogs(userArr?.map((item: any) => ({ adAccountId: item?.split('_')[1], id: Number(item?.split('_')[0]) })))
|
|
|
+ clearData()
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ {usesArr?.map((item: any) => <Select.Option value={item.id} key={item.id}>{item.name}</Select.Option>)}
|
|
|
+ </Select>
|
|
|
+ </Selector>
|
|
|
<Selector label="媒体账户">
|
|
|
<Select
|
|
|
mode="multiple"
|
|
@@ -393,12 +433,8 @@ const CreateAd: React.FC = () => {
|
|
|
}}
|
|
|
>
|
|
|
{getAdAccount?.data?.data?.map((item: any) => <Select.Option value={item.id} key={item.id}>{item.remark ? item.accountId + '——' + item.remark : item.accountId}</Select.Option>)}
|
|
|
- {/* <Select.OptGroup label="Engineer">
|
|
|
- <Select.Option value="20632113">20632113</Select.Option>
|
|
|
- </Select.OptGroup> */}
|
|
|
</Select>
|
|
|
</Selector>
|
|
|
-
|
|
|
<Selector label="推广目标">
|
|
|
<Select style={{ width: 200 }} value={queryForm?.promotedObjectType} placeholder="请选择推广目标" bordered={false} showSearch filterOption={(input: any, option: any) =>
|
|
|
(option!.children as unknown as string).toLowerCase().includes(input.toLowerCase())
|
|
@@ -559,17 +595,17 @@ const CreateAd: React.FC = () => {
|
|
|
</Tabs>
|
|
|
</div>
|
|
|
<div className={style.bottom}>{
|
|
|
- ( queryForm?.taskMediaMaps && queryForm?.taskMediaMaps[targetKey]?.sysAdcreative) ? <>
|
|
|
+ (queryForm?.taskMediaMaps && queryForm?.taskMediaMaps[targetKey]?.sysAdcreative) ? <>
|
|
|
{queryForm?.taskMediaMaps && queryForm?.taskMediaMaps[targetKey]?.sysPageId && <Button type="link" onClick={() => { setLookVisible(true) }}>查看</Button>}
|
|
|
<Button type="link" onClick={() => {
|
|
|
setSelectImgVisible(true)
|
|
|
// 判定是否用原生页顶部替换外部素材
|
|
|
- if(queryForm?.taskMediaMaps && queryForm?.taskMediaMaps[targetKey]?.sysAdcreative?.overrideCanvasHeadOption === 'OPTION_CANVAS_OVERRIDE_CREATIVE' ){
|
|
|
- init({ mediaType: 'PAGE', cloudSize:undefined,adcreativeTemplateId:queryForm?.taskMediaMaps[targetKey]?.sysAdcreative?.adcreativeTemplateId})
|
|
|
- }else{
|
|
|
- init({ mediaType: 'PAGE', cloudSize:undefined})
|
|
|
+ if (queryForm?.taskMediaMaps && queryForm?.taskMediaMaps[targetKey]?.sysAdcreative?.overrideCanvasHeadOption === 'OPTION_CANVAS_OVERRIDE_CREATIVE') {
|
|
|
+ init({ mediaType: 'PAGE', cloudSize: undefined, adcreativeTemplateId: queryForm?.taskMediaMaps[targetKey]?.sysAdcreative?.adcreativeTemplateId })
|
|
|
+ } else {
|
|
|
+ init({ mediaType: 'PAGE', cloudSize: undefined })
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
}}>{queryForm?.taskMediaMaps && queryForm?.taskMediaMaps[targetKey]?.sysPageId ? '修改' : '选择落地页'}</Button>
|
|
|
{/* {accountCreateLogs?.length > 0 ? <Button type="link" onClick={() => { setPageVisible(true) }}>云端落地页</Button> : <Tooltip title="请先选择媒体账户">
|
|
|
<Button type="link">云端落地页</Button>
|