|
@@ -3,10 +3,15 @@ import { CreateAdProps } from "@/services/launchAdq/createAd"
|
|
|
import { BidModeEnum, BidStrategyEnum, OptimizationGoalEnum, PromotedObjectType, SiteSetEnum } from "@/services/launchAdq/enum"
|
|
|
import { getSysAdgroupsInfo } from "@/services/launchAdq/localAd"
|
|
|
import { getsysTargetingInfo } from "@/services/launchAdq/targeting"
|
|
|
-import { Card, Col, Empty, Row, Select, Space, Spin, Tooltip } from "antd"
|
|
|
+import { CloseOutlined } from "@ant-design/icons"
|
|
|
+import { Button, Card, Col, Empty, Row, Select, Space, Spin, Tooltip } from "antd"
|
|
|
import React, { useEffect, useState } from "react"
|
|
|
import { useModel } from "umi"
|
|
|
import AdModal from "../../components/adModal"
|
|
|
+import DataSourceModal from "../../components/dataSourceModal"
|
|
|
+import GoodsModal from "../../components/goodsModal"
|
|
|
+import IdModal from "../../components/idModal"
|
|
|
+import SelectCloud from "../../components/selectCloud"
|
|
|
import TargetingModal from "../../components/targetingModal"
|
|
|
import style from './index.less'
|
|
|
import Selector from "./selector"
|
|
@@ -27,17 +32,23 @@ const CreateAd: React.FC = () => {
|
|
|
sysAdcreativeId: undefined, // 创意ID
|
|
|
sysPageId: undefined, // 落地页Id
|
|
|
})
|
|
|
- const [accountCreateLogs, setAccountCreateLogs] = useState<{ adAccountId: number, id: number, userActionSets?: number }[]>([]) // 账户
|
|
|
+ const [accountCreateLogs, setAccountCreateLogs] = useState<{ adAccountId: number, id: number, userActionSetsList?: number, productList?: any, conversionList?: any }[]>([]) // 账户
|
|
|
|
|
|
const [adVisible, setAdVisible] = useState<boolean>(false) // 选择广告弹窗控制
|
|
|
const [dxVisible, setDxVisible] = useState<boolean>(false) // 选择定向弹窗控制
|
|
|
+ const [goodsVisible, setGoodsVisible] = useState<boolean>(false) // 选择商品弹窗控制
|
|
|
+ const [sourceVisible, setSourceVisible] = useState<boolean>(false) // 选择数据源弹窗控制
|
|
|
+ const [idVisible, setIdVisible] = useState<boolean>(false) // 选择转化ID弹窗控制
|
|
|
+ const [selectImgVisible, setSelectImgVisible] = useState<boolean>(false) // 选择转化ID弹窗控制
|
|
|
const getSysAdgroups = useAjax((params) => getSysAdgroupsInfo(params))
|
|
|
const getsysTargeting = useAjax((params) => getsysTargetingInfo(params))
|
|
|
+ const { init } = useModel('useLaunchAdq.useBdMediaPup')
|
|
|
/*************************/
|
|
|
|
|
|
// 获取账户列表
|
|
|
useEffect(() => {
|
|
|
getAdAccount.run()
|
|
|
+ init({ mediaType: 'PAGE' })
|
|
|
}, [])
|
|
|
|
|
|
/** 获取广告详情 */
|
|
@@ -53,9 +64,25 @@ const CreateAd: React.FC = () => {
|
|
|
}
|
|
|
}, [queryForm?.sysTargetingId])
|
|
|
|
|
|
- console.log('==========>', accountCreateLogs);
|
|
|
+ /** 删除商品内容 */
|
|
|
+ const goodsDel = (index: number) => {
|
|
|
+ let newArr = JSON.parse(JSON.stringify(accountCreateLogs))
|
|
|
+ delete newArr[index].productList
|
|
|
+ setAccountCreateLogs(newArr)
|
|
|
+ }
|
|
|
|
|
|
+ /** 删除数据源 */
|
|
|
+ const sourceDel = (index: number, num: number) => {
|
|
|
+ console.log(index, num);
|
|
|
+ let newArr = JSON.parse(JSON.stringify(accountCreateLogs))
|
|
|
+ newArr[index].userActionSetsList?.splice(num, 1)
|
|
|
+ setAccountCreateLogs(newArr)
|
|
|
+ }
|
|
|
|
|
|
+ /** 设置落地页 */
|
|
|
+ const setPage = (e: any) => {
|
|
|
+ console.log(22222, e)
|
|
|
+ }
|
|
|
|
|
|
return <Card title={<div className={style.cardTitle}>配置区</div>} className={style.createAd} hoverable>
|
|
|
<Space>
|
|
@@ -94,11 +121,11 @@ const CreateAd: React.FC = () => {
|
|
|
|
|
|
<div className={style.cardBody}>
|
|
|
<Row className={style.content}>
|
|
|
- <Col span={18} className={style.conLeft}>
|
|
|
+ <Col span={16} className={style.conLeft}>
|
|
|
<Row className={`${style.conTitle} ${style.conRightBorder}`}><Col span={24}>广告</Col></Row>
|
|
|
<Row className={style.items}>
|
|
|
{/* =============广告基本信息=========== */}
|
|
|
- <Col span={6} className={style.conRightBorder}>
|
|
|
+ <Col className={style.conRightBorder}>
|
|
|
<div className={style.top}>广告基本信息</div>
|
|
|
<div className={style.center}>
|
|
|
<Spin spinning={getSysAdgroups.loading}>
|
|
@@ -125,7 +152,7 @@ const CreateAd: React.FC = () => {
|
|
|
</div>
|
|
|
</Col>
|
|
|
{/* =============定向包=========== */}
|
|
|
- <Col span={6} className={style.conRightBorder}>
|
|
|
+ <Col className={style.conRightBorder}>
|
|
|
<div className={style.top}>
|
|
|
定向{/* <span>已选:{1}</span> */}
|
|
|
</div>
|
|
@@ -135,7 +162,6 @@ const CreateAd: React.FC = () => {
|
|
|
{getsysTargeting?.data ? <>
|
|
|
<div>定向名称: {getsysTargeting?.data?.targetingName}</div>
|
|
|
<div>定向描述: {getsysTargeting?.data?.description}</div>
|
|
|
- <div>定向描述: {getsysTargeting?.data?.description}</div>
|
|
|
</> : <Empty image={Empty.PRESENTED_IMAGE_SIMPLE} />}
|
|
|
</div>
|
|
|
</Spin>
|
|
@@ -143,64 +169,90 @@ const CreateAd: React.FC = () => {
|
|
|
<div className={style.bottom}><span onClick={() => { setDxVisible(true) }}>{getsysTargeting?.data ? '修改' : '添加'}</span></div>
|
|
|
</Col>
|
|
|
{/* =============商品=========== */}
|
|
|
- <Col span={6} className={style.conRightBorder}>
|
|
|
+ <Col className={style.conRightBorder}>
|
|
|
<div className={style.top}>
|
|
|
- 商品<span>已选:{1}</span>
|
|
|
+ 商品{/* <span>已选:{1}</span> */}
|
|
|
</div>
|
|
|
<div className={style.center}>
|
|
|
-
|
|
|
+ <div className={style.centerContent}>
|
|
|
+ {accountCreateLogs?.map((item: any, index: number) => {
|
|
|
+ if (item?.productList) {
|
|
|
+ return <div className={style.acc} key={index}>
|
|
|
+ <div className={style.accName}>{item.adAccountId}</div>
|
|
|
+ {
|
|
|
+ item?.productList?.map((pack: { productName: string, author: string, id: number }, index: number) => {
|
|
|
+ return <div className={style.accCon} key={pack.id}>{pack.productName}<CloseOutlined className={style.close} onClick={() => {
|
|
|
+ goodsDel(index)
|
|
|
+ }} /></div>
|
|
|
+ })
|
|
|
+ }
|
|
|
+ </div>
|
|
|
+ } else {
|
|
|
+ return null
|
|
|
+ }
|
|
|
+ })}
|
|
|
+ </div>
|
|
|
</div>
|
|
|
<div className={style.bottom}>
|
|
|
- {accountCreateLogs?.length > 0 ? <span onClick={() => { }}>添加</span> : <Tooltip title="请先选择媒体账户">
|
|
|
- <span>添加</span>
|
|
|
+ {accountCreateLogs?.length > 0 ? <span onClick={() => { setGoodsVisible(true) }}>编辑</span> : <Tooltip title="请先选择媒体账户">
|
|
|
+ <span>编辑</span>
|
|
|
</Tooltip>}
|
|
|
</div>
|
|
|
</Col>
|
|
|
{/* 数据源 */}
|
|
|
- <Col span={6} className={style.conRightBorder}>
|
|
|
+ <Col className={style.conRightBorder}>
|
|
|
<div className={style.top}>
|
|
|
- 数据源<span>已选:{1}</span>
|
|
|
+ 数据源 {/* <span>已选:{1}</span> */}
|
|
|
</div>
|
|
|
<div className={style.center}>
|
|
|
-
|
|
|
+ {/* userActionSetsList */}
|
|
|
+ <div className={style.centerContent}>
|
|
|
+ {accountCreateLogs?.map((item: any, index: number) => {
|
|
|
+ if (item?.userActionSetsList && item?.userActionSetsList?.length > 0) {
|
|
|
+ return <div className={style.acc} key={index}>
|
|
|
+ <div className={style.accName}>{item.adAccountId}</div>
|
|
|
+ {
|
|
|
+ item?.userActionSetsList?.map((pack: { name: string, type: string, id: number }, index1: number) => {
|
|
|
+ return <div className={style.accCon} key={pack.id}> <span className={style.title}>{pack.name}{' > '}{pack.type}</span> <CloseOutlined className={style.close} onClick={() => {
|
|
|
+ sourceDel(index, index1)
|
|
|
+ }} /></div>
|
|
|
+ })
|
|
|
+ }
|
|
|
+ </div>
|
|
|
+ } else {
|
|
|
+ return null
|
|
|
+ }
|
|
|
+ })}
|
|
|
+ </div>
|
|
|
</div>
|
|
|
<div className={style.bottom}>
|
|
|
- {accountCreateLogs?.length > 0 ? <span onClick={() => { }}>添加</span> : <Tooltip title="请先选择媒体账户">
|
|
|
- <span>添加</span>
|
|
|
+ {accountCreateLogs?.length > 0 ? <span onClick={() => { setSourceVisible(true) }}>编辑</span> : <Tooltip title="请先选择媒体账户">
|
|
|
+ <span>编辑</span>
|
|
|
</Tooltip>}
|
|
|
</div>
|
|
|
</Col>
|
|
|
</Row>
|
|
|
</Col>
|
|
|
{/* =============广告创意=========== */}
|
|
|
- <Col span={6} className={style.conRight}>
|
|
|
+ <Col span={8} className={style.conRight}>
|
|
|
<Row className={style.conTitle}><Col span={24}>广告创意</Col></Row>
|
|
|
<Row className={style.items}>
|
|
|
- <Col span={24}>
|
|
|
+ <Col span={12} className={style.conRightBorder}>
|
|
|
<div className={style.top}>创意基本信息</div>
|
|
|
<div className={style.center}>
|
|
|
|
|
|
</div>
|
|
|
<div className={style.bottom}><span onClick={() => { }}>编辑</span></div>
|
|
|
</Col>
|
|
|
- {/* <Col span={6}>
|
|
|
- <div className={style.top}>创意素材<span>已选:0</span></div>
|
|
|
- <div className={style.center}>
|
|
|
- </div>
|
|
|
- <div className={style.bottom}><span>添加</span></div>
|
|
|
- </Col>
|
|
|
- <Col span={6}>
|
|
|
- <div className={style.top}>创意文案</div>
|
|
|
- <div className={style.center}>
|
|
|
- </div>
|
|
|
- <div className={style.bottom}><span>添加</span></div>
|
|
|
- </Col>
|
|
|
- <Col span={6}>
|
|
|
- <div className={style.top}>落地页<span>已选:0</span></div>
|
|
|
- <div className={style.center}>
|
|
|
+ <Col span={12} >
|
|
|
+ <div className={style.top}>落地页</div>
|
|
|
+ <div className={style.center}>
|
|
|
+ <div className={style.centerContent}>
|
|
|
+ <div>落地页:<Button type="link" onClick={() => { setSelectImgVisible(true) }}>选择落地页</Button></div>
|
|
|
</div>
|
|
|
- <div className={style.bottom}><span>添加</span></div>
|
|
|
- </Col> */}
|
|
|
+ </div>
|
|
|
+ {/* <div className={style.bottom}><span>添加</span></div> */}
|
|
|
+ </Col>
|
|
|
</Row>
|
|
|
</Col>
|
|
|
</Row>
|
|
@@ -216,6 +268,14 @@ const CreateAd: React.FC = () => {
|
|
|
{adVisible && <AdModal visible={adVisible} onClose={() => setAdVisible(false)} promotedObjectType={queryForm.promotedObjectType as string} onChange={(e) => { setQueryForm({ ...queryForm, sysAdgroupsId: e }); setAdVisible(false) }} />}
|
|
|
{/* 选择定向 */}
|
|
|
{dxVisible && <TargetingModal visible={dxVisible} onClose={() => setDxVisible(false)} onChange={(e) => { setQueryForm({ ...queryForm, sysTargetingId: e }); setDxVisible(false) }} />}
|
|
|
+ {/* 选择商品 */}
|
|
|
+ {goodsVisible && <GoodsModal visible={goodsVisible} data={accountCreateLogs} onClose={() => setGoodsVisible(false)} onChange={(e) => { setAccountCreateLogs(e); setGoodsVisible(false) }} />}
|
|
|
+ {/* 选择数据源 */}
|
|
|
+ {sourceVisible && <DataSourceModal visible={sourceVisible} data={accountCreateLogs} onClose={() => setSourceVisible(false)} onChange={(e) => { setAccountCreateLogs(e); setSourceVisible(false) }} />}
|
|
|
+ {/* 选择转化ID */}
|
|
|
+ {idVisible && <IdModal visible={idVisible} data={accountCreateLogs} onClose={() => setIdVisible(false)} onChange={(e) => { setAccountCreateLogs(e); setSourceVisible(false) }} />}
|
|
|
+ {/* 选择素材 */}
|
|
|
+ {selectImgVisible && <SelectCloud visible={selectImgVisible} onClose={() => setSelectImgVisible(false)} onChange={setPage} />}
|
|
|
</Card>
|
|
|
}
|
|
|
|