shenwu il y a 2 ans
Parent
commit
63a15dc5cf

+ 40 - 62
src/pages/launchSystemNew/adq/creative/index.tsx

@@ -1,96 +1,74 @@
 
-import { FnAjax, useAjax } from '@/Hook/useAjax'
-import { ListData, } from '@/services/launchAdq'
+import { useAjax } from '@/Hook/useAjax'
 import { PromotedObjectType } from '@/services/launchAdq/enum'
-import { Col, Row, Input, Select, Button } from 'antd'
+import { Col, Row, Input, Select, Button, message } from 'antd'
 import React, { useEffect, useState, useCallback } from 'react'
 import TableData from '../../components/TableData'
 import tableConfig from './tableConfig'
-import { getAdqAdcreativeList } from '@/services/launchAdq/adq'
+import { getAdqAdcreativeList, putAdqTargetingSyncAll } from '@/services/launchAdq/adq'
 
-export interface ModalConfig {
-    visible: boolean;
-    type?:'add'|'look'|'edit',
-    dataInfo?:null
-}
-
-function Creative(props:{accountId:string}) {
-    const {accountId} = props
-    // 变量
-    const [modalConfig, setModalConfig] = useState<ModalConfig>({
-        visible: false,
-        type:'add'
-    })
-    const [oldsearchData, setOldsearchData] = useState<any>(null)
+function Creative(props: { accountId: string, adAccountId: string }) {
+    let { accountId, adAccountId } = props
     // api方法
-    const sysAdcreativeList: FnAjax<ListData<any> | any> = useAjax((params) => getAdqAdcreativeList(params), { formatResult: true })
-    // 初始获取列表
+    const listAjax = useAjax((params) => getAdqAdcreativeList(params), { formatResult: true })
+    const syncAjax = useAjax((adAccountId) => putAdqTargetingSyncAll(adAccountId))
     useEffect(() => {
-        if(accountId){
-            getList({ pageSize: 20, pageNum: 1,accountId })
-        }
+        getList({ pageNum: 1, pageSize: 20 })
     }, [accountId])
     // 获取列表
-    const getList = useCallback((arg: { pageSize: number, pageNum: number, accountId: string }) => {
-        Object.keys(arg).forEach(key => {
-            !arg[key] && delete arg[key]
-        })
-        if (JSON.stringify(arg) !== JSON.stringify(oldsearchData)) {
-            setOldsearchData(arg)
-            sysAdcreativeList.run(arg)
+    const getList = useCallback((params: {
+        pageNum: number;
+        pageSize: number;
+        accountId?: string;
+        adcreativeName?: string;
+    }) => {
+        if (!params.adcreativeName || params.adcreativeName !== listAjax?.params[0]?.adcreativeName) {
+            !params.adcreativeName && delete params.adcreativeName
+            accountId && listAjax.run({ ...params, accountId })
         }
-    }, [oldsearchData])
-
-    // 设置变量
-    const handleModalConfig = useCallback((arg: ModalConfig) => {
-        setModalConfig({ ...modalConfig, ...arg })
-    }, [modalConfig])
-    // submit
-    // 获取详情
-    const getInfo = useCallback((adgroupsId, type) => {
-        // targetingInfo.run(adgroupsId).then((res: any) => {
-        //     setModalConfig({ ...modalConfig, visible: true, type, dataInfo: res.data })
-        // })
-    }, [modalConfig])
-    // 回调
-    const callback = useCallback((data, type) => {
-        // getInfo(data.id, type)
+    }, [accountId])
+    // 同步 
+    const sync = useCallback(() => {
+        syncAjax.run(adAccountId).then(res => {
+            console.log(res)
+            res && listAjax.refresh()
+            res ? message.success('同步成功!') : message.error('同步失败!')
 
-    }, [])
+        })
+    }, [adAccountId, listAjax])
     return <div>
         <TableData
-            columns={()=>tableConfig(callback)}
-            ajax={sysAdcreativeList}
-            dataSource={sysAdcreativeList?.data?.data?.records}
-            loading={sysAdcreativeList?.loading}
-            scroll={{ y: 600 }}
-            total={sysAdcreativeList?.data?.data?.total}
-            page={sysAdcreativeList?.data?.data?.current}
-            pageSize={sysAdcreativeList?.data?.data?.size}
+            columns={tableConfig}
+            ajax={listAjax}
+            syncAjax={sync}
+            dataSource={listAjax?.data?.data?.records}
+            loading={listAjax?.loading || syncAjax?.loading}
+            scroll={{ x: 2000 }}
+            total={listAjax?.data?.data?.total}
+            page={listAjax?.data?.data?.current}
+            pageSize={listAjax?.data?.data?.size}
+            myKey={'adcreativeId'}
             leftChild={<>
                 <Row gutter={[10, 10]}>
-                    <Col span={24}><Button type='primary' onClick={() => {
-                        handleModalConfig({ visible: true })
-                    }}>新建创意模板</Button></Col>
                     <Col>
                         <Input
                             placeholder='创意名称'
                             allowClear
                             onBlur={(e) => {
                                 let value = e.target.value
-                                getList({ pageNum: 1, pageSize: 20, accountId })
+                                getList({ pageNum: 1, pageSize: 20, adcreativeName: value })
                             }}
                             onKeyDownCapture={(e: any) => {
                                 let key = e.key
                                 if (key === 'Enter') {
                                     let value = e.target.value
-                                    getList({ pageNum: 1, pageSize: 20, accountId })
+                                    getList({ pageNum: 1, pageSize: 20, adcreativeName: value })
                                 }
                             }}
                             onChange={(e) => {
                                 let value = e.target.value
                                 if (!value) {
-                                    getList({ pageNum: 1, pageSize: 20, accountId })
+                                    getList({ pageNum: 1, pageSize: 20, adcreativeName: value })
                                 }
                             }}
                         />
@@ -99,7 +77,7 @@ function Creative(props:{accountId:string}) {
                         <Select placeholder='推广目标选择' style={{ minWidth: 200 }} showSearch filterOption={(input: any, option: any) =>
                             (option!.children as unknown as string).toLowerCase().includes(input.toLowerCase())
                         } allowClear onChange={(value: any) => {
-                            getList({ pageNum: 1, pageSize: 20, accountId})
+                            getList({ pageNum: 1, pageSize: 20, accountId })
                         }}>
                             {
                                 Object.keys(PromotedObjectType).map(key => {

+ 204 - 18
src/pages/launchSystemNew/adq/creative/tableConfig.tsx

@@ -1,12 +1,40 @@
-import { PageTypeEnum, PromotedObjectType } from '@/services/launchAdq/enum'
+import { CreativeTemplateVersionTypeEnum, HeadClickTypeEnum, LinkPageNameTypeEnum, LinkPageTypeEnum, PageTypeEnum, PromotedObjectType, SourceEnum } from '@/services/launchAdq/enum'
 import React from 'react'
 import { Space } from 'antd'
-function tableConfig(callback:(data:any,type:'edit'|'look')=>void): any {
+function tableConfig(): any {
     return [
         {
-            title: 'ID',
-            dataIndex: 'id',
-            key: 'id',
+            title: '创意ID',
+            dataIndex: 'adcreativeId',
+            key: 'adcreativeId',
+            align: 'center',
+            width: 70
+        },
+        {
+            title: '计划ID',
+            dataIndex: 'campaignId',
+            key: 'campaignId',
+            align: 'center',
+            width: 70
+        },
+        {
+            title: '附加创意组件ID',
+            dataIndex: 'componentId',
+            key: 'componentId',
+            align: 'center',
+            width: 70
+        },
+        {
+            title: '互动推广页落地页ID',
+            dataIndex: 'playablePageMaterialId',
+            key: 'playablePageMaterialId',
+            align: 'center',
+            width: 70
+        },
+        {
+            title: '朋友圈头像昵称跳转页ID',
+            dataIndex: 'profileId',
+            key: 'profileId',
             align: 'center',
             width: 70
         },
@@ -16,6 +44,18 @@ function tableConfig(callback:(data:any,type:'edit'|'look')=>void): any {
             key: 'adcreativeName',
             align: 'center',
         },
+        {
+            title: '创意形式类型',
+            dataIndex: 'creativeTemplateCategory',
+            key: 'creativeTemplateCategory',
+            align: 'center',
+        },
+        {
+            title: 'QQ小游戏监控参数',
+            dataIndex: 'qqMiniGameTrackingQueryString',
+            key: 'qqMiniGameTrackingQueryString',
+            align: 'center',
+        },
         {
             title: '广告推广目标类型',
             dataIndex: 'promotedObjectType',
@@ -25,6 +65,12 @@ function tableConfig(callback:(data:any,type:'edit'|'look')=>void): any {
                 return PromotedObjectType[a]
             }
         },
+        {
+            title: '推广目标ID',
+            dataIndex: 'promotedObjectId',
+            key: 'promotedObjectId',
+            align: 'center',
+        },
         {
             title: '落地页类型',
             dataIndex: 'pageType',
@@ -34,12 +80,129 @@ function tableConfig(callback:(data:any,type:'edit'|'look')=>void): any {
                 return PageTypeEnum[a]
             }
         },
+        {
+            title: '落地页类型',
+            dataIndex: 'playablePageMaterialId',
+            key: 'playablePageMaterialId',
+            align: 'center',
+            render: (a: string) => {
+                return PageTypeEnum[a]
+            }
+        },
+        {
+            title: '简版原生页子类型',
+            dataIndex: 'simpleCanvasSubType',
+            key: 'simpleCanvasSubType',
+            align: 'center',
+            render: (a: string) => {
+                return PageTypeEnum[a]
+            }
+        },
+        {
+            title: '创意来源',
+            dataIndex: 'source',
+            key: 'source',
+            align: 'center',
+            render: (a: string) => {
+                return SourceEnum[a]
+            }
+        },
+        {
+            title: '数据版本类型',
+            dataIndex: 'creativeTemplateVersionType',
+            key: 'creativeTemplateVersionType',
+            align: 'center',
+            render: (a: string) => {
+                return CreativeTemplateVersionTypeEnum[a]
+            }
+        },
+        {
+            title: '是否支持版位突破',
+            dataIndex: 'enableBreakthroughSiteset',
+            key: 'enableBreakthroughSiteset',
+            align: 'center',
+            // render: (a: string) => {
+            //     return PageTypeEnum[a]
+            // }
+        },
+        {
+            title: '应用直达页URL',
+            dataIndex: 'deepLinkUrl',
+            key: 'deepLinkUrl',
+            align: 'center',
+        },
+        {
+            title: '通用链接页URL',
+            dataIndex: 'universalLinkUrl',
+            key: 'universalLinkUrl',
+            align: 'center',
+        },
+        {
+            title: '简易原生页嵌入',
+            dataIndex: 'webviewUrl',
+            key: 'webviewUrl',
+            align: 'center',
+        },
+        {
+            title: '头像点击跳转信息',
+            dataIndex: 'headClickType',
+            key: 'headClickType',
+            align: 'center',
+            render: (a: string) => {
+                return HeadClickTypeEnum[a]
+            }
+        },
+        {
+            title: '链接名称类型',
+            dataIndex: 'linkNameType',
+            key: 'linkNameType',
+            align: 'center',
+            render: (a: string) => {
+                return LinkPageNameTypeEnum[a]
+            }
+        },
+        {
+            title: '跳转落地页类型',
+            dataIndex: 'linkPageType',
+            key: 'linkPageType',
+            align: 'center',
+            render: (a: string) => {
+                return LinkPageTypeEnum[a]
+            }
+        },
+        {
+            title: '挂件图',
+            dataIndex: 'marketingPendantImageId',
+            key: 'marketingPendantImageId',
+            align: 'center'
+        },
+        {
+            title: '页面级转化跟踪URL',
+            dataIndex: 'pageTrackUrl',
+            key: 'pageTrackUrl',
+            align: 'center'
+        },
+        {
+            title: '页面级转化跟踪URL',
+            dataIndex: 'pageTrackUrl',
+            key: 'pageTrackUrl',
+            align: 'center'
+        },
         {
             title: '创意形式ID',
             dataIndex: 'adcreativeTemplateId',
             key: 'adcreativeTemplateId',
             align: 'center',
         },
+        {
+            title: '是否开启自动版位功能',
+            dataIndex: 'automaticSiteEnabled',
+            key: 'automaticSiteEnabled',
+            align: 'center',
+            render: (a: any, b: any) => {
+                return a? '开' : '关'
+            }
+        },
         {
             title: '数据展示',
             dataIndex: 'conversionDataType',
@@ -58,25 +221,48 @@ function tableConfig(callback:(data:any,type:'edit'|'look')=>void): any {
                 return b.linkNameType || b.linkPageType ? '开' : '关'
             }
         },
+        {
+            title: '倒计时组件开关',
+            dataIndex: 'countdownSwitch',
+            key: 'countdownSwitch',
+            align: 'center',
+            render: (a: any, b: any) => {
+                return a? '开' : '关'
+            }
+        },
+        {
+            title: '视频广告评论开关',
+            dataIndex: 'feedsVideoCommentSwitch',
+            key: 'feedsVideoCommentSwitch',
+            align: 'center',
+            render: (a: any, b: any) => {
+                return a? '开' : '关'
+            }
+        },
+        {
+            title: '是否已删除',
+            dataIndex: 'isDeleted',
+            key: 'isDeleted',
+            align: 'center',
+            render: (a: any, b: any) => {
+                return a? '是' : '否'
+            }
+        },
+        {
+            title: '动态创意广告自动生成',
+            dataIndex: 'isDynamicCreative',
+            key: 'isDynamicCreative',
+            align: 'center',
+            render: (a: any, b: any) => {
+                return a? '是' : '否'
+            }
+        },
         {
             title: '创建时间',
             dataIndex: 'createTime',
             key: 'createTime',
             align: 'center',
         },
-        {
-            title: '操作',
-            dataIndex: 'cz',
-            key: 'cz',
-            align: 'center',
-            render:(a: any,b: any)=>{
-                return <Space>
-                     <a onClick={()=>{
-                         callback(b,'look')
-                     }}>详情</a>
-                 </Space>
-             }
-        }
     ]
 }
 export default tableConfig

+ 6 - 7
src/pages/launchSystemNew/adq/index.tsx

@@ -1,5 +1,5 @@
-import React, { useState, useEffect } from 'react'
-import { Card, Col, Menu, Row, Tabs } from 'antd';
+import React, { useState, useEffect, useCallback } from 'react'
+import { Button, Card, Col, Menu, Row, Tabs } from 'antd';
 // import './index.less'
 import Ad from './ad';
 import Creative from './creative';
@@ -28,9 +28,9 @@ function Adq() {
         accountId:'',
         adAccountId:''
     })
-    useEffect(() => {
-        // getAdAccountAllOfMember()
-    }, [])
+    const all = useCallback(()=>{
+        getAdAccountAllOfMember()
+    },[])
     useEffect(() => {
         // 获取账号列表
         let name = menuKey[0]
@@ -60,7 +60,6 @@ function Adq() {
 
     // },[menuKey])
     
-    console.log(accountId)
     return <Row >
         <Col span={3} style={{ height: 'calc(100vh - 150px)' }}>
             <Menus
@@ -91,7 +90,7 @@ function Adq() {
             />
         </Col>
         <Col span={21}>
-            <Card >
+            <Card extra={<Button type='primary' onClick={all}>组员接口请求</Button>}>
                 <Tabs activeKey={activeKey} type="card" onChange={(activeKey) => { setActiveKey(activeKey) }} >
                     {
                         tabsConfig?.map(item => {

+ 3 - 0
src/services/launchAdq/adq.ts

@@ -54,11 +54,14 @@ export async function getAdAccountAllOfMember() {
  * @param adgroupName 广告名称
  * @param promotedObjectType 广告类型
  * @param accountId 账户ID
+ * @param adcreativeName
  */
 export async function getAdqAdcreativeList(params: {
   pageNum: number;
   pageSize: number;
   accountId: string;
+  adcreativeName?:string
+
 }) {
   return request(api + '/adq/adcreative/list', {
     method: 'POST',

+ 31 - 0
src/services/launchAdq/enum.ts

@@ -390,3 +390,34 @@ export enum TargetingSourceTypeEnum {
   TARGETING_SOURCE_TYPE_CREATE = '自己创建',
   TARGETING_SOURCE_TYPE_SHARE = '他人分享',
 }
+/**数据版本类型*/
+export enum CreativeTemplateVersionTypeEnum {
+  CREATIVE_TEMPLATE_VERSION_TYPE_UNKOWN='未知',
+  CREATIVE_TEMPLATE_VERSION_TYPE_OLD='未精简前的创意模板等价于',
+  CREATIVE_TEMPLATE_VERSION_TYPE_NEW='精简合并后的创意模板'
+}
+/**头像跳转信息*/
+export enum HeadClickTypeEnum {
+  HEAD_CLICK_TYPE_DEFAULT = '默认值(跳转公众号)',
+  HEAD_CLICK_TYPE_CUSTOMIZED = '自定义链接(可选是否自定义头像)',
+  HEAD_CLICK_TYPE_CELEBRITY_ACCOUNT = '明星主页(必须自定义头像)',
+  HEAD_CLICK_TYPE_VIRTUAL_ACCOUNT = '虚拟帐户主页(不能自定义头像)',
+  HEAD_CLICK_TYPE_LIVE_PROFILE = '视频号profile页(必须自定义头像)',
+  HEAD_CLICK_TYPE_LIVE_EVENT = '视频号活动页(必须自定义头像)',
+  HEAD_CLICK_TYPE_BRAND_PROGRAM = '搜一搜品牌专区(必须自定义头像)',
+}
+/**简版原生页跳转类型*/
+export enum SimpleCanvasSubTypeEnum {
+  SIMPLE_CANVAS_SUB_TYPE_UNKNOWN = '未知',
+  SIMPLE_CANVAS_SUB_TYPE_DEFAULT = '默认模板',
+  SIMPLE_CANVAS_SUB_TYPE_URL = '自定义链接',
+  SIMPLE_CANVAS_SUB_TYPE_SLIDE_UP = '上滑H5',
+  SIMPLE_CANVAS_SUB_TYPE_WEB_STORE = 'webstore链接',
+  SIMPLE_CANVAS_SUB_TYPE_CHOOSE = '选择卡片模版',
+}
+/**创意来源*/
+export enum SourceEnum {
+  AD_CREATIVE_SOURCE_NORMAL = '默认',
+  AD_CREATIVE_AUTO_DERIVE = '自动衍生创意',
+  AD_CREATIVE_AUTO_GENERATE = '自动生成创意',
+}