Sfoglia il codice sorgente

Merge branch 'master' of http://git.zanxiangnet.com/wjx/ad-manage

shenwu 2 anni fa
parent
commit
d7408f0b0f

+ 1 - 1
src/pages/launchSystemNew/account/groupLeft.tsx

@@ -113,7 +113,7 @@ const GroupLeft: React.FC<Props> = (props) => {
                         </div>
                     </div>
                 </div>
-                {getGroupList && getGroupList?.data?.map((item: { groupName: string, groupId: number }, index: number) => <div className="groupLeft_content_item" key={item.groupId || index}>
+                {getGroupList && Array.isArray(getGroupList?.data) && getGroupList?.data?.map((item: { groupName: string, groupId: number }, index: number) => <div className="groupLeft_content_item" key={item.groupId || index}>
                     {groupData?.groupId && groupData?.groupId === item?.groupId ? <div className="edit stop">
                         <Space direction="vertical" className="stop">
                             <Space className="stop">

+ 1 - 1
src/pages/launchSystemNew/account/index.tsx

@@ -69,7 +69,7 @@ const AdAuthorize: React.FC = () => {
 
     useEffect(() => {
         getList()
-    }, [])
+    }, [queryForm])
 
     /** 获取账号列表 */
     const getList = () => {

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

@@ -43,7 +43,7 @@ function AdAccount(props: Props) {
     const syncAjax = useAjax((params) => putAdqAdAccountSyncByIds(params))
     useEffect(() => {
         getList(queryForm)
-    }, [accountId])
+    }, [accountId, userId])
     // 获取列表
     const getList = useCallback((params?: any) => {
         listAjax.run({ ...params, putUserId: userId })

+ 20 - 10
src/pages/launchSystemNew/launchManage/createAd/index.tsx

@@ -89,7 +89,6 @@ const CreateAd: React.FC = () => {
     useEffect(() => {
         getGroupList.run()
     }, [])
-  
 
     /** 判断出价方式,优化目标 “二方包”人群包仅能在出价方式为CPC(包含oCPM点击优化目标)、CPM场景下使用 */
     // useEffect(() => {
@@ -141,7 +140,7 @@ const CreateAd: React.FC = () => {
                         type = 1
                     }
                 } else {
-                    if (adCreateLogs?.every((item: { sysAdcreative: { adcreativeTemplateId: number }, pageId: number }) => item.sysAdcreative.adcreativeTemplateId === adcreativeTemplateId && item.pageId === pageId)) {
+                    if (adCreateLogs?.every((item: { sysAdcreative: { adcreativeTemplateId: number }, pageId: number }) => item.sysAdcreative.adcreativeTemplateId === adcreativeTemplateId)) {
                         type = 2
                     } else {
                         type = 1
@@ -219,11 +218,17 @@ const CreateAd: React.FC = () => {
                         pageList = [null]
                     }
                     if (adCreateLog?.pageId) {
-                        adqPageList = [[{
-                            pageList: [{ ...adCreateLog.page, id: adCreateLog.page.pageId }],
-                            adAccountId: adCreateLog?.accountId,
-                            id: adCreateLog?.adAccountId,
-                        }]]
+                        adqPageList = groupBy(adCreateLogs, (item) => [item.sysAdcreativeId])?.map((item: any[]) => {
+                            if (item.some((item1: { pageId: number }) => item1.pageId)) {
+                                return item.map((item1: any) => ({
+                                    pageList: [{ ...item1.page, id: item1.page.pageId }],
+                                    adAccountId: item1?.accountId,
+                                    id: item1?.adAccountId,
+                                }))
+                            } else {
+                                return null
+                            }
+                        })
                     } else {
                         adqPageList = [null]
                     }
@@ -844,6 +849,7 @@ const CreateAd: React.FC = () => {
                     })
                     setAccountCreateLogs(userArr?.map((item) => ({ adAccountId: item?.accountId, id: item.id })))
                     clearData()
+                    setQueryForm({ ...queryForm, adqPageList: [], pageList: [], taskMediaMaps: queryForm?.taskMediaMaps?.map((item: { sysPageId: number }) => ({ ...item, sysPageId: '', accountPageIdMap: {}, cropUserGroupMap: [] })) })
                 } else {
                     message.error('操作异常')
                 }
@@ -852,7 +858,8 @@ const CreateAd: React.FC = () => {
             setAccountCreateLogs([])
         }
     }
-
+    console.log('accountCreateLogs', accountCreateLogs);
+    
     return <Space direction="vertical" style={{ width: '100%' }}>
         <Card
             title={<Space>
@@ -895,6 +902,9 @@ const CreateAd: React.FC = () => {
                         maxTagCount={1}
                         allowClear
                         bordered={false}
+                        maxTagPlaceholder={<Tooltip color="#FFF" title={accountCreateLogs.filter((item, index) => index !== 0).map(item => <div key={item.id} style={{ color: '#000' }}>{item.adAccountId}</div>)}>
+                            <span>+{accountCreateLogs?.length > 1 ? accountCreateLogs.length - 1 : 0}</span>
+                        </Tooltip>}
                         dropdownMatchSelectWidth={false}
                         filterOption={(input: any, option: any) => {
                             return option!.children?.toString().toLowerCase().includes(input.toLowerCase())
@@ -903,11 +913,11 @@ const CreateAd: React.FC = () => {
                         onChange={(e, option) => {
                             console.log(option)
                             setQueryForm({ ...queryForm, adqPageList: [], pageList: [], taskMediaMaps: queryForm?.taskMediaMaps?.map((item: { sysPageId: number }) => ({ ...item, sysPageId: '', accountPageIdMap: {}, cropUserGroupMap: [] })) })
-                            setAccountCreateLogs(option?.map((item: any) => ({ adAccountId: item?.children?.toString()?.split('——')[0], id: item?.value })))
+                            setAccountCreateLogs(option?.map((item: any) => ({ adAccountId: item?.children?.toString()?.split('_')[0], id: item?.value })))
                             clearData()
                         }}
                     >
-                        {getAllUserAccount?.data?.data?.map((item: any) => <Select.Option value={item.id} key={item.id}>{item.remark ? item.accountId + '——' + item.remark : item.accountId}</Select.Option>)}
+                        {getAllUserAccount?.data?.data?.map((item: any) => <Select.Option value={item.id} key={item.id}>{item.remark ? item.accountId + '_' + item.remark : item.accountId}</Select.Option>)}
                     </Select>
                 </Selector>
                 <Selector label="推广目标">