|
@@ -26,15 +26,18 @@ const GlobalHeaderRight: React.FC<{}> = () => {
|
|
const [productType, setProductType] = useState<string>()
|
|
const [productType, setProductType] = useState<string>()
|
|
|
|
|
|
const haveTo = (type: 'MEDIA_PLATFORM_TENCENT' | 'MEDIA_PLATFORM_OCENAENGINE') => {
|
|
const haveTo = (type: 'MEDIA_PLATFORM_TENCENT' | 'MEDIA_PLATFORM_OCENAENGINE') => {
|
|
|
|
+ let menus = initialState?.menu?.data?.find((item: { path: string; }) => item.path === "/iaaData")?.routes
|
|
|
|
+ const firstTencent = menus?.find((item: { path: string; }) => item.path === "/iaaData/tencentIaa")?.routes?.[0]?.path
|
|
|
|
+ const firstOcenaengine = menus?.find((item: { path: string; }) => item.path === "/iaaData/ocenaengineIaa")?.routes?.[0]?.path
|
|
switch (type) {
|
|
switch (type) {
|
|
case 'MEDIA_PLATFORM_TENCENT':
|
|
case 'MEDIA_PLATFORM_TENCENT':
|
|
if (!location.hash.includes('tencentIaa')) {
|
|
if (!location.hash.includes('tencentIaa')) {
|
|
- window.location.href = '/#/iaaData/tencentIaa/adList'
|
|
|
|
|
|
+ window.location.href = `/#${firstTencent}`
|
|
}
|
|
}
|
|
break
|
|
break
|
|
case 'MEDIA_PLATFORM_OCENAENGINE':
|
|
case 'MEDIA_PLATFORM_OCENAENGINE':
|
|
if (!location.hash.includes('ocenaengineIaa')) {
|
|
if (!location.hash.includes('ocenaengineIaa')) {
|
|
- window.location.href = '/#/iaaData/ocenaengineIaa/adList'
|
|
|
|
|
|
+ window.location.href = `/#${firstOcenaengine}`
|
|
}
|
|
}
|
|
break
|
|
break
|
|
}
|
|
}
|
|
@@ -44,32 +47,38 @@ const GlobalHeaderRight: React.FC<{}> = () => {
|
|
if (location.hash.includes('/iaaData')) {
|
|
if (location.hash.includes('/iaaData')) {
|
|
getAppList.run().then(res => {
|
|
getAppList.run().then(res => {
|
|
if (res?.data) {
|
|
if (res?.data) {
|
|
|
|
+ let menus = initialState?.menu?.data?.find((item: { path: string; }) => item.path === "/iaaData")?.routes
|
|
|
|
+ const firstTencent = menus?.find((item: { path: string; }) => item.path === "/iaaData/tencentIaa")?.routes?.[0]?.path
|
|
|
|
+ const firstOcenaengine = menus?.find((item: { path: string; }) => item.path === "/iaaData/ocenaengineIaa")?.routes?.[0]?.path
|
|
const productTypeSet = new Set();
|
|
const productTypeSet = new Set();
|
|
const mediaPlatformSet = new Set();
|
|
const mediaPlatformSet = new Set();
|
|
- const data: { label: string, value: string, productType: string; mediaPlatform: string; icon?: string }[] = res?.data?.map((item: { name: string; id: number; productType: string; mediaPlatform: string; icon?: string }) => {
|
|
|
|
|
|
+ const data: { label: string, value: string, productType: string; mediaPlatform: string; icon?: string }[] = res?.data?.filter((item: { mediaPlatform: string; }) => (firstTencent && item.mediaPlatform === 'MEDIA_PLATFORM_TENCENT') || (firstOcenaengine && item.mediaPlatform === 'MEDIA_PLATFORM_OCENAENGINE'))?.map((item: { name: string; id: number; productType: string; mediaPlatform: string; icon?: string }) => {
|
|
productTypeSet.add(item.productType)
|
|
productTypeSet.add(item.productType)
|
|
mediaPlatformSet.add(item.mediaPlatform)
|
|
mediaPlatformSet.add(item.mediaPlatform)
|
|
return { label: item.name, value: item.id + '||' + item.productType, productType: item.productType, mediaPlatform: item.mediaPlatform, icon: item.icon }
|
|
return { label: item.name, value: item.id + '||' + item.productType, productType: item.productType, mediaPlatform: item.mediaPlatform, icon: item.icon }
|
|
})
|
|
})
|
|
- setProductTypeList([{ label: '游戏业务', value: 'PRODUCT_TYPE_GAME' }, { label: '小说业务', value: 'PRODUCT_TYPE_NOVEL' }, { label: '短剧业务', value: 'PRODUCT_TYPE_PLAYLET' }].filter(item => [...productTypeSet].includes(item.value)))
|
|
|
|
- setMediaPlatformList([{ label: '腾讯', value: 'MEDIA_PLATFORM_TENCENT' }, { label: '头条', value: 'MEDIA_PLATFORM_OCENAENGINE' }].filter(item => [...mediaPlatformSet].includes(item.value)))
|
|
|
|
- const app = initialState?.iaaApp
|
|
|
|
- let iaaApp: string;
|
|
|
|
- let mediaPlatform: string;
|
|
|
|
- const d = data.find(item => item.value === app)
|
|
|
|
- if (app && d) {
|
|
|
|
- iaaApp = app
|
|
|
|
- mediaPlatform = d.mediaPlatform
|
|
|
|
- } else {
|
|
|
|
- iaaApp = data?.[0].value || undefined as any
|
|
|
|
- mediaPlatform = data?.[0].mediaPlatform || undefined as any
|
|
|
|
|
|
+ if (data?.length) {
|
|
|
|
+ setProductTypeList([{ label: '游戏业务', value: 'PRODUCT_TYPE_GAME' }, { label: '小说业务', value: 'PRODUCT_TYPE_NOVEL' }, { label: '短剧业务', value: 'PRODUCT_TYPE_PLAYLET' }].filter(item => [...productTypeSet].includes(item.value)))
|
|
|
|
+ setMediaPlatformList([{ label: '腾讯', value: 'MEDIA_PLATFORM_TENCENT' }, { label: '头条', value: 'MEDIA_PLATFORM_OCENAENGINE' }].filter(item => [...mediaPlatformSet].includes(item.value)))
|
|
|
|
+ const app = initialState?.iaaApp
|
|
|
|
+ let iaaApp: string;
|
|
|
|
+ let mediaPlatform: string;
|
|
|
|
+ const d = data.find(item => item.value === app)
|
|
|
|
+ if (app && d) {
|
|
|
|
+ iaaApp = app
|
|
|
|
+ mediaPlatform = d.mediaPlatform
|
|
|
|
+ } else {
|
|
|
|
+ iaaApp = data?.[0].value || undefined as any
|
|
|
|
+ mediaPlatform = data?.[0].mediaPlatform || undefined as any
|
|
|
|
+ }
|
|
|
|
+ const productType = iaaApp ? iaaApp.split('||')?.[1] : undefined
|
|
|
|
+
|
|
|
|
+ haveTo(mediaPlatform as any)
|
|
|
|
+ sessionStorage.setItem('mediaPlatform', mediaPlatform)
|
|
|
|
+ setProductType(productType)
|
|
|
|
+ setInitialState({ ...initialState, iaaApp, mediaPlatform })
|
|
|
|
+ setApplist(data)
|
|
}
|
|
}
|
|
- const productType = iaaApp ? iaaApp.split('||')?.[1] : undefined
|
|
|
|
- haveTo(mediaPlatform as any)
|
|
|
|
- sessionStorage.setItem('mediaPlatform', mediaPlatform)
|
|
|
|
- setProductType(productType)
|
|
|
|
- setInitialState({ ...initialState, iaaApp, mediaPlatform })
|
|
|
|
- setApplist(data)
|
|
|
|
}
|
|
}
|
|
})
|
|
})
|
|
}
|
|
}
|