wjx 6 miesięcy temu
rodzic
commit
db5aac8b74

+ 10 - 9
src/pages/launchSystemV3/tencentAdPutIn/create/Dynamic/SelectBarrage.tsx

@@ -5,8 +5,8 @@ import React, { useEffect, useState } from "react"
 
 interface Props {
     arrayProperty: { maxNumber: number, minNumber: number }
-    value?: { text: string, id: number }[]
-    onChange?: (value?: { text: string, id: number }[]) => void
+    value?: { text: string }[]
+    onChange?: (value?: { text: string }[]) => void
     putInType?: 'NOVEL' | 'GAME'
 }
 
@@ -18,7 +18,7 @@ interface Props {
 const SelectBarrage: React.FC<Props> = ({ arrayProperty, value = [], onChange, putInType }) => {
 
     /****************************************/
-    const [barrageList, setBarrageList] = useState<{ text: string, id: number }[]>([])
+    const [barrageList, setBarrageList] = useState<string[]>([])
 
     const getBarrageRecommendList = useAjax((params) => getBarrageRecommendListApi(params))
     /****************************************/
@@ -26,14 +26,16 @@ const SelectBarrage: React.FC<Props> = ({ arrayProperty, value = [], onChange, p
     useEffect(() => {
         getBarrageRecommendList.run({ taskType: putInType }).then(res => {
             if (res?.list?.length) {
-                setBarrageList(res?.list || [])
+                const setBarrage = new Set(res?.list.map((item: { text: string }) => item.text))
+                const arrayBarrage = [...setBarrage]
+                setBarrageList(arrayBarrage as string[])
             } else {
                 setBarrageList([])
             }
         })
     }, [putInType])
 
-    let barrageValue = value?.map(item => item.id)
+    let barrageValue = value?.map(item => item.text)
     return <div
         style={{
             border: '1px solid #d9d9d9',
@@ -47,19 +49,18 @@ const SelectBarrage: React.FC<Props> = ({ arrayProperty, value = [], onChange, p
         <Select
             showSearch
             placeholder="请选择弹幕"
-            onChange={(_, options) => {
-                onChange?.(options?.length > 0 ? options.map((item: { text: any; value: any }) => ({ text: item.text, id: item.value })) : [])
+            onChange={(e) => {
+                onChange?.(e?.length > 0 ? e.map(item => ({ text: item })) : [])
             }}
             value={barrageValue}
             mode="multiple"
             filterOption={(input, option) =>
                 ((option?.label ?? '') as any).toLowerCase().includes(input.toLowerCase())
             }
-            allowClear
             loading={getBarrageRecommendList.loading}
             bordered={false}
         >
-            {barrageList.map((item: { text: string, id: number }) => <Select.Option key={item.id} value={item.id} text={item.text} disabled={barrageValue?.length > arrayProperty.maxNumber && !barrageValue.includes(item.id)}>{item.text}</Select.Option>)}
+            {barrageList.map((item: string, index: number) => <Select.Option key={index} value={item} disabled={barrageValue?.length > arrayProperty.maxNumber && !barrageValue.includes(item)}>{item}</Select.Option>)}
         </Select>
         <div
             style={{

+ 1 - 1
src/pages/launchSystemV3/tencentAdPutIn/create/index.tsx

@@ -927,7 +927,7 @@ const Create: React.FC = () => {
                                 </>
                             )}
                         >
-                            {getAllUserAccount?.data?.data?.filter((item: any) => putInType === 'NOVEL' ? ['NOVEL', 'NOVEL_IAA'].includes(item.adUnitType) : putInType === 'GAME' ? ['GAME', 'GAME_IAA'].includes(item.adUnitType) : false)?.map((item: any) => <Select.Option value={item.accountId} key={item.id}>{item.remark ? item.accountId + '_' + item.remark : item.accountId}</Select.Option>)}
+                            {getAllUserAccount?.data?.data?.filter((item: any) => putInType === 'NOVEL' ? (['NOVEL', 'NOVEL_IAA'].includes(item.adUnitType) || !item.adUnitType) : putInType === 'GAME' ? ['GAME', 'GAME_IAA'].includes(item.adUnitType) : false)?.map((item: any) => <Select.Option value={item.accountId} key={item.id}>{item.remark ? item.accountId + '_' + item.remark : item.accountId}</Select.Option>)}
                         </Select>
                     </Selector>
 

+ 2 - 1
src/services/adqV3/global.ts

@@ -679,7 +679,8 @@ export async function getGameLibraryAppIdDetailApi(wxGameAppId: number) {
  * @returns 
  */
 export async function getBarrageRecommendListApi(params: { adAccountId?: number, taskType?: 'GAME' | 'NOVEL' }) {
-    return request(api + `/adq/v3/launch/tools//creative/tools/barrage`, {
+    // return request(api + `/adq/v3/launch/tools/creative/tools/barrage`, {
+    return request(api + `/adq/v3/launch/tools/creative/tools/barrageRecommend`, {
         method: 'GET',
         params
     })