Pārlūkot izejas kodu

Merge branch 'develop' of http://git.zanxiangnet.com/wjx/ad-manage

wjx 2 gadi atpakaļ
vecāks
revīzija
5d01489f7b

+ 46 - 5
src/pages/launchSystemNew/launchManage/createAd/ad/modal/leadAd.tsx

@@ -10,6 +10,7 @@ import { CreateAdProps } from '@/services/launchAdq/createAd';
 import { createSysAdgroups } from '@/services/launchAdq/localAd';
 import AdPositionList from './adPositionList';
 import BidAdjustment from './bidAdjustment';
+import { useModel } from 'umi';
 const { RangePicker }: { RangePicker: any } = DatePicker;
 let DatePickers: any = DatePicker
 interface Props {
@@ -42,6 +43,7 @@ export interface SiteSetPackageDataProps {
 /**收集线索广告弹窗*/
 function LeadAdModal(props: Props) {
     let { visible, confirmLoading, PupFn, callback, type, dataInfo, queryForm, ajax } = props
+    const { currentUser }: any = useModel('@@initialState', model => ({ currentUser: model.initialState?.currentUser }))
     const createSysAdgroup = useAjax((params) => createSysAdgroups(params))
     let arg = type === 'look' ? { footer: null } : {}
     let [state, setState] = useState<any>({
@@ -264,16 +266,24 @@ function LeadAdModal(props: Props) {
             if (dataInfo?.firstDayBeginTime) {//存在首日开始时间,选中开关
                 setState({ ...state, isShowTime: ['1'] })
             }
+        } else {
+            form.setFieldsValue({ 
+                adgroupName: '广告_销售线索_' + moment().format('YYYYMMDDhhmmss') + '_' + currentUser.userId,
+                date: moment().startOf('day').add(4, 'M'),
+                optimizationGoal: "OPTIMIZATIONGOAL_ECOMMERCE_ORDER",
+                bidStrategy: "BID_STRATEGY_TARGET_COST",
+                bidAmount: '1000'
+            })
         }
     }, [dataInfo])
     // 出价方式改变清空某些数据
     const bidModeChange = useCallback((props) => {
         form.setFieldsValue({
             ...props,
-            optimizationGoal: null,
-            smartBidType: null,
+            optimizationGoal: 'OPTIMIZATIONGOAL_ECOMMERCE_ORDER',
+            smartBidType: 'SMART_BID_TYPE_CUSTOM',
             // bidAmount:null,
-            bidStrategy: null,
+            bidStrategy: 'BID_STRATEGY_TARGET_COST',
             autoAcquisitionEnabled: false,
             autoAcquisitionBudget: null,
             dailyBudget: null,
@@ -472,7 +482,14 @@ function LeadAdModal(props: Props) {
             {/* ============================================================排期与出价============================================================= */}
             <Divider orientation='center'>排期与出价</Divider>
             <Form.Item label={<strong>投放日期</strong>} name='dateType'>
-                <Radio.Group >
+                <Radio.Group onChange={(e) => {
+                    if (e.target.value === "1") {
+                        form.setFieldsValue({ date: [moment().startOf('day').add(4, 'M'), moment().startOf('day').add(12, 'M')] })
+                    }
+                    if (e.target.value === "2") {
+                        form.setFieldsValue({ date: moment().startOf('day').add(4, 'M') })
+                    }
+                }}>
                     <Radio.Button value="1">选择开始与结束日期</Radio.Button>
                     <Radio.Button value="2">长期投放</Radio.Button>
                 </Radio.Group>
@@ -500,7 +517,31 @@ function LeadAdModal(props: Props) {
                 </Form.Item>}
             </Form.Item>
             <Form.Item label={<strong>出价方式<Tooltip title='出价方式不同将影响自定义人群,行为兴趣意向等某些功能无法使用'><ExclamationCircleOutlined style={{ color: '#e91e63', marginLeft: 5 }} /></Tooltip></strong>} name='bidMode' rules={[{ required: true, message: '请选择出价方式' }]}>
-                <Radio.Group onChange={bidModeChange}>
+                <Radio.Group onChange={(e) => {
+                    console.log(e.target.value);
+                    
+                    if (e.target.value === "BID_MODE_CPM" || e.target.value === "BID_MODE_CPC") {
+                        form.setFieldsValue({
+                            optimizationGoal: null,
+                            smartBidType: null,
+                            // bidAmount:null,
+                            bidStrategy: null,
+                            autoAcquisitionEnabled: false,
+                            autoAcquisitionBudget: null,
+                            dailyBudget: null,
+                        })
+                    } else {
+                        form.setFieldsValue({
+                            optimizationGoal: "OPTIMIZATIONGOAL_ECOMMERCE_ORDER",
+                            smartBidType: "SMART_BID_TYPE_CUSTOM",
+                            bidAmount: '1000',
+                            bidStrategy: "BID_STRATEGY_TARGET_COST",
+                            autoAcquisitionEnabled: false,
+                            autoAcquisitionBudget: null,
+                            dailyBudget: null,
+                        })
+                    }
+                }}>
                     {
                         Object.keys(BidModeEnum).filter(key => { if (siteSet?.some((name: string) => name === "SITE_SET_MOMENTS")) { return key === 'BID_MODE_OCPM' || key === 'BID_MODE_CPM' } else { return true } })?.map(key => {
                             return <Radio.Button value={key} key={key} >{BidModeEnum[key]}</Radio.Button>

+ 42 - 2
src/pages/launchSystemNew/launchManage/createAd/ad/modal/wechat.tsx

@@ -11,6 +11,7 @@ import { createSysAdgroups } from '@/services/launchAdq/localAd';
 import AdPositionList from './adPositionList';
 import { SiteSetPackageDataProps } from './leadAd';
 import BidAdjustment from './bidAdjustment';
+import { useModel } from 'umi';
 const { RangePicker }: { RangePicker: any } = DatePicker;
 let DatePickers: any = DatePicker
 interface Props {
@@ -28,6 +29,7 @@ function WeChatAdModal(props: Props) {
 
     /*******************************/
     let { visible, confirmLoading, PupFn, callback, type, dataInfo, queryForm, ajax } = props
+    const { currentUser }: any = useModel('@@initialState', model => ({ currentUser: model.initialState?.currentUser }))
     const createSysAdgroup = useAjax((params) => createSysAdgroups(params))
     let [state, setState] = useState<any>({ isShowTime: [] })
     let [template_checked, settemplate_checked] = useState<boolean>(dataInfo?.isTemplate || false)
@@ -246,6 +248,14 @@ function WeChatAdModal(props: Props) {
             if (dataInfo?.firstDayBeginTime) {//存在首日开始时间,选中开关
                 setState({ ...state, isShowTime: ['1'] })
             }
+        } else {
+            form.setFieldsValue({
+                adgroupName: '广告_微信朋友圈_' + moment().format('YYYYMMDDhhmmss') + '_' + currentUser.userId,
+                date: moment().startOf('day').add(4, 'M'),
+                optimizationGoal: "OPTIMIZATIONGOAL_ECOMMERCE_ORDER",
+                bidStrategy: "BID_STRATEGY_TARGET_COST",
+                bidAmount: '1000'
+            })
         }
     }, [dataInfo])
     // 出价方式改变清空某些数据
@@ -403,7 +413,14 @@ function WeChatAdModal(props: Props) {
             {/* ============================================================排期与出价============================================================= */}
             <Divider orientation='center'>排期与出价</Divider>
             <Form.Item label={<strong>投放日期</strong>} name='dateType'>
-                <Radio.Group >
+                <Radio.Group onChange={(e) => {
+                    if (e.target.value === "1") {
+                        form.setFieldsValue({ date: [moment().startOf('day').add(4, 'M'), moment().startOf('day').add(12, 'M')] })
+                    }
+                    if (e.target.value === "2") {
+                        form.setFieldsValue({ date: moment().startOf('day').add(4, 'M') })
+                    }
+                }}>
                     <Radio.Button value="1">选择开始与结束日期</Radio.Button>
                     <Radio.Button value="2">长期投放</Radio.Button>
                 </Radio.Group>
@@ -431,7 +448,30 @@ function WeChatAdModal(props: Props) {
                 </Form.Item>}
             </Form.Item>
             <Form.Item label={<strong>出价方式<Tooltip title='oCPC/oCPM出价,或开启自动扩量/智能扩量时不支持二方人群'><ExclamationCircleOutlined style={{ color: '#e91e63', marginLeft: 5 }} /></Tooltip></strong>} name='bidMode' rules={[{ required: true, message: '请选择出价方式' }]}>
-                <Radio.Group onChange={bidModeChange}>
+                <Radio.Group onChange={(e) => {
+                    if (e.target.value === "BID_MODE_CPM") {
+                        form.setFieldsValue({
+                            optimizationGoal: null,
+                            smartBidType: null,
+                            // bidAmount:null,
+                            bidStrategy: null,
+                            autoAcquisitionEnabled: false,
+                            autoAcquisitionBudget: null,
+                            dailyBudget: null,
+                        })
+                    } else {
+                        form.setFieldsValue({
+                            optimizationGoal: "OPTIMIZATIONGOAL_ECOMMERCE_ORDER",
+                            smartBidType: "SMART_BID_TYPE_CUSTOM",
+                            bidAmount: '1000',
+                            bidStrategy: "BID_STRATEGY_TARGET_COST",
+                            autoAcquisitionEnabled: false,
+                            autoAcquisitionBudget: null,
+                            dailyBudget: null,
+                        })
+                    }
+
+                }}>
                     {
                         Object.keys(BidModeEnum).filter(key => { if (siteSet?.some((name: string) => name === "SITE_SET_MOMENTS")) { return key === 'BID_MODE_OCPM' || key === 'BID_MODE_CPM' } else { return true } })?.map(key => {
                             return <Radio.Button value={key} key={key} >{BidModeEnum[key]}</Radio.Button>

+ 13 - 10
src/pages/launchSystemNew/launchManage/createAd/creative/modal/index.tsx

@@ -14,6 +14,7 @@ import { createSysAdcreative } from '@/services/launchAdq/creative'
 import { creativeConfig, overrideCanvasHeadOptionEnum } from './config'
 import BrandImage from './brandImage'
 import HeadNickJump from './headNickJump'
+import moment from 'moment'
 interface Props {
     queryForm: Partial<CreateAdProps>,
     title?: string,
@@ -28,6 +29,7 @@ interface Props {
 /**创意模板*/
 function CreativePup(props: Props) {
     let { visible, confirmLoading, PupFn, callback, type, dataInfo, queryForm } = props
+    const { currentUser }: any = useModel('@@initialState', model => ({ currentUser: model.initialState?.currentUser }))
     let [template_checked, settemplate_checked] = useState<boolean>(dataInfo?.isTemplate || false)
     let { promotedObjectType, sysAdgroup } = queryForm
     let { siteSet } = sysAdgroup
@@ -320,6 +322,7 @@ function CreativePup(props: Props) {
                     adcreativeTemplateId: id
                 }).then(res => {
                     if (res?.length > 0) {
+                        form.setFieldsValue({ adcreativeName: res[0]?.adcreativeTemplateAppellation + '_' + moment().format('YYYYMMDDhhmmss') + '_' + currentUser.userId })
                         set_adcreative_template(res[0])
                         if (siteSet?.some((name: string) => name === 'SITE_SET_MOMENTS')) {
                             let id = res[0].adcreativeTemplateId
@@ -479,7 +482,7 @@ function CreativePup(props: Props) {
                 adcreativeTemplateId,
             }
             getTemplate(adcreativeTemplateId, true)
-            console.log(2222,dataInfo)
+            console.log(2222, dataInfo)
             if ([720, 721, 618, 1708, 722, 1529].some(n => n === adcreativeTemplateId)) {
                 obj = { ...obj, adcreativeElementsType: '视频' }
             } else {
@@ -522,10 +525,10 @@ function CreativePup(props: Props) {
                 obj = { ...obj, brand: brand.brandName + '_' + brand.brandImgUrl }
             }
             if (profile && profile.headImageUrl && profile.profileName && profile.description) {
-                obj = { ...obj, profile: profile.profileName + '_' + profile.headImageUrl + '_' + profile.description}
+                obj = { ...obj, profile: profile.profileName + '_' + profile.headImageUrl + '_' + profile.description }
             }
-            if(buttonText){
-                obj = {...obj,buttonText}
+            if (buttonText) {
+                obj = { ...obj, buttonText }
             }
             if (videoUrl) {
                 setVideoMaterialConfig({
@@ -625,12 +628,6 @@ function CreativePup(props: Props) {
                 }
             }
         >
-            {/* ============================================================基本信息============================================================= */}
-            <Divider orientation='center'>基本信息</Divider>
-            {/* ============================================================创意名称============================================================= */}
-            <Form.Item label={<strong>创意名称</strong>} name='adcreativeName' rules={[{ required: true, message: '请输入广告名称!' }]}>
-                <Input placeholder='创意名称' style={{ width: 300 }} />
-            </Form.Item>
             {/* ============================================================创意形式============================================================= */}
             <Divider orientation='center'>创意形式</Divider>
             {/* ============================================================创意形式============================================================= */}
@@ -1035,6 +1032,12 @@ function CreativePup(props: Props) {
                         }
                     </>
             }
+            {/* ============================================================基本信息============================================================= */}
+            <Divider orientation='center'>基本信息</Divider>
+            {/* ============================================================创意名称============================================================= */}
+            <Form.Item label={<strong>创意名称</strong>} name='adcreativeName' rules={[{ required: true, message: '请输入广告名称!' }]}>
+                <Input placeholder='创意名称' style={{ width: 300 }} />
+            </Form.Item>
         </Form>
         {/* 选择图片素材 */}
         {

+ 1 - 116
src/pages/launchSystemNew/launchManage/createAd/creativeCL/modal/index.tsx

@@ -1,5 +1,5 @@
 import React, { useCallback, useEffect, useMemo, useState } from 'react'
-import { Modal, Form, Input, Divider, Select, Radio, Switch, Spin, List, Checkbox, Space, Button, message, Image, Empty } from 'antd'
+import { Modal, Form, Input, Divider, Select, Radio, Switch, Spin, List, Space, Button, message, Image, Empty } from 'antd'
 import styles from './index.less'
 import { useAjax } from '@/Hook/useAjax'
 import { getText, get_adcreative_template, get_adcreative_template_list, get_tools_video_capture } from '@/services/launchAdq/global'
@@ -10,7 +10,6 @@ import { useModel } from 'umi'
 import { ModalConfig } from '../../ad';
 import { outAdcreativeTemplateIdFun } from '../../../localAd/adenum'
 import { CreateAdProps } from '@/services/launchAdq/createAd'
-import { createSysAdcreative } from '@/services/launchAdq/creative'
 import { creativeConfig, overrideCanvasHeadOptionEnum } from './config'
 import BrandImage from './brandImage'
 import HeadNickJump from './headNickJump'
@@ -35,13 +34,11 @@ function CreativePup(props: Props) {
     let [template_checked, settemplate_checked] = useState<boolean>(dataInfo?.isTemplate || false)
     let { promotedObjectType, sysAdgroup } = queryForm
     let { siteSet } = sysAdgroup
-    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))
     const getTextLsit = useAjax((params) => getText(params))
-    const addSysAdgroup = useAjax((params) => createSysAdcreative(params))
     const getVideoCapture = useAjax((params) => get_tools_video_capture(params))
     // 变量
     const [adcreative_template, set_adcreative_template] = useState<AdcreativeTemplate>()
@@ -49,7 +46,6 @@ function CreativePup(props: Props) {
     const [selectImgVisible, set_selectImgVisible] = useState(false)
     const [selectVideoVisible, set_selectVideoVisible] = useState(false)
     const [videoImgsVisbile, set_videoImgsVisbile] = useState(false)
-    const [descriptionShow, setdescriptionshow] = useState(false)
     const [endPageDescShow, setendPageDescnshow] = useState(false)
     const [materialData, setMaterialData] = useState<{ label: string, name: string, restriction: any }[]>([])
     const [textData, setTextData] = useState<any[]>([])
@@ -69,7 +65,6 @@ function CreativePup(props: Props) {
             'https://test-adq-media.oss-cn-hangzhou.aliyuncs.com/image/545A4C2A5B874C82A9D1C0C063624AE5.jpg'
         ]
     })
-    const [titleShow, settitleshow] = useState(false)
     const [form] = Form.useForm();
     const [pupState, setPupState] = useState({
         kp_show: false,
@@ -468,15 +463,7 @@ function CreativePup(props: Props) {
     useEffect(() => {
         let modal = document.querySelector('.myModal')
         let onBiurdescription = (e: any) => {
-            let d = document.querySelector('.my_description')
-            let t = document.querySelector('.my_title')
             let p = document.querySelector('.my_endPageDesc')
-            if (!d?.contains(e.target)) {
-                setdescriptionshow(false)
-            }
-            if (!t?.contains(e.target)) {
-                settitleshow(false)
-            }
             if (!p?.contains(e.target)) {
                 setendPageDescnshow(false)
             }
@@ -485,7 +472,6 @@ function CreativePup(props: Props) {
         return () => {
             modal?.removeEventListener('click', onBiurdescription)
         }
-
     }, [])
     // 数据回填
     useEffect(() => {
@@ -597,25 +583,6 @@ function CreativePup(props: Props) {
             set_infoSet(true)
         }
     }, [dataInfo, adcreative_template_list, adcreative_template, infoSet])
-    // 生成视频封面图
-    const videoToImgs = useCallback(() => {
-        if (videoMaterialConfig.list[0]) {
-            set_videoImgsVisbile(true)
-            // let url = videoMaterialConfig.list[0].url
-            // fetch(url).then(res => res.blob()).then(async (blob) => {
-            //     let file = new File([blob], 'sp', { type: blob.type })
-            //     // let md5 = await getMD5(file)
-            //     let formData = new FormData()
-            //     formData.append('videoFile', file)
-            //     formData.append('number', '12')
-            //     getVideoCapture.run(formData).then(res => {
-            //         console.log(res)
-            //     })
-            // })
-        } else {
-            message.warning('请先选择视频文件!!!')
-        }
-    }, [videoMaterialConfig.list])
     return <Modal
         visible={visible}
         title={type === 'add' ? '新建创意' : type === 'look' ? '创意详情' : '编辑创意'}
@@ -626,10 +593,6 @@ function CreativePup(props: Props) {
         footer={<Space>
             <Button onClick={() => { PupFn({ visible: false, dataInfo: null, type: 'add' }) }}>取消</Button>
             <Button type='primary' onClick={handleOk}>确定</Button>
-            {/* {<Checkbox checked={template_checked} onChange={(e) => {
-                let checked = e.target.checked
-                settemplate_checked(checked)
-            }}>存为模板</Checkbox>} */}
         </Space>}
         className='myModal'
         {...arg}
@@ -688,84 +651,6 @@ function CreativePup(props: Props) {
                         </Form.Item> : <Form.Item label={<strong>品牌形象</strong>} name='brand' rules={[{ required: true, message: '请选择一个头像及昵称跳转页,与广告创意一起展示' }]}>
                             <BrandImage />
                         </Form.Item> : null}
-                        {/* ============================================================素材============================================================= */}
-
-                        {/* 标题 */}
-                        {/* {
-                            adcreative_template?.adcreativeElements?.filter(item => item.name === 'title').map(item => {
-                                return <div key={item.fieldType}>
-                                    <Form.Item label={<strong>{item.description}(选填)</strong>} className={'my_title'} >
-                                        <Form.Item name={item.name} rules={[{ pattern: RegExp(item.restriction.textRestriction.textPattern?.replace(/\+/ig, `{1,${item.restriction.textRestriction.maxLength}}`)), message: '请输入正确的' + item.description }]} noStyle>
-                                            <Input
-                                                placeholder={'请输入' + item.description}
-                                                style={{ width: 500 }}
-                                                allowClear
-                                                onFocus={() => {
-                                                    settitleshow(true)
-                                                    textList({ maxTextLength: item.restriction.textRestriction.maxLength })
-                                                }}
-                                                onChange={(e) => {
-                                                    let value = e.target.value
-                                                    textList({ maxTextLength: item.restriction.textRestriction.maxLength, keyword: value })
-                                                }}
-                                            />
-                                        </Form.Item>
-                                        <span>{`${titles?.length ?? 0}/${item.restriction.textRestriction.maxLength}`}</span>
-                                        {
-                                            titleShow && <List
-                                                loading={getTextLsit?.loading}
-                                                size="small"
-                                                style={{ maxHeight: 300, overflowX: 'auto' }}
-                                                bordered
-                                                dataSource={getTextLsit?.data?.returnTexts}
-                                                renderItem={(item: any) => <List.Item onClick={() => {
-                                                    form.setFieldsValue({ title: item.text })
-                                                    settitleshow(false)
-                                                }}><span >{item.text}{item.tag && <span className={styles.crt}>{'CTR 高'}</span>}</span></List.Item>}
-                                            />
-                                        }
-                                    </Form.Item>
-                                </div>
-                            })
-                        } */}
-                        {//过滤了不必传和品牌名称,品牌标识图(外部传)短视频结构(组装使用)
-                            // adcreative_template?.adcreativeElements?.filter(item => item.required && item.name === 'description').map(item => {
-                            //     let maxNum = adcreativeTemplateId === 1708 || adcreativeTemplateId === 1707 ? pupState.xd_show ? 10 : item.restriction.textRestriction.maxLength : item.restriction.textRestriction.maxLength
-                            //     return <div key={item.fieldType}>
-                            //         <Form.Item label={<strong>{item.description}</strong>} className={'my_description'}>
-                            //             <Form.Item name={item.name} noStyle rules={[{ required: true, pattern: RegExp(item.restriction.textRestriction.textPattern?.replace(/\+/ig, `{1,${maxNum}}`)), message: '请输入正确的' + item.description }]}>
-                            //                 <Input
-                            //                     placeholder={'请输入' + item.description}
-                            //                     style={{ width: 500 }}
-                            //                     onFocus={() => {
-                            //                         setdescriptionshow(true)
-                            //                         textList({ maxTextLength: maxNum })
-                            //                     }}
-                            //                     onChange={(e) => {
-                            //                         let value = e.target.value
-                            //                         textList({ maxTextLength: maxNum, keyword: value })
-                            //                     }}
-                            //                     allowClear
-                            //                 />
-                            //             </Form.Item>
-                            //             <span>{`${description?.length ?? 0}/${maxNum}`}</span>
-                            //             {
-                            //                 descriptionShow && <List
-                            //                     loading={getTextLsit?.loading}
-                            //                     size="small"
-                            //                     style={{ maxHeight: 300, overflowX: 'auto' }}
-                            //                     bordered
-                            //                     dataSource={getTextLsit?.data?.returnTexts}
-                            //                     renderItem={(item: any) => <List.Item onClick={(e: any) => {
-                            //                         form.setFieldsValue({ description: item.text })
-                            //                         setdescriptionshow(false)
-                            //                     }}><span >{item.text}{item.tag && <span className={styles.crt}>{'CTR 高'}</span>}</span></List.Item>}
-                            //                 />
-                            //             }
-                            //         </Form.Item>
-                            //     </div>
-                            // })
-                        }
                         {/* ============================================================落地页============================================================= */}
                         {adcreativeTemplateId ? <Form.Item label={<strong>落地页</strong>} name='pageType' >
                             <Radio.Group>

+ 1 - 1
src/pages/launchSystemNew/launchManage/taskList/tableConfig.tsx

@@ -14,7 +14,7 @@ function tableConfig(callback: (data: any, type: 'log' | 'page' | 'copy', allDat
             render: (a: any, b: any) => {
                 return <Space>
                     <a style={{ color: '#1890ff', fontSize: 12 }} onClick={() => { callback({ taskId: b.id, campaignName: b.campaignName }, 'log', b) }}>日志</a>
-                    <a style={{ color: '#1890ff', fontSize: 12 }} onClick={() => { callback({ taskId: b.id, campaignName: b.campaignName }, 'copy') }}>复制</a>
+                    {/* <a style={{ color: '#1890ff', fontSize: 12 }} onClick={() => { callback({ taskId: b.id, campaignName: b.campaignName }, 'copy') }}>复制</a> */}
                 </Space>
             }
         },