Przeglądaj źródła

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

wjx 2 lat temu
rodzic
commit
233bef947c

+ 12 - 11
src/pages/launchSystemNew/adq/ad/copy.tsx

@@ -52,7 +52,7 @@ const Copy: React.FC<Props> = (props) => {
 
             delete newValues?.date
             delete newValues?.dateType
-            if(newValues?.bidAmount){
+            if (newValues?.bidAmount) {
                 newValues.bidAmount = newValues.bidAmount * 100
             }
             console.log(newValues);
@@ -96,7 +96,8 @@ const Copy: React.FC<Props> = (props) => {
                 timeSeries: getTimeSeriesList(),
                 firstDayBeginTime: moment('2023-02-24 00:00:00'),
                 copyCount: 1,
-                isCopyAdcreative:true
+                configuredStatus: null,
+                isCopyAdcreative: true
             }}
         >
             <Form.Item label={<strong>投放日期</strong>} name='dateType'>
@@ -147,17 +148,17 @@ const Copy: React.FC<Props> = (props) => {
                 </Space>
             </Form.Item>
             <Form.Item label={<strong>广告出价</strong>} name={"bidAmount"}>
-                        <InputNumber  min={0} placeholder="价格 元"/>
+                <InputNumber min={0} placeholder="价格 元" />
             </Form.Item>
-            <Form.Item label={<strong>广告启停</strong>} name={"configuredStatus"}>
-                        <Select style={{width:100}}>
-                            <Select.Option key={null} value={null}>默认</Select.Option>
-                            <Select.Option key={"AD_STATUS_NORMAL"} value={"AD_STATUS_NORMAL"}>开启</Select.Option>
-                            <Select.Option key={"AD_STATUS_SUSPEND"} value={"AD_STATUS_SUSPEND"}>关闭</Select.Option>
-                        </Select>
+            <Form.Item label={<strong>广告启停</strong>} name={"configuredStatus"} tooltip="默认:沿用选择广告的启停状态,开启or关闭:复制的所有广告设置成开启or关闭">
+                <Select style={{ width: 100 }}>
+                    <Select.Option key={null} value={null}>默认</Select.Option>
+                    <Select.Option key={"AD_STATUS_NORMAL"} value={"AD_STATUS_NORMAL"}>开启</Select.Option>
+                    <Select.Option key={"AD_STATUS_SUSPEND"} value={"AD_STATUS_SUSPEND"}>关闭</Select.Option>
+                </Select>
             </Form.Item>
-            <Form.Item label={<strong>是否复制创意</strong>} name={"isCopyAdcreative"} valuePropName="checked"  >
-                <Switch checkedChildren="是" unCheckedChildren="否"  />
+            <Form.Item label={<strong>是否复制创意</strong>} name={"isCopyAdcreative"} valuePropName="checked" tooltip="选择“是”,新建创意,复制条数不限制;选择”否“沿用旧创意,复制条数限制26条。">
+                <Switch checkedChildren="是" unCheckedChildren="否" />
             </Form.Item>
             <Form.Item label={<strong>复制数量</strong>} name='copyCount' rules={[{ required: true, message: '请输入复制数量' }]}>
                 <InputNumber min={1} />

+ 34 - 14
src/pages/launchSystemNew/launchManage/createAd/creative/index.tsx

@@ -1,5 +1,5 @@
 import React, { useCallback, useState } from 'react'
-import { Col, Space, Spin, Tabs, Tooltip, } from 'antd'
+import { Button, Col, Space, Spin, Tabs, Tooltip, } from 'antd'
 import style from '../index.less'
 import CreativeModal from "../../../components/creativeModal"
 import { CreateAdProps } from '@/services/launchAdq/createAd'
@@ -7,6 +7,7 @@ import { BaseResult } from '@ahooksjs/use-request/lib/types'
 import { ModalConfig } from '../ad'
 import AdcreativeCol from "../adcreativeCol"
 import CreativePup from './modal'
+import { CopyOutlined } from '@ant-design/icons'
 
 type Props = {
     queryForm: Partial<CreateAdProps>,
@@ -67,6 +68,17 @@ function Creative(props: Props) {
             }
         }
     }, [queryForm])
+
+    // 复制当前创意
+    const copyBefore = () => {
+        if (queryForm.taskMediaMaps) {
+            let taskMediaMaps = queryForm.taskMediaMaps
+            let taskMediaMap = queryForm.taskMediaMaps[targetKey]
+            taskMediaMaps.push(JSON.parse(JSON.stringify(taskMediaMap)))
+            setQueryForm({ ...queryForm, taskMediaMaps: taskMediaMaps })
+        }
+    }
+
     return <Col span={12} className={style.conRightBorder}>
         <div className={style.top}>创意基本信息
             {queryForm.taskMediaMaps && queryForm.taskMediaMaps?.length > 0 && <a onClick={() => {
@@ -75,20 +87,28 @@ function Creative(props: Props) {
             }}>全部清空</a>}
         </div>
         <div className={style.center}>
-            <Tabs size={'small'} onEdit={onEdit} type="editable-card" activeKey={targetKey} onChange={(key) => { set_targetKey(key) }} >
-                {
-                    queryForm?.taskMediaMaps?.map((item, index) => {
-                        return <Tabs.TabPane key={index} tab={'创意' + (index + 1)}>
-                            <Spin spinning={getSysAdcreative.loading}>
-                                <div className={style.centerContent}>
-                                    {item?.sysAdcreative && <AdcreativeCol data={item.sysAdcreative} />}
-                                </div>
-                            </Spin>
-                        </Tabs.TabPane >
-                    })
-                }
+            <Tabs
+                size={'small'}
+                onEdit={onEdit}
+                type="editable-card"
+                activeKey={targetKey}
+                tabBarExtraContent={queryForm.taskMediaMaps?.[targetKey]?.sysAdcreative ? {
+                    right: <Tooltip title="复制当前创意">
+                        <Button icon={<CopyOutlined />} style={{ marginLeft: 4 }} type="link" onClick={copyBefore}></Button>
+                    </Tooltip>
+                } : {}}
+                onChange={(key) => { set_targetKey(key) }}
+            >
+                {queryForm?.taskMediaMaps?.map((item, index) => {
+                    return <Tabs.TabPane key={index} tab={'创意' + (index + 1)}>
+                        <Spin spinning={getSysAdcreative.loading}>
+                            <div className={style.centerContent}>
+                                {item?.sysAdcreative && <AdcreativeCol data={item.sysAdcreative} />}
+                            </div>
+                        </Spin>
+                    </Tabs.TabPane>
+                })}
             </Tabs>
-
         </div>
         <div className={style.bottom}>
             <Space size={20}>

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

@@ -566,8 +566,6 @@ const CreateAd: React.FC = () => {
                 data.push(obj)
             })
         })
-        console.log(data);
-        
         setTableData(data)
     }