|
@@ -15,12 +15,15 @@ interface Props {
|
|
|
visible: boolean,
|
|
|
PupFn: (arg: ModalConfig) => void,
|
|
|
callback: (params: any) => void,
|
|
|
- confirmLoading: boolean
|
|
|
+ confirmLoading: boolean,
|
|
|
+ type?: 'add' | 'look' | 'edit',//新增,查看,编辑
|
|
|
+ dataInfo?: any
|
|
|
}
|
|
|
/**创意模板*/
|
|
|
function CreativeModal(props: Props) {
|
|
|
- let { visible, title, confirmLoading, PupFn, callback } = props
|
|
|
+ let { visible, confirmLoading, PupFn, callback, type, dataInfo } = props
|
|
|
const { init } = useModel('useLaunchAdq.useBdMediaPup')
|
|
|
+ let arg = type === 'look' ? { footer: null } : {}
|
|
|
// 请求
|
|
|
const getAdcreativeTemplate = useAjax((params) => get_adcreative_template(params))
|
|
|
const getAdcreativeTemplateList = useAjax((params) => get_adcreative_template_list(params))
|
|
@@ -32,6 +35,7 @@ function CreativeModal(props: Props) {
|
|
|
const [descriptionShow, setdescriptionshow] = useState(false)
|
|
|
const [endPageDescShow, setendPageDescnshow] = useState(false)
|
|
|
const [titleShow, settitleshow] = useState(false)
|
|
|
+ const [login, setlogin] = useState(true)
|
|
|
const [form] = Form.useForm();
|
|
|
const [pupState, setPupState] = useState({
|
|
|
kp_show: false,
|
|
@@ -83,17 +87,19 @@ function CreativeModal(props: Props) {
|
|
|
break;
|
|
|
case 'image_list'://图素材
|
|
|
newValues.adcreativeElements = {
|
|
|
- imageUrlList: materialConfig.list?.map(item=>item.url),
|
|
|
+ imageUrlList: materialConfig.list?.map(item => item.url),
|
|
|
description: newValues.description,
|
|
|
}
|
|
|
delete newValues[key]
|
|
|
break;
|
|
|
case 'short_video1'://视频素材
|
|
|
- // newValues.adcreativeElements = {
|
|
|
- // video: materialConfig.list[0].url,
|
|
|
- // description: newValues.description,
|
|
|
- // }
|
|
|
- // delete newValues[key]
|
|
|
+ newValues.adcreativeElements = {
|
|
|
+ shortVideoStruct:{
|
|
|
+ shortVideo1Url:materialConfig.list[0].url
|
|
|
+ },
|
|
|
+ description: newValues.description,
|
|
|
+ }
|
|
|
+ delete newValues[key]
|
|
|
break;
|
|
|
case 'description'://文案
|
|
|
newValues.adcreativeElements = { ...newValues.adcreativeElements, description: newValues.description }
|
|
@@ -101,6 +107,14 @@ function CreativeModal(props: Props) {
|
|
|
case 'title'://文案
|
|
|
newValues.adcreativeElements = { ...newValues.adcreativeElements, title: newValues.title }
|
|
|
break;
|
|
|
+ case 'endPageType'://视频结束l类型
|
|
|
+ newValues.adcreativeElements = { ...newValues.adcreativeElements, endPage: {...newValues.adcreativeElements.endPage,endPageType:newValues.endPageType} }
|
|
|
+ delete newValues[key]
|
|
|
+ break;
|
|
|
+ case 'endPageDesc'://视频结束文案
|
|
|
+ newValues.adcreativeElements = { ...newValues.adcreativeElements, endPage: {...newValues.adcreativeElements.endPage,endPageDesc:newValues.endPageDesc} }
|
|
|
+ delete newValues[key]
|
|
|
+ break;
|
|
|
}
|
|
|
}
|
|
|
delete newValues.description //删除外层文案
|
|
@@ -282,14 +296,94 @@ function CreativeModal(props: Props) {
|
|
|
}
|
|
|
|
|
|
}, [])
|
|
|
+ // 数据回填
|
|
|
+ useEffect(() => {
|
|
|
+ if (dataInfo && adcreative_template_list?.length > 0 && adcreative_template) {
|
|
|
+ let { adcreativeName, adcreativeTemplateId, conversionDataType, conversionTargetType, linkNameType, linkPageType, pageType, promotedObjectType, siteSet, adcreativeElements } = dataInfo
|
|
|
+ let { description, imageUrl, title, videoUrl, imageUrlList,endPage,shortVideoStruct } = adcreativeElements
|
|
|
+ let obj: any = {
|
|
|
+ adcreativeName,
|
|
|
+ siteSet,
|
|
|
+ promotedObjectType,
|
|
|
+ adcreativeTemplateId,
|
|
|
+ }
|
|
|
+ if ([720, 721, 618, 1708].some(n => n === adcreativeTemplateId)) {
|
|
|
+ obj = { ...obj, adcreativeElementsType: '视频' }
|
|
|
+ } else {
|
|
|
+ obj = { ...obj, adcreativeElementsType: '图片' }
|
|
|
+ }
|
|
|
+ if (conversionDataType) {
|
|
|
+ obj = { ...obj, conversionDataType, dataShow: true }
|
|
|
+ }
|
|
|
+ if (conversionTargetType) {
|
|
|
+ obj = { ...obj, conversionTargetType, dataShow: true }
|
|
|
+ }
|
|
|
+ if (linkNameType) {
|
|
|
+ obj = { ...obj, linkNameType, actionBtn: true }
|
|
|
+ }
|
|
|
+ if (linkPageType) {
|
|
|
+ obj = { ...obj, linkPageType, actionBtn: true }
|
|
|
+ }
|
|
|
+ if (pageType) {
|
|
|
+ obj = { ...obj, pageType }
|
|
|
+ }
|
|
|
+ if (description) {
|
|
|
+ obj = { ...obj, description }
|
|
|
+ }
|
|
|
+ if (title) {
|
|
|
+ obj = { ...obj, title }
|
|
|
+ }
|
|
|
+ if(endPage){
|
|
|
+ obj = { ...obj, videoOver:true ,...endPage}
|
|
|
+ }
|
|
|
+ if (videoUrl) {
|
|
|
+ setMaterialConfig({
|
|
|
+ cloudSize: [],
|
|
|
+ list: [{ url: videoUrl }],
|
|
|
+ max: 1,
|
|
|
+ type: 'video',
|
|
|
+ adcreativeTemplateId
|
|
|
+ })
|
|
|
+ }
|
|
|
+ if (imageUrl) {
|
|
|
+ setMaterialConfig({
|
|
|
+ cloudSize: [],
|
|
|
+ list: [{ url: imageUrl }],
|
|
|
+ max: 1,
|
|
|
+ type: 'image',
|
|
|
+ adcreativeTemplateId
|
|
|
+ })
|
|
|
+ }
|
|
|
+ if (imageUrlList) {
|
|
|
+ setMaterialConfig({
|
|
|
+ cloudSize: [],
|
|
|
+ list: imageUrlList?.map((url: any) => ({ url })),
|
|
|
+ max: imageUrlList.length,
|
|
|
+ type: 'image_list',
|
|
|
+ adcreativeTemplateId
|
|
|
+ })
|
|
|
+ }
|
|
|
+ if(shortVideoStruct){
|
|
|
+ setMaterialConfig({
|
|
|
+ cloudSize: [],
|
|
|
+ list: [{ url: shortVideoStruct.shortVideo1Url }],
|
|
|
+ max: 1,
|
|
|
+ type: 'short_video1',
|
|
|
+ adcreativeTemplateId
|
|
|
+ })
|
|
|
+ }
|
|
|
+ form.setFieldsValue(obj)
|
|
|
+ }
|
|
|
+ }, [dataInfo, adcreative_template_list, adcreative_template])
|
|
|
return <Modal
|
|
|
visible={visible}
|
|
|
- title={title + '创意'}
|
|
|
- onCancel={() => { PupFn({ visible: false }) }}
|
|
|
+ title={type === 'add' ? '新建创意' : type === 'look' ? '创意详情' : '编辑创意'}
|
|
|
+ onCancel={() => { PupFn({ visible: false, dataInfo: null, type: 'add' }) }}
|
|
|
onOk={handleOk}
|
|
|
width={1200}
|
|
|
confirmLoading={confirmLoading}
|
|
|
className='myModal'
|
|
|
+ {...arg}
|
|
|
>
|
|
|
<Form
|
|
|
form={form}
|
|
@@ -300,8 +394,8 @@ function CreativeModal(props: Props) {
|
|
|
adcreativeElementsType: '视频',
|
|
|
promotedObjectType: 'PROMOTED_OBJECT_TYPE_WECHAT_OFFICIAL_ACCOUNT',
|
|
|
siteSet: ['SITE_SET_MOMENTS', 'SITE_SET_WECHAT'],
|
|
|
- actionBtn: true,//行动按钮
|
|
|
- dataShow: true,//数据展示
|
|
|
+ // actionBtn: false,//行动按钮
|
|
|
+ // dataShow: false,//数据展示
|
|
|
}
|
|
|
}
|
|
|
>
|
|
@@ -354,7 +448,8 @@ function CreativeModal(props: Props) {
|
|
|
<div className={styles.adcreative_template_item}>
|
|
|
{item.isGeneral && <span style={{ color: '#4080ff', fontSize: 10 }}>所选版位通投</span>}
|
|
|
<img src={item.adcreativeSampleImage} />
|
|
|
- <span>{item.adcreativeTemplateAppellation} </span>
|
|
|
+ <span style={{ fontSize: 12, height: 20, lineHeight: '20px' }}>{item.adcreativeTemplateAppellation}</span>
|
|
|
+ <span style={{ fontSize: 12, height: 20, lineHeight: '20px' }}>{item.adcreativeTemplateId}</span>
|
|
|
</div>
|
|
|
</Radio.Button>
|
|
|
})
|
|
@@ -371,7 +466,7 @@ function CreativeModal(props: Props) {
|
|
|
{/* 视频 */}
|
|
|
{
|
|
|
(item.name === 'short_video1' || item.name === 'video') && <div className={`${styles.box} ${styles.video}`} onClick={() => {
|
|
|
- init({ mediaType: 'VIDEO', cloudSize: [[{ relation: '=', width: item.restriction.videoRestriction.minWidth, height: item.restriction.videoRestriction.minHeight }]] })
|
|
|
+ init({ mediaType: 'VIDEO', cloudSize:adcreativeTemplateId === 1708 ? [[{ relation: '=', width: 1280, height: 720 }]]:[[{ relation: '=', width: item.restriction.videoRestriction.minWidth, height: item.restriction.videoRestriction.minHeight }]] })
|
|
|
setTimeout(() => {
|
|
|
set_selectImgVisible(true)
|
|
|
setMaterialConfig({
|
|
@@ -384,8 +479,8 @@ function CreativeModal(props: Props) {
|
|
|
}}>
|
|
|
<p>
|
|
|
{
|
|
|
- materialConfig?.list[0] ? <video src={materialConfig?.list[0].url} /> : <>
|
|
|
- <span>{`推荐尺寸(${item.restriction.videoRestriction.minWidth} x ${item.restriction.videoRestriction.minHeight})`}</span>
|
|
|
+ materialConfig?.list[0] ? <video src={materialConfig?.list[0].url} controls /> : <>
|
|
|
+ <span>{`推荐尺寸(${adcreativeTemplateId === 1708 ?1280 :item.restriction.videoRestriction.minWidth} x ${adcreativeTemplateId === 1708 ?720 :item.restriction.videoRestriction.minHeight})`}</span>
|
|
|
<span>{`${item.restriction.videoRestriction.fileFormat?.map(str => str?.replace('MEDIA_TYPE_', ''))};< ${item.restriction.videoRestriction.fileSize / 1024}M;时长 ≥ ${item.restriction.videoRestriction.minDuration}s,≤ ${item.restriction.videoRestriction.maxDuration}s,必须带有声音`}</span>
|
|
|
</>
|
|
|
}
|
|
@@ -625,7 +720,7 @@ function CreativeModal(props: Props) {
|
|
|
<Form.Item name='endPageDesc' rules={[{ required: true, pattern: RegExp("^[^\\<\\>\\&'\\\"\\/\\x08\\x09\\x0A\\x0D\\\\]{1,12}$"), message: '请输入正确的结束页文案' }]} style={{ marginBottom: 0, marginRight: 10 }}>
|
|
|
<Input
|
|
|
placeholder='请输入结束页文案'
|
|
|
- style={{width:300}}
|
|
|
+ style={{ width: 300 }}
|
|
|
onFocus={() => {
|
|
|
setendPageDescnshow(true)
|
|
|
textList({ maxTextLength: 12 })
|