|
@@ -70,6 +70,16 @@ const CreateAd: React.FC = () => {
|
|
|
const createAdBatch = useAjax((params) => createAdBatchApi(params))
|
|
|
/*************************/
|
|
|
|
|
|
+ /**数据回填 */
|
|
|
+ useEffect(() => {
|
|
|
+ let adqAdData = localStorage.getItem('ADQAD')
|
|
|
+ if (adqAdData) {
|
|
|
+ const { queryForm, accountCreateLogs } = JSON.parse(adqAdData)
|
|
|
+ setQueryForm({ ...queryForm })
|
|
|
+ setAccountCreateLogs(accountCreateLogs)
|
|
|
+ }
|
|
|
+ }, [])
|
|
|
+
|
|
|
// 设置地域
|
|
|
useEffect(() => {
|
|
|
tagsList_REGION.run({ type: 'REGION' }).then(res => {
|
|
@@ -189,25 +199,57 @@ const CreateAd: React.FC = () => {
|
|
|
// userActionSetsList 数据源 productList 商品
|
|
|
let data: any = { adAccountId: item.id }
|
|
|
if (item?.userActionSetsList?.length > 0) {
|
|
|
- data.userActionSets = item?.userActionSetsList?.map((item:any) => ({ id: item?.id, type: item?.type }))
|
|
|
+ data.userActionSets = item?.userActionSetsList?.map((item: any) => ({ id: item?.id, type: item?.type }))
|
|
|
}
|
|
|
if (item?.productList?.length) {
|
|
|
data.productId = item?.productList[0].productOuterId
|
|
|
+ data.productCatalogId = item?.productList[0].productCatalogId
|
|
|
}
|
|
|
return data
|
|
|
})
|
|
|
params.accountCreateLogs = accountLogs
|
|
|
- console.log(222222, params)
|
|
|
createAdBatch.run(params).then(res => {
|
|
|
-
|
|
|
+ if (res) {
|
|
|
+ message.success('创建成功')
|
|
|
+ window.location.href = '/#/launchSystemNew/launchManage/taskList'
|
|
|
+ }
|
|
|
})
|
|
|
}
|
|
|
|
|
|
+ /** 清除数据 */
|
|
|
const clearData = () => {
|
|
|
setTableData([])
|
|
|
setTableSelect([])
|
|
|
}
|
|
|
|
|
|
+ /** 存为预设 */
|
|
|
+ const severBd = () => {
|
|
|
+ // queryForm accountCreateLogs
|
|
|
+ localStorage.setItem('ADQAD', JSON.stringify({
|
|
|
+ queryForm,
|
|
|
+ accountCreateLogs
|
|
|
+ }))
|
|
|
+ message.success('存储成功')
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 清除 */
|
|
|
+ const delBdPlan = () => {
|
|
|
+ localStorage.removeItem('ADQAD')
|
|
|
+ setAccountCreateLogs([])
|
|
|
+ setQueryForm({
|
|
|
+ campaignName: '', // 计划名称
|
|
|
+ campaignType: 'CAMPAIGN_TYPE_NORMAL', // 计划类型 CAMPAIGN_TYPE_NORMAL CAMPAIGN_TYPE_SEARCH
|
|
|
+ promotedObjectType: 'PROMOTED_OBJECT_TYPE_WECHAT_OFFICIAL_ACCOUNT', // 推广目标类型
|
|
|
+ speedMode: 'SPEED_MODE_STANDARD', // 投放速度模式
|
|
|
+ sysAdgroupsId: undefined, // 广告组内容
|
|
|
+ sysTargetingId: undefined, // 定向包 id
|
|
|
+ adName: undefined, // 广告名称
|
|
|
+ configuredStatus: 'AD_STATUS_SUSPEND', // 广告状态
|
|
|
+ sysAdcreativeId: undefined, // 创意ID
|
|
|
+ sysPageId: undefined, // 落地页Id
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
return <Space direction="vertical" style={{ width: '100%' }}>
|
|
|
<Card title={<div className={style.cardTitle}>配置区</div>} className={style.createAd} hoverable>
|
|
|
<Space>
|
|
@@ -222,8 +264,10 @@ const CreateAd: React.FC = () => {
|
|
|
filterOption={(input: any, option: any) =>
|
|
|
(option!.children as unknown as string).toLowerCase().includes(input.toLowerCase())
|
|
|
}
|
|
|
+ value={accountCreateLogs?.map((item: { id: number }) => item?.id)}
|
|
|
onChange={(e, option) => {
|
|
|
setAccountCreateLogs(option?.map((item: any) => ({ adAccountId: item?.children, id: item?.value })))
|
|
|
+ clearData()
|
|
|
}}
|
|
|
>
|
|
|
{getAdAccount?.data?.data?.map((item: any) => <Select.Option value={item.id} key={item.id}>{item.accountId}</Select.Option>)}
|
|
@@ -236,7 +280,7 @@ const CreateAd: React.FC = () => {
|
|
|
<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())
|
|
|
- } onChange={(e) => { setQueryForm({ ...queryForm, promotedObjectType: e }) }}>
|
|
|
+ } onChange={(e) => { setQueryForm({ ...queryForm, promotedObjectType: e }); clearData() }}>
|
|
|
{Object.keys(PromotedObjectType).map(key => {
|
|
|
return <Select.Option value={key} key={key}>{PromotedObjectType[key]}</Select.Option>
|
|
|
})}
|
|
@@ -424,9 +468,9 @@ const CreateAd: React.FC = () => {
|
|
|
</Row>
|
|
|
{/* =============广告底部按钮=========== */}
|
|
|
<Space className={style.bts}>
|
|
|
- {/* <Button type='primary' onClick={severBd}>暂存到本地</Button> */}
|
|
|
+ <Button type='primary' onClick={severBd}>存为预设</Button>
|
|
|
<Button type='primary' onClick={preview}><SearchOutlined /> 批量预览广告</Button>
|
|
|
- {/* <Button onClick={delBdPlan}>清空本地配置</Button> */}
|
|
|
+ <Button onClick={delBdPlan}>清空配置/预设</Button>
|
|
|
</Space>
|
|
|
</div>
|
|
|
</Card>
|
|
@@ -490,7 +534,7 @@ const CreateAd: React.FC = () => {
|
|
|
{/* 查看落地页 */}
|
|
|
{lookVisible && <LookLanding visible={lookVisible} onClose={() => setLookVisible(false)} id={queryForm?.sysPageId as any} />}
|
|
|
{/* 设置名称 */}
|
|
|
- {subVisible && <SubmitModal visible={subVisible} onClose={() => setSubVisible(false)} onChange={submit} ajax={createAdBatch}/>}
|
|
|
+ {subVisible && <SubmitModal visible={subVisible} onClose={() => setSubVisible(false)} onChange={submit} ajax={createAdBatch} />}
|
|
|
</Space>
|
|
|
}
|
|
|
|