wjx 2 лет назад
Родитель
Сommit
3afcc0949e

+ 5 - 2
src/pages/launchSystemNew/launchManage/createAd/ad/index.tsx

@@ -7,6 +7,8 @@ import { BaseResult } from '@ahooksjs/use-request/lib/types'
 import AdModal from "../../../components/adModal"
 import WeChatAdModal from "./modal/wechat"
 import LeadAdModal from "./modal/leadAd"
+import { useAjax } from '@/Hook/useAjax'
+import { getOptimizationGoalPermissions } from '@/services/launchAdq/global'
 type Props = {
     queryForm: Partial<CreateAdProps>,
     setQueryForm: React.Dispatch<React.SetStateAction<Partial<CreateAdProps>>>,
@@ -21,6 +23,7 @@ export interface ModalConfig {
 }
 function Ad(props: Props) {
     let { queryForm, getSysAdgroups, setQueryForm, clearData } = props
+    const queryOptimizationGoalPermissions = useAjax((params)=>getOptimizationGoalPermissions(params))
     const [adVisible, setAdVisible] = useState<boolean>(false) // 选择广告弹窗控制
     const [adModalConfig, setAdModalConfig] = useState<ModalConfig>({//新建广告弹窗
         visible: false,
@@ -78,12 +81,12 @@ function Ad(props: Props) {
         {adModalConfig.visible && queryForm.promotedObjectType === "PROMOTED_OBJECT_TYPE_WECHAT_OFFICIAL_ACCOUNT" && <WeChatAdModal visible={adModalConfig.visible} PupFn={handleAdModalConfig} callback={(values) => {
             setQueryForm({ ...queryForm, sysAdgroup: values, sysAdcreativeId: undefined }); setAdVisible(false); clearData()
             handleAdModalConfig({ visible: false, dataInfo: null, type: 'add' })
-        }} type={adModalConfig.type} dataInfo={queryForm.sysAdgroup} queryForm={queryForm} />}
+        }} type={adModalConfig.type} dataInfo={queryForm.sysAdgroup} queryForm={queryForm} ajax={queryOptimizationGoalPermissions}/>}
         {/* 收集线索广告弹窗 */}
         {adModalConfig.visible && queryForm.promotedObjectType === "PROMOTED_OBJECT_TYPE_LEAD_AD" && <LeadAdModal visible={adModalConfig.visible} PupFn={handleAdModalConfig} callback={(values) => {
             setQueryForm({ ...queryForm, sysAdgroup: values, sysAdcreativeId: undefined }); setAdVisible(false); clearData()
             handleAdModalConfig({ visible: false, dataInfo: null, type: 'add' })
-        }} type={adModalConfig.type} dataInfo={queryForm.sysAdgroup} queryForm={queryForm} />}
+        }} type={adModalConfig.type} dataInfo={queryForm.sysAdgroup} queryForm={queryForm} ajax={queryOptimizationGoalPermissions}/>}
     </Col>
 }
 export default Ad

+ 30 - 14
src/pages/launchSystemNew/launchManage/createAd/ad/modal/leadAd.tsx

@@ -17,11 +17,12 @@ interface Props {
     callback: (params: any) => void,
     confirmLoading?: boolean,
     type?: 'add' | 'look' | 'edit',//新增,查看,编辑
-    dataInfo?: any
+    dataInfo?: any,
+    ajax: any
 }
 /**收集线索广告弹窗*/
 function LeadAdModal(props: Props) {
-    let { visible, confirmLoading, PupFn, callback, type, dataInfo, queryForm } = props
+    let { visible, confirmLoading, PupFn, callback, type, dataInfo, queryForm, ajax } = props
     const createSysAdgroup = useAjax((params) => createSysAdgroups(params))
     let arg = type === 'look' ? { footer: null } : {}
     let [state, setState] = useState<any>({
@@ -146,18 +147,30 @@ function LeadAdModal(props: Props) {
         }
     }, [dataInfo])
     // 出价方式改变清空某些数据
-    const bidModeChange=useCallback((props)=>{
+    const bidModeChange = useCallback((props) => {
         form.setFieldsValue({
             ...props,
-            optimizationGoal:null,
-            smartBidType:null,
+            optimizationGoal: null,
+            smartBidType: null,
             // bidAmount:null,
-            bidStrategy:null,
-            autoAcquisitionEnabled:false,
-            autoAcquisitionBudget:null,
-            dailyBudget:null,
+            bidStrategy: null,
+            autoAcquisitionEnabled: false,
+            autoAcquisitionBudget: null,
+            dailyBudget: null,
         })
-    },[])
+    }, [])
+    // 出价和版位改变时查询
+    useEffect(() => {
+        if (bidMode && siteSet) {
+            let obj: any = { siteSet, promotedObjectType: queryForm.promotedObjectType }
+            if (bidMode === 'BID_MODE_OCPC' || bidMode === 'BID_MODE_OCPM') {
+                obj = { ...obj, bidMode }
+            }
+            ajax.run(obj).then((res: any) => {
+                console.log(res)
+            })
+        }
+    }, [bidMode, siteSet])
     return <Modal
         visible={visible}
         title={type === 'add' ? '新建广告' : type === 'look' ? '广告详情' : '编辑广告'}
@@ -192,7 +205,7 @@ function LeadAdModal(props: Props) {
                     autoAcquisitionEnabled: false,
                     wechatSceneType: '0',
                     wechatPositionType: '0',
-                    optimizationGoal: 'OPTIMIZATIONGOAL_ECOMMERCE_ORDER',
+                    // optimizationGoal: 'OPTIMIZATIONGOAL_ECOMMERCE_ORDER',
                     configuredStatus: 'AD_STATUS_SUSPEND'
                 }
             }
@@ -210,7 +223,7 @@ function LeadAdModal(props: Props) {
                     </Radio.Group>
                 </Form.Item>
                 {!automaticSiteEnabled && <Form.Item name='siteSet' noStyle rules={[{ required: true, message: '请输入选择广告版位!' }]}>
-                    <Checkbox.Group style={{ width: '100%' }} onChange={()=>{bidModeChange({bidMode:'BID_MODE_OCPM'})}}>
+                    <Checkbox.Group style={{ width: '100%' }} onChange={() => { bidModeChange({ bidMode: 'BID_MODE_OCPM' }) }}>
                         <Row>
                             <Col span={4}>
                                 <Checkbox value="SITE_SET_MOMENTS">微信朋友圈</Checkbox>
@@ -300,7 +313,7 @@ function LeadAdModal(props: Props) {
                     <TimePicker />
                 </Form.Item>}
             </Form.Item>
-            <Form.Item label={<strong>出价方式<Tooltip title='出价方式不同将影响自定义人群,行为兴趣意向等某些功能无法使用'><ExclamationCircleOutlined style={{ color: '#e91e63', marginLeft: 5 }} /></Tooltip></strong>} name='bidMode' rules={[{required:true,message:'请选择出价方式'}]}>
+            <Form.Item label={<strong>出价方式<Tooltip title='出价方式不同将影响自定义人群,行为兴趣意向等某些功能无法使用'><ExclamationCircleOutlined style={{ color: '#e91e63', marginLeft: 5 }} /></Tooltip></strong>} name='bidMode' rules={[{ required: true, message: '请选择出价方式' }]}>
                 <Radio.Group onChange={bidModeChange}>
                     {
                         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 => {
@@ -318,7 +331,10 @@ function LeadAdModal(props: Props) {
                             (option!.children as unknown as string).toLowerCase().includes(input.toLowerCase())
                         } allowClear>
                             {
-                                Object.keys(OptimizationGoalEnum).map(key => {
+                                // Object.keys(OptimizationGoalEnum).map(key => {
+                                //     return <Select.Option value={key} key={key}>{OptimizationGoalEnum[key]}</Select.Option>
+                                // })
+                                ajax?.data?.optimizationGoalPermissionList.map((key: string) => {
                                     return <Select.Option value={key} key={key}>{OptimizationGoalEnum[key]}</Select.Option>
                                 })
                             }

+ 16 - 3
src/pages/launchSystemNew/launchManage/createAd/ad/modal/wechat.tsx

@@ -17,11 +17,12 @@ interface Props {
     callback: (params: any) => void,
     confirmLoading?: boolean,
     type?: 'add' | 'look' | 'edit',//新增,查看,编辑
-    dataInfo?: any
+    dataInfo?: any,
+    ajax: any
 }
 /**微信公众号广告弹窗*/
 function WeChatAdModal(props: Props) {
-    let { visible, confirmLoading, PupFn, callback, type, dataInfo, queryForm } = props
+    let { visible, confirmLoading, PupFn, callback, type, dataInfo, queryForm, ajax } = props
     const createSysAdgroup = useAjax((params) => createSysAdgroups(params))
     let [state, setState] = useState<any>({
         isShowTime: []
@@ -158,6 +159,18 @@ function WeChatAdModal(props: Props) {
             dailyBudget: null,
         })
     }, [])
+    // 出价和版位改变时查询
+    useEffect(() => {
+        if (bidMode && siteSet) {
+            let obj:any = {siteSet,promotedObjectType: queryForm.promotedObjectType}
+            if(bidMode === 'BID_MODE_OCPC' || bidMode === 'BID_MODE_OCPM'){
+                obj = {...obj,bidMode}
+            }
+            ajax.run(obj).then((res: any)=>{
+                console.log(res)
+            })
+        }
+    }, [bidMode, siteSet])
     return <Modal
         visible={visible}
         title={type === 'add' ? '新建广告' : type === 'look' ? '广告详情' : '编辑广告'}
@@ -191,7 +204,7 @@ function WeChatAdModal(props: Props) {
                     autoAcquisitionEnabled: false,
                     wechatSceneType: '0',
                     wechatPositionType: '0',
-                    optimizationGoal: 'OPTIMIZATIONGOAL_ECOMMERCE_ORDER',
+                    // optimizationGoal: 'OPTIMIZATIONGOAL_ECOMMERCE_ORDER',
                     configuredStatus: 'AD_STATUS_SUSPEND'
                 }
             }

+ 37 - 5
src/pages/launchSystemNew/launchManage/createAd/creative/modal/index.tsx

@@ -162,6 +162,10 @@ function CreativePup(props: Props) {
                         newValues.adcreativeElements = { ...newValues.adcreativeElements, endPage: { ...newValues.adcreativeElements.endPage, endPageDesc: newValues.endPageDesc } }
                         delete newValues[key]
                         break;
+                    case 'buttonText'://特殊行动按钮
+                        newValues.adcreativeElements = { ...newValues.adcreativeElements, buttonText: newValues.buttonText }
+                        delete newValues[key]
+                        break;
                     case 'brand'://品牌形象
                         newValues.adcreativeElements = {
                             ...newValues.adcreativeElements, brand: {
@@ -400,6 +404,10 @@ function CreativePup(props: Props) {
                     states = { ...states, xd_show: false }
                 }
             }
+            // 特殊行动按钮
+            if (adcreative_template.adcreativeElements?.find((item: { name: string }) => item.name === 'button_text') && !ok) {
+                values = { ...values, buttonText: adcreative_template?.adcreativeElements?.find((item: { name: string }) => item.name === 'button_text')?.enumProperty?.enumeration[0].value }
+            }
             // 视频结束页 end_page
             if (adcreative_template.adcreativeElements.some((item: { name: string }) => item.name === 'end_page')) {
                 // let endPageType =adcreative_template?.adcreativeElements?.filter(item=>item.name === 'end_page_type')[0]?.enumProperty?.enumeration
@@ -453,7 +461,7 @@ function CreativePup(props: Props) {
     useEffect(() => {
         if (!infoSet && dataInfo && adcreative_template_list?.length > 0) {
             let { adcreativeName, adcreativeTemplateId, conversionDataType, conversionTargetType, linkNameType, linkPageType, pageType, promotedObjectType, siteSet, headClickSpec, adcreativeElements, overrideCanvasHeadOption, linkPageSpec } = dataInfo
-            let { description, imageUrl, title, videoUrl, imageUrlList, endPage, shortVideoStruct, brand } = adcreativeElements
+            let { description, imageUrl, title, videoUrl, imageUrlList, endPage, shortVideoStruct, brand,buttonText } = adcreativeElements
             let obj: any = {
                 adcreativeName,
                 siteSet,
@@ -461,7 +469,7 @@ function CreativePup(props: Props) {
                 adcreativeTemplateId,
             }
             getTemplate(adcreativeTemplateId, true)
-            console.log(2222)
+            console.log(2222,dataInfo)
             if ([720, 721, 618, 1708].some(n => n === adcreativeTemplateId)) {
                 obj = { ...obj, adcreativeElementsType: '视频' }
             } else {
@@ -503,6 +511,9 @@ function CreativePup(props: Props) {
             if (brand && brand.brandImgUrl && brand.brandName) {
                 obj = { ...obj, brand: brand.brandName + '_' + brand.brandImgUrl }
             }
+            if(buttonText){
+                obj = {...obj,buttonText}
+            }
             if (videoUrl) {
                 setVideoMaterialConfig({
                     cloudSize: [],
@@ -723,9 +734,9 @@ function CreativePup(props: Props) {
                                                 </div>
                                             </Form.Item>
                                         }
-                                        {
+                                        {/* {
                                             item.description === '图片' && adcreative_template?.adcreativeElements?.some(item => item.name === 'video') && <Button onClick={videoToImgs} size='small' type='primary' disabled={!videoMaterialConfig.list[0]}>从视频生成封面图</Button>
-                                        }
+                                        } */}
                                         {/* 多图 */}
                                         {
                                             item.name === 'image_list' && <Form.Item
@@ -866,7 +877,7 @@ function CreativePup(props: Props) {
                                 </Radio.Group>
                             </Form.Item>
                         }
-                        {/* ============================================================行动按钮============================================================= */}
+                        {/* ============================================================普通行动按钮============================================================= */}
                         {
                             pupState.xd_show && <Form.Item label={<strong>行动按钮</strong>} name='actionBtn' valuePropName="checked">
                                 <Switch checkedChildren="开启" unCheckedChildren="关闭" />
@@ -915,6 +926,27 @@ function CreativePup(props: Props) {
 
                             </>
                         }
+                        {/* ============================================================特殊行动按钮============================================================= */}
+                        {
+                            adcreative_template?.adcreativeElements?.find(item => item.name === 'button_text') && <Form.Item label={<strong>行动按钮</strong>} >
+                                <Form.Item valuePropName="checked" noStyle >
+                                    <Switch checkedChildren="开启" unCheckedChildren="关闭" checked={true} disabled defaultChecked={true} />
+                                </Form.Item>
+                            </Form.Item>
+                        }
+                        {
+                            adcreative_template?.adcreativeElements?.find(item => item.name === 'button_text') && <Form.Item name='buttonText' label={<strong>按钮文案</strong>} rules={[{ required: true, message: '请选择按钮文案!' }]}>
+                                <Select style={{ width: 200 }} showSearch filterOption={(input, option) =>
+                                    (option!.children as unknown as string).toLowerCase().includes(input.toLowerCase())
+                                } allowClear>
+                                    {
+                                        adcreative_template?.adcreativeElements?.find(item => item.name === 'button_text')?.enumProperty?.enumeration?.map((item: any) => {
+                                            return <Select.Option value={item.value} key={item.value}>{item.value}</Select.Option>
+                                        })
+                                    }
+                                </Select>
+                            </Form.Item>
+                        }
                         {/* ============================================================数据展示============================================================= */}
                         {pupState.sj_show && <Form.Item label={<strong>数据展示</strong>} name='dataShow' valuePropName="checked">
                             <Switch checkedChildren="开启" unCheckedChildren="关闭" />

+ 2 - 2
src/services/api.ts

@@ -1,5 +1,5 @@
-export let api: any = process.env.NODE_ENV === 'development' ? 'api' : 'http://47.97.38.17/api'
-// export let api: any = process.env.NODE_ENV === 'development' ? 'api' : 'http://api.zanxiangwl.com'
+// export let api: any = process.env.NODE_ENV === 'development' ? 'api' : 'http://47.97.38.17/api'
+export let api: any = process.env.NODE_ENV === 'development' ? 'api' : 'http://api.zanxiangwl.com'
 export let dataApi: any = process.env.NODE_ENV === 'development' ? 'dapi' : `http://data.zanxiangnet.com`
 export let wxApi: any = process.env.NODE_ENV === 'development' ? 'wxapi' : `https://report.zanxiangwl.com`
 export let launchApi: any = `http://192.168.7.175:8018`

Разница между файлами не показана из-за своего большого размера
+ 59 - 51
src/services/launchAdq/enum.ts


+ 8 - 0
src/services/launchAdq/global.ts

@@ -165,4 +165,12 @@ export async function editSysProfileApi(data: { name: string, brandImgUrl: strin
     return request(api + `/adq/sysProfile/${sysProfileId}`, {
         method: 'DELETE'
     })
+}
+
+/**查询优化目标权限*/ 
+export async function getOptimizationGoalPermissions(data:any) {
+    return request(api+`/adq/launch/tools/getOptimizationGoalPermissions`,{
+        method:'POST',
+        data
+    })
 }

Некоторые файлы не были показаны из-за большого количества измененных файлов