shenwu 2 lat temu
rodzic
commit
3d2c2d77fe

+ 7 - 6
src/models/useLaunchAdq/useBdMediaPup.ts

@@ -33,11 +33,11 @@ type State = {
     selectItem?: any[],//单选素材时存放选中的素材
     knewsdefaultData?: any,//k图文编辑时的默认内容
     sortVisible?: boolean,//排序弹窗
-
     num?: number, //选择数量
     size?: number,  // 需要上传素材的大小
     upLoadLoading?: boolean,
-    cloudSize?: any[]
+    cloudSize?: any[],
+    maxSize?:number,//素材最大尺寸
 }
 export type Action = {
     type: 'set' | 'init',
@@ -81,13 +81,12 @@ const initData: State = {
     newsVisrible: false,
     sortVisible: false,
     sort: 0,
-
     num: 1
 }
 /**本地素材管理器 */
 function useBdMediaPup() {
     const [state, dispatch]: [State, Dispatch<Action>] = useReducer(reducer, initData)
-    const { fileName, sort, belongUser, mediaType, parentId, selectFile, selectItem, delPupId, cloudSize, num, rightClickPup, actionItem, path, publicPath, videoTitle, videoDescription, size } = state
+    const { fileName, sort, belongUser, mediaType, parentId, selectFile, selectItem, delPupId, cloudSize, num, rightClickPup, actionItem, path, publicPath, videoTitle, videoDescription, size,maxSize } = state
     const list = useAjax((params) => bdSysMediaList(params))
     const add = useAjax((params) => bdSysMediaAdd(params), { msgNmae: '新增' })
     const del = useAjax((params) => delMedia(params), { msgNmae: '删除' })
@@ -103,6 +102,7 @@ function useBdMediaPup() {
     })
     /**初始化数据 */
     const init = useCallback((params: any) => {
+        console.log('params======>',params)
         dispatch({ type: 'init', params })
     }, [])
     /**设置state */
@@ -251,11 +251,12 @@ function useBdMediaPup() {
     }, [list, selectFile, mediaType])
     /**获取本地素材数据列表 */
     const getList = useCallback((props?: any) => {
-        let obj = { pageSize: 20, pageNum: 1, belongUser: belongUser === '0' ? false : true, mediaType, parentId, sizeQueries: cloudSize, ...props }
+        console.log('getList====>',props)
+        let obj = { pageSize: 20, pageNum: 1, belongUser: belongUser === '0' ? false : true, mediaType, parentId, sizeQueries: cloudSize,maxSize, ...props }
         list.run(obj).then((res) => {
             setIsOk(true)
         })
-    }, [list, mediaType, belongUser, parentId, cloudSize])
+    }, [list, mediaType, belongUser, parentId, cloudSize,maxSize])
     /**选中文件 single 开启可单选为了在右键删除选择时只选一个*/
     const onFile = useCallback((e: any, item: { id: any, folder?: boolean }, isAll?: boolean, single?: boolean) => {
         let { id } = item

+ 15 - 4
src/pages/launchSystemNew/adq/ad/index.tsx

@@ -1,17 +1,18 @@
 
 import { useAjax } from '@/Hook/useAjax'
 import { PromotedObjectType } from '@/services/launchAdq/enum'
-import { Col, Row, Input, Select, Button, message } from 'antd'
-import React, { useEffect, useState, useCallback } from 'react'
+import { Col, Row, Input, Select, message } from 'antd'
+import React, { useEffect, useCallback } from 'react'
 import TableData from '../../components/TableData'
 import tableConfig from './tableConfig'
-import { putAdqAdgroupsSync, getAdqAdgroupsList } from '@/services/launchAdq/adq'
+import { putAdqAdgroupsSync, getAdqAdgroupsList,putAdqAdgroupsConfigStatus } from '@/services/launchAdq/adq'
 
 function Ad(props: { accountId: string, adAccountId: string ,userId:string}) {
     let { accountId, adAccountId,userId } = props
     // api方法
     const listAjax = useAjax((params) => getAdqAdgroupsList(params), { formatResult: true })
     const syncAjax = useAjax((adAccountId) => putAdqAdgroupsSync(adAccountId))
+    const switchAjax = useAjax((params) => putAdqAdgroupsConfigStatus(params))
     console.log('创意=====》')
     useEffect(() => {
         getList({ pageNum: 1, pageSize: 20 })
@@ -40,9 +41,19 @@ function Ad(props: { accountId: string, adAccountId: string ,userId:string}) {
 
         })
     }, [adAccountId, listAjax])
+    // 启停
+    const switchHandle=useCallback((data,checked)=>{
+        let { accountId,adgroupId}=data
+        console.log(checked)
+        let configuredStatus = checked ? 'AD_STATUS_NORMAL' : 'AD_STATUS_SUSPEND'
+        switchAjax.run({accountId,adgroupId,configuredStatus}).then(res=>{
+            res && listAjax.refresh()
+            res ? message.success(checked?'开启广告成功!':'关闭广告成功!') : message.error(checked?'开启广告失败':'关闭广告失败!')
+        })
+    },[])
     return <div>
         <TableData
-            columns={tableConfig}
+            columns={()=>tableConfig(switchHandle)}
             ajax={listAjax}
             syncAjax={sync}
             dataSource={listAjax?.data?.data?.records}

+ 16 - 14
src/pages/launchSystemNew/adq/ad/tableConfig.tsx

@@ -1,7 +1,7 @@
-import { AdStatusEnum, ConfiguredStatusEnum, OptimizationGoalEnum, PromotedObjectType } from '@/services/launchAdq/enum'
+import { AdStatusEnum, OptimizationGoalEnum, PromotedObjectType } from '@/services/launchAdq/enum'
 import React from 'react'
 import { Badge, Switch } from 'antd'
-function tableConfig():any{
+function tableConfig(switchHandle:(data:any,Status:any)=>void):any{
     return [
         {
             title: '启停',
@@ -10,8 +10,10 @@ function tableConfig():any{
             align: 'center',
             width:50,
             fixed:'left',
-            render:(a:string)=>{
-                return <Switch /> 
+            render:(a:string,b:any)=>{
+                return <Switch defaultChecked={b?.configuredStatus=== 'AD_STATUS_NORMAL'} onChange={(checked:boolean)=>{
+                    switchHandle(b,checked)
+                }}/> 
             }
         },
         {
@@ -132,16 +134,16 @@ function tableConfig():any{
             align: 'center',
             width:160,
         },
-        {
-            title: '客户设置的状态',
-            dataIndex: 'configuredStatus',
-            key: 'configuredStatus',
-            align: 'center',
-            width:130,
-            render:(a:string)=>{
-                return  <Badge status={a==='AD_STATUS_NORMAL' ? "processing" :"error" } text={ConfiguredStatusEnum[a]} />
-            }
-        },
+        // {
+        //     title: '客户设置的状态',
+        //     dataIndex: 'configuredStatus',
+        //     key: 'configuredStatus',
+        //     align: 'center',
+        //     width:130,
+        //     render:(a:string)=>{
+        //         return  <Badge status={a==='AD_STATUS_NORMAL' ? "processing" :"error" } text={ConfiguredStatusEnum[a]} />
+        //     }
+        // },
         {
             title: '广告状态',
             dataIndex: 'status',

+ 1 - 1
src/pages/launchSystemNew/adq/adAccount/tableConfig.tsx

@@ -1,6 +1,6 @@
 import {  FundStatusEnum, } from '@/services/launchAdq/enum'
 import React from 'react'
-import { Badge, Switch } from 'antd'
+import { Badge } from 'antd'
 function tableConfig():any{
     return [
         {

+ 14 - 4
src/pages/launchSystemNew/adq/campaign/index.tsx

@@ -1,17 +1,18 @@
 
 import { useAjax } from '@/Hook/useAjax'
 import { CampaignTypeEnum, ConfiguredStatusEnum, PromotedObjectType } from '@/services/launchAdq/enum'
-import { Col, Row, Input, Select, Button, message } from 'antd'
-import React, { useEffect, useState, useCallback } from 'react'
+import { Col, Row, Input, Select, message } from 'antd'
+import React, { useEffect, useCallback } from 'react'
 import TableData from '../../components/TableData'
 import tableConfig from './tableConfig'
-import { getAdqCampaignList, putAdqCampaignPage } from '@/services/launchAdq/adq'
+import { getAdqCampaignList, putAdqCampaignPage ,putAdqCampaignConfigStatus} from '@/services/launchAdq/adq'
 
 function Campaign(props: { accountId: string, adAccountId: string, userId: string }) {
     let { accountId, adAccountId, userId } = props
     // api方法
     const listAjax = useAjax((params) => getAdqCampaignList(params), { formatResult: true })
     const syncAjax = useAjax((adAccountId) => putAdqCampaignPage(adAccountId))
+    const switchAjax = useAjax((params) => putAdqCampaignConfigStatus(params))
     console.log('创意=====》')
     useEffect(() => {
         getList({ pageNum: 1, pageSize: 20 })
@@ -45,9 +46,18 @@ function Campaign(props: { accountId: string, adAccountId: string, userId: strin
 
         })
     }, [adAccountId, listAjax])
+      // 启停
+      const switchHandle=useCallback((data,checked)=>{
+        let { accountId,campaignId}=data
+        let configuredStatus = checked ? 'AD_STATUS_NORMAL' : 'AD_STATUS_SUSPEND'
+        switchAjax.run({accountId,campaignId,configuredStatus}).then(res=>{
+            res && listAjax.refresh()
+            res ? message.success(checked?'开启计划成功!':'关闭计划成功!') : message.error(checked?'开启计划失败':'关闭计划失败!')
+        })
+    },[])
     return <div>
         <TableData
-            columns={tableConfig}
+             columns={()=>tableConfig(switchHandle)}
             ajax={listAjax}
             syncAjax={sync}
             dataSource={listAjax?.data?.data?.records}

+ 5 - 3
src/pages/launchSystemNew/adq/campaign/tableConfig.tsx

@@ -1,7 +1,7 @@
 import {  CampaignTypeEnum, ConfiguredStatusEnum, PromotedObjectType, SpeedMode } from '@/services/launchAdq/enum'
 import { Badge,Switch } from 'antd'
 import React from 'react'
-function tableConfig():any{
+function tableConfig(switchHandle:(data:any,Status:any)=>void):any{
     return [
         {
             title: '启停',
@@ -10,8 +10,10 @@ function tableConfig():any{
             align: 'center',
             width:50,
             fixed:'left',
-            render:(a:string)=>{
-                return <Switch /> 
+            render:(a:string,b:any)=>{
+                return <Switch defaultChecked={b?.configuredStatus=== 'AD_STATUS_NORMAL'} onChange={(checked:boolean)=>{
+                    switchHandle(b,checked)
+                }}/> 
             }
         },
         {

+ 2 - 2
src/pages/launchSystemNew/adq/creative/index.tsx

@@ -1,8 +1,8 @@
 
 import { useAjax } from '@/Hook/useAjax'
 import { PromotedObjectType } from '@/services/launchAdq/enum'
-import { Col, Row, Input, Select, Button, message } from 'antd'
-import React, { useEffect, useState, useCallback } from 'react'
+import { Col, Row, Input, Select, message } from 'antd'
+import React, { useEffect, useCallback } from 'react'
 import TableData from '../../components/TableData'
 import tableConfig from './tableConfig'
 import { getAdqAdcreativeList, putAdqTargetingSyncAll } from '@/services/launchAdq/adq'

+ 1 - 2
src/pages/launchSystemNew/adq/creative/tableConfig.tsx

@@ -1,6 +1,5 @@
-import { CreativeTemplateVersionTypeEnum, HeadClickTypeEnum, LinkPageNameTypeEnum, LinkPageTypeEnum, PageTypeEnum, PromotedObjectType, SourceEnum } from '@/services/launchAdq/enum'
+import {  LinkPageTypeEnum, PromotedObjectType } from '@/services/launchAdq/enum'
 import React from 'react'
-import { Space } from 'antd'
 function tableConfig(): any {
     return [
         {

+ 2 - 2
src/pages/launchSystemNew/adq/landingPage/tableConfig.tsx

@@ -1,6 +1,6 @@
-import { CanvasTypeEnum, PageStatusEnum, PageTypeEnum, PromotedObjectType, SourceTypeEnum, VideoResourceStatusEnum } from '@/services/launchAdq/enum'
+import {  PageStatusEnum, PageTypeEnum, SourceTypeEnum } from '@/services/launchAdq/enum'
 import React from 'react'
-import { Badge, Space } from 'antd'
+import { Badge } from 'antd'
 function tableConfig(): any {
     return [
         {

+ 1 - 1
src/pages/launchSystemNew/adq/targeting/index.tsx

@@ -1,4 +1,4 @@
-import React, { useEffect, useCallback, useState } from 'react'
+import React, { useEffect, useCallback } from 'react'
 import { Col, Input, message, Row } from 'antd'
 import { useAjax } from '@/Hook/useAjax'
 import { getAdqTargetingList, putAdqTargetingSyncAll } from '@/services/launchAdq/adq'

+ 8 - 8
src/pages/launchSystemNew/components/addLandingPage/index.tsx

@@ -140,28 +140,28 @@ function AddLandingPage(props: Props) {
             setIsFootlock(() => false)
             if (selectData?.adLocation === 'sns') { // 朋友圈信息流
                 if (selectData?.outerStyle === 0) { // 常规广告
-                    init({ mediaType: 'IMG', cloudSize: [[{ relation: '=', width: 800, height: 800 }]] })
+                    init({ mediaType: 'IMG', cloudSize: [[{ relation: '=', width: 800, height: 800 }]],maxSize:300*1024 })
                 } else { // 卡片广告
-                    init({ mediaType: 'IMG', cloudSize: [[{ relation: '=', width: 800, height: 450 }]] })
+                    init({ mediaType: 'IMG', cloudSize: [[{ relation: '=', width: 800, height: 450 }]],maxSize:300*1024})
                 }
             } else { // 公众号及其他
-                init({ mediaType: 'IMG', cloudSize: [[{ relation: '=', width: 800, height: 800 }], [{ relation: '=', width: 800, height: 450 }], [{ relation: '=', width: 800, height: 640 }], [{ relation: '=', width: 640, height: 800 }]] })
+                init({ mediaType: 'IMG', cloudSize: [[{ relation: '=', width: 800, height: 800 }], [{ relation: '=', width: 800, height: 450 }], [{ relation: '=', width: 800, height: 640 }], [{ relation: '=', width: 640, height: 800 }]] ,maxSize:300*1024})
             }
         } else if (selectData?.elementType === 'IMAGE') { // 内容图片
             setIsFootlock(() => false)
-            init({ mediaType: 'IMG', cloudSize: [[{ relation: '=', width: 750, height: null }, { relation: '<=', width: null, height: 1536 }]] })
+            init({ mediaType: 'IMG', cloudSize: [[{ relation: '=', width: 750, height: null }, { relation: '<=', width: null, height: 1536 }]],maxSize:300*1024 })
         } else if (selectData?.elementType === 'TOP_SLIDER') { // 轮播图
-            init({ mediaType: 'IMG', num: selectData?.imageUrlList?.length || 3, cloudSize: [[{ relation: '=', width: 800, height: 800 }]] })
+            init({ mediaType: 'IMG', num: selectData?.imageUrlList?.length || 3, cloudSize: [[{ relation: '=', width: 800, height: 800 }]],maxSize:300*1024 })
             setIsFootlock(() => false)
         } else if (selectData?.elementType === 'TOP_VIDEO') { // 视频
             if (selectData?.adLocation === 'sns') { // 朋友圈信息流
                 if (selectData?.outerStyle === 0) { // 常规广告
-                    init({ mediaType: 'VIDEO', cloudSize: [[{ relation: '=', width: 640, height: 480 }], [{ relation: '=', width: 640, height: 360 }], [{ relation: '=', width: 750, height: 1334 }], [{ relation: '=', width: 720, height: 1280 }] ] })
+                    init({ mediaType: 'VIDEO', cloudSize: [[{ relation: '=', width: 640, height: 480 }], [{ relation: '=', width: 640, height: 360 }], [{ relation: '=', width: 750, height: 1334 }], [{ relation: '=', width: 720, height: 1280 }] ],maxSize:20*1024*1024  })
                 } else { // 卡片广告
-                    init({ mediaType: 'VIDEO', cloudSize: [[{ relation: '=', width: 750, height: null }, { relation: '<=', width: null, height: 1536 }]] })
+                    init({ mediaType: 'VIDEO', cloudSize: [[{ relation: '=', width: 750, height: null }, { relation: '<=', width: null, height: 1536 }]],maxSize:20*1024*1024 })
                 }
             } else { // 公众号及其它
-                init({ mediaType: 'VIDEO', cloudSize: [[{ relation: '=', width: 750, height: null }, { relation: '<=', width: null, height: 1536 }]] })
+                init({ mediaType: 'VIDEO', cloudSize: [[{ relation: '=', width: 750, height: null }, { relation: '<=', width: null, height: 1536 }]],maxSize:20*1024*1024  })
                 setIsFootlock(() => false)
             }
         } else if (selectData?.elementType === 'shelfnew') {  // 图文复合组件 1个

+ 5 - 4
src/pages/launchSystemNew/launchManage/localAd/creative/modal.tsx

@@ -469,7 +469,7 @@ function CreativeModal(props: Props) {
                                     {/* 视频 */}
                                     {
                                         (item.name === 'short_video1' || item.name === 'video') && <div className={`${styles.box} ${styles.video}`} onClick={() => {
-                                            init({ mediaType: 'VIDEO', cloudSize:adcreativeTemplateId === 1708 ?  [[{ relation: '=', width: 1280, height: 720 }]]:[[{ 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 }]],maxSize:item.restriction.videoRestriction.fileSize *1024})
                                             setTimeout(() => {
                                                 set_selectImgVisible(true)
                                                 setMaterialConfig({
@@ -493,7 +493,7 @@ function CreativeModal(props: Props) {
                                     {/* 单图 */}
                                     {
                                         item.name === 'image' && <div className={`${styles.box} ${styles.image}`} onClick={() => {
-                                            init({ mediaType: 'IMG', cloudSize: [[{ relation: '=', width: item.restriction.imageRestriction.width, height: item.restriction.imageRestriction.height }]] })
+                                            init({ mediaType: 'IMG', cloudSize: [[{ relation: '=', width: item.restriction.imageRestriction.width, height: item.restriction.imageRestriction.height }]],maxSize:item.restriction.imageRestriction.fileSize *1024 })
                                             setTimeout(() => {
                                                 set_selectImgVisible(true)
                                                 setMaterialConfig({
@@ -517,7 +517,7 @@ function CreativeModal(props: Props) {
                                     {/* 多图 */}
                                     {
                                         item.name === 'image_list' && <div className={`${styles.box} ${item.arrayProperty.maxNumber >= 3 ? styles.image_list : styles.image}`} onClick={() => {
-                                            init({ mediaType: 'IMG', num: item.arrayProperty.maxNumber, cloudSize: [[{ relation: '=', width: item.restriction.imageRestriction.width, height: item.restriction.imageRestriction.height }]] })
+                                            init({ mediaType: 'IMG', num: item.arrayProperty.maxNumber, cloudSize: [[{ relation: '=', width: item.restriction.imageRestriction.width, height: item.restriction.imageRestriction.height }]],maxSize:item.restriction.imageRestriction.fileSize *1024 })
                                             setTimeout(() => {
                                                 set_selectImgVisible(true)
                                                 setMaterialConfig({
@@ -586,9 +586,10 @@ function CreativeModal(props: Props) {
                         }
                         {//过滤了不必传和品牌名称,品牌标识图(外部传)短视频结构(组装使用)
                             adcreative_template?.adcreativeElements?.filter(item => item.required && item.name === 'description').map(item => {
+                                let maxNum=adcreativeTemplateId === 1708? 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,${item.restriction.textRestriction.maxLength}}`)), message: '请输入正确的' + item.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 }}

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

@@ -184,3 +184,23 @@ export async function getAdqTargetingList(params: {
   });
 }
 
+/**
+ * 计划启停
+ * @param adAccountId 本地ID
+ */
+ export async function putAdqCampaignConfigStatus(params: any) {
+   let {accountId,campaignId,configuredStatus}=params
+  return request(api + `/adq/campaign/configStatus/${accountId}/${campaignId}/${configuredStatus}`, {
+    method: 'PUT',
+  });
+}
+/**
+ * 广告启停
+ * @param adAccountId 本地ID
+ */
+ export async function putAdqAdgroupsConfigStatus(params: any) {
+   let {accountId,adgroupId,configuredStatus}=params
+  return request(api + `/adq/campaign/configStatus/${accountId}/${adgroupId}/${configuredStatus}`, {
+    method: 'PUT',
+  });
+}