wjx 2 rokov pred
rodič
commit
f9b5e2c1bb

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

@@ -42,7 +42,7 @@ import {
 } from './sortable'
 import { useModel } from 'umi'
 import SelectCloud from '../selectCloud'
-import { getTypeKey, txtLength } from '@/utils/utils'
+import { getTypeKey, replaceSpecialTxt, txtLength } from '@/utils/utils'
 
 const { Option } = Select;
 
@@ -964,10 +964,10 @@ function AddLandingPage(props: Props) {
                                     <div className="form section">
                                         <div className="form-caption">推广文案</div>
                                         <TextArea
-                                            placeholder="请输入"
+                                            placeholder={`请输入(不包含<>&'"/\以及TAB、换行、回车键)`}
                                             autoSize={{ minRows: 4, maxRows: 6 }}
                                             value={text}
-                                            onChange={(e) => { setCon('text', e.target.value) }}
+                                            onChange={(e) => { setCon('text', replaceSpecialTxt(e.target.value)) }}
                                         />
                                     </div>
                                     <div className="form section">

+ 30 - 18
src/pages/launchSystemNew/launchManage/createAd/creative/modal/index.tsx

@@ -51,6 +51,7 @@ function CreativePup(props: Props) {
     const [endPageDescShow, setendPageDescnshow] = useState(false)
     const [isShowSc, set_isShowSc] = useState(false)//是否展示素材选项
     const [infoSet, set_infoSet] = useState(false)//回填设置已完成
+    const [isShowXd, setIsShowXd] = useState(false)
     const [videoImgs, set_videoImgs] = useState<{//视频封面图设置
         activeUrl: string,//选中的视频封面图地址
         preview: boolean,//是否开启图片点击预览
@@ -277,24 +278,18 @@ function CreativePup(props: Props) {
                 campaignType: 'CAMPAIGN_TYPE_NORMAL',
             }).then(res => {
                 let newArr: any = []
+                let newData: any[] = []
                 // 过滤掉相同的和即将下线的
                 if (!res) {
                     return
                 }
                 // 
                 Object.values(res)?.forEach((arr: any) => {
+                    newData.push(arr)
                     Array.isArray(arr) && arr?.forEach((item: any) => {
                         if (newArr.length > 0) {//假如已存在ID,需要过滤相同
                             if (outAdcreativeTemplateIdFun(item.adcreativeTemplateId) && newArr.every((i: { adcreativeTemplateId: any }) => i.adcreativeTemplateId !== item.adcreativeTemplateId)) {//不重复的添加
                                 newArr.push(item)
-                            } else {
-                                // 找出通用创意
-                                newArr = newArr?.map((arr: { adcreativeTemplateId: any }) => {
-                                    if (arr.adcreativeTemplateId === item.adcreativeTemplateId) {
-                                        return { ...arr, isGeneral: true }
-                                    }
-                                    return arr
-                                })
                             }
                         } else {//不存在ID直接过滤掉即将下线的
                             if (outAdcreativeTemplateIdFun(item.adcreativeTemplateId)) {
@@ -307,12 +302,21 @@ function CreativePup(props: Props) {
                 if (siteSet.some((i: string) => i === 'SITE_SET_MOMENTS')) {
                     newArr = newArr.filter((item: { adcreativeTemplateId: number }) => item.adcreativeTemplateId !== 910 && item.adcreativeTemplateId !== 925)
                 }
-                set_adcreative_template_list(newArr)
+                let newArr1: any[] = []
+                let newArr2: any[] = []
+                newArr?.forEach((arr: { adcreativeTemplateId: any, isGeneral?: boolean }) => {
+                    if (newData.every((item: { adcreativeTemplateId: any }[]) => item.find(i => i.adcreativeTemplateId === arr.adcreativeTemplateId))) {
+                        newArr1.push({ ...arr, isGeneral: true })
+                    } else {
+                        newArr2.push(arr)
+                    }
+                })
+                set_adcreative_template_list([...newArr1, ...newArr2])
             })
         }
     }, [siteSet, promotedObjectType])
     // 获取创意形式详情
-    const getTemplate = useCallback((id: any, ok?: any) => {
+    const getTemplate = (id: any, ok?: any) => {
         // CAMPAIGN_TYPE_NORMAL
         if (siteSet?.length > 0 && promotedObjectType && id) {
             if (id) {
@@ -336,7 +340,7 @@ function CreativePup(props: Props) {
                 })
             }
         }
-    }, [siteSet, promotedObjectType])
+    }
     // 获取对应落地页按钮
     const pageTypeList = useMemo(() => {
         if (adcreativeTemplateId) {
@@ -373,7 +377,7 @@ function CreativePup(props: Props) {
     }, [adcreative_template_list])
 
     //每次选中创意设置该展示的界面
-    const templateChange = useCallback((adcreative_template, ok?: any) => {
+    const templateChange = (adcreative_template: any, ok?: any) => {
         let states = {
             kp_show: false,
             xd_show: true,
@@ -405,7 +409,8 @@ function CreativePup(props: Props) {
 
             //行动按钮组件存在
             if (states.xd_show) {
-                let linkNameList = (pageList?.filter((item: { pageType: any; }) => item.pageType === pageType)[0] as any)?.supportLinkNameType?.list
+                let supportLinkNameTypeData = (pageList?.filter((item: { pageType: any; }) => item.pageType === pageType)[0] as any)?.supportLinkNameType
+                let linkNameList = supportLinkNameTypeData?.list
                 let linkPageList = (pageList?.filter((item: { pageType: any; }) => item.pageType === pageType)[0] as any)?.supportLinkPageType?.list
                 if (linkNameList && !linkPageType) {
                     if (!ok) {
@@ -416,6 +421,13 @@ function CreativePup(props: Props) {
                 } else {
                     states = { ...states, xd_show: false }
                 }
+                if (supportLinkNameTypeData?.required) {
+                    states = { ...states, xd_show: true }
+                    values = { ...values, actionBtn: true }
+                    setIsShowXd(true)
+                } else {
+                    setIsShowXd(false)
+                }
             }
             // 特殊行动按钮
             if (adcreative_template.adcreativeElements?.find((item: { name: string }) => item.name === 'button_text') && !ok) {
@@ -432,7 +444,7 @@ function CreativePup(props: Props) {
             setPupState(states)
             form.setFieldsValue(values)
         }
-    }, [pageType, linkPageType])
+    }
     // 版位改变清空数据
     useEffect(() => {
         if (imgMaterialConfig.adcreativeTemplateId && adcreativeTemplateId !== imgMaterialConfig.adcreativeTemplateId) {
@@ -884,8 +896,8 @@ function CreativePup(props: Props) {
                         }
                         {/* ============================================================普通行动按钮============================================================= */}
                         {
-                            pupState.xd_show && <Form.Item label={<strong>行动按钮</strong>} name='actionBtn' valuePropName="checked">
-                                <Switch checkedChildren="开启" unCheckedChildren="关闭" />
+                            pupState.xd_show && <Form.Item hidden={isShowXd} label={<strong>行动按钮</strong>} name='actionBtn' valuePropName="checked">
+                                <Switch checkedChildren="开启" unCheckedChildren="关闭" disabled={isShowXd}/>
                             </Form.Item>
                         }
                         {
@@ -933,14 +945,14 @@ function CreativePup(props: Props) {
                         }
                         {/* ============================================================特殊行动按钮============================================================= */}
                         {
-                            adcreative_template?.adcreativeElements?.find(item => item.name === 'button_text') && <Form.Item label={<strong>行动按钮</strong>} >
+                            !pupState.xd_show && 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: '请选择按钮文案!' }]}>
+                            !pupState.xd_show && 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>

+ 34 - 18
src/pages/launchSystemNew/launchManage/createAd/creativeCL/modal/index.tsx

@@ -51,6 +51,7 @@ function CreativePup(props: Props) {
     const [textData, setTextData] = useState<any[]>([])
     const [isShowSc, set_isShowSc] = useState(false)//是否展示素材选项
     const [infoSet, set_infoSet] = useState(false)//回填设置已完成
+    const [isShowXd, setIsShowXd] = useState(false)
     const [videoImgs, set_videoImgs] = useState<{//视频封面图设置
         activeUrl: string,//选中的视频封面图地址
         preview: boolean,//是否开启图片点击预览
@@ -277,24 +278,18 @@ function CreativePup(props: Props) {
                 campaignType: 'CAMPAIGN_TYPE_NORMAL',
             }).then(res => {
                 let newArr: any = []
+                let newData: any[] = []
                 // 过滤掉相同的和即将下线的
                 if (!res) {
                     return
                 }
                 // 
                 Object.values(res)?.forEach((arr: any) => {
+                    newData.push(arr)
                     Array.isArray(arr) && arr?.forEach((item: any) => {
                         if (newArr.length > 0) {//假如已存在ID,需要过滤相同
                             if (outAdcreativeTemplateIdFun(item.adcreativeTemplateId) && newArr.every((i: { adcreativeTemplateId: any }) => i.adcreativeTemplateId !== item.adcreativeTemplateId)) {//不重复的添加
                                 newArr.push(item)
-                            } else {
-                                // 找出通用创意
-                                newArr = newArr?.map((arr: { adcreativeTemplateId: any }) => {
-                                    if (arr.adcreativeTemplateId === item.adcreativeTemplateId) {
-                                        return { ...arr, isGeneral: true }
-                                    }
-                                    return arr
-                                })
                             }
                         } else {//不存在ID直接过滤掉即将下线的
                             if (outAdcreativeTemplateIdFun(item.adcreativeTemplateId)) {
@@ -307,12 +302,25 @@ function CreativePup(props: Props) {
                 if (siteSet.some((i: string) => i === 'SITE_SET_MOMENTS')) {
                     newArr = newArr.filter((item: { adcreativeTemplateId: number }) => item.adcreativeTemplateId !== 910 && item.adcreativeTemplateId !== 925)
                 }
-                set_adcreative_template_list(newArr)
+                /*****暂时排除出框形态 视频合约广告******/
+                if (siteSet.some((i: string) => i === 'SITE_SET_WECHAT')) {
+                    newArr = newArr.filter((item: { adcreativeTemplateId: number }) => item.adcreativeTemplateId !== 1945)
+                }
+                let newArr1: any[] = []
+                let newArr2: any[] = []
+                newArr?.forEach((arr: { adcreativeTemplateId: any, isGeneral?: boolean }) => {
+                    if (newData.every((item: { adcreativeTemplateId: any }[]) => item.find(i => i.adcreativeTemplateId === arr.adcreativeTemplateId))) {
+                        newArr1.push({ ...arr, isGeneral: true })
+                    } else {
+                        newArr2.push(arr)
+                    }
+                })
+                set_adcreative_template_list([...newArr1, ...newArr2])
             })
         }
     }, [siteSet, promotedObjectType])
     // 获取创意形式详情
-    const getTemplate = useCallback((id: any, ok?: any) => {
+    const getTemplate = (id: any, ok?: any) => {
         // CAMPAIGN_TYPE_NORMAL
         if (siteSet?.length > 0 && promotedObjectType && id) {
             if (id) {
@@ -348,7 +356,7 @@ function CreativePup(props: Props) {
                 })
             }
         }
-    }, [siteSet, promotedObjectType, pupState])
+    }
     // 获取对应落地页按钮
     const pageTypeList = useMemo(() => {
         if (adcreativeTemplateId) {
@@ -385,7 +393,7 @@ function CreativePup(props: Props) {
     }, [adcreative_template_list])
 
     //每次选中创意设置该展示的界面
-    const templateChange = useCallback((adcreative_template, ok?: any) => {
+    const templateChange = (adcreative_template: any, ok?: any) => {
         let states = {
             kp_show: false,
             xd_show: true,
@@ -417,7 +425,8 @@ function CreativePup(props: Props) {
 
             //行动按钮组件存在
             if (states.xd_show) {
-                let linkNameList = (pageList?.filter((item: { pageType: any; }) => item.pageType === pageType)[0] as any)?.supportLinkNameType?.list
+                let supportLinkNameTypeData = (pageList?.filter((item: { pageType: any; }) => item.pageType === pageType)[0] as any)?.supportLinkNameType
+                let linkNameList = supportLinkNameTypeData?.list
                 let linkPageList = (pageList?.filter((item: { pageType: any; }) => item.pageType === pageType)[0] as any)?.supportLinkPageType?.list
                 if (linkNameList && !linkPageType) {
                     if (!ok) {
@@ -428,6 +437,13 @@ function CreativePup(props: Props) {
                 } else {
                     states = { ...states, xd_show: false }
                 }
+                if (supportLinkNameTypeData?.required) {
+                    states = { ...states, xd_show: true }
+                    values = { ...values, actionBtn: true }
+                    setIsShowXd(true)
+                } else {
+                    setIsShowXd(false)
+                }
             }
             // 特殊行动按钮
             if (adcreative_template.adcreativeElements?.find((item: { name: string }) => item.name === 'button_text') && !ok) {
@@ -444,7 +460,7 @@ function CreativePup(props: Props) {
             setPupState(states)
             form.setFieldsValue(values)
         }
-    }, [pageType, linkPageType])
+    }
     // 版位改变清空数据
     useEffect(() => {
         if (imgMaterialConfig.adcreativeTemplateId && adcreativeTemplateId !== imgMaterialConfig.adcreativeTemplateId) {
@@ -670,8 +686,8 @@ function CreativePup(props: Props) {
                         }
                         {/* ============================================================普通行动按钮============================================================= */}
                         {
-                            pupState.xd_show && <Form.Item label={<strong>行动按钮</strong>} name='actionBtn' valuePropName="checked">
-                                <Switch checkedChildren="开启" unCheckedChildren="关闭" />
+                            pupState.xd_show && <Form.Item hidden={isShowXd} label={<strong>行动按钮</strong>} name='actionBtn' valuePropName="checked">
+                                <Switch checkedChildren="开启" unCheckedChildren="关闭" disabled={isShowXd}/>
                             </Form.Item>
                         }
                         {
@@ -713,14 +729,14 @@ function CreativePup(props: Props) {
                         }
                         {/* ============================================================特殊行动按钮============================================================= */}
                         {
-                            adcreative_template?.adcreativeElements?.find(item => item.name === 'button_text') && <Form.Item label={<strong>行动按钮</strong>} >
+                            !pupState.xd_show && 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: '请选择按钮文案!' }]}>
+                            !pupState.xd_show && 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>

+ 5 - 1
src/pages/launchSystemNew/launchManage/createAd/tableConfig.tsx

@@ -21,7 +21,11 @@ let columns = () => {
             align: 'center',
             width: 120,
             render: (a: any, b: any) => {
-                return <span style={{ fontSize: "12px" }}>{b?.sysAdGroupData?.adgroupName}</span>
+                return <div className={style.twoText}>
+                    <Tooltip title={b?.sysAdGroupData?.adgroupName}>
+                        <span style={{ fontSize: "12px" }}>{b?.sysAdGroupData?.adgroupName}</span>
+                    </Tooltip>
+                </div>
             }
         },
         {

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

@@ -63,7 +63,7 @@ function tableConfig(copyCreative: (data: any) => void, callback: (data: any) =>
             dataIndex: 'id',
             key: 'id',
             align: 'center',
-            width: 50,
+            width: 65,
             fixed: 'left'
         },
         {

+ 9 - 1
src/utils/utils.ts

@@ -145,4 +145,12 @@ export const groupBy = (array: any[], f: (item: any) => any[]) => {
   return Object.keys(groups).map(function (group) {
     return groups[group];
   });
-}  
+}
+
+export const replaceSpecialTxt = (text: string | number | null | undefined) => {
+  if (text) {
+    return text.toString().replace(/[<>&'"\//\n\s]/ig, '')
+  } else {
+    return text
+  }
+}