|
@@ -1,9 +1,9 @@
|
|
|
-import React, { useEffect, useState } from "react"
|
|
|
+import React, { useEffect, useState, useRef } from "react"
|
|
|
import style from './index.less'
|
|
|
-import { Button, Card, Checkbox, Divider, Empty, Form, message, Pagination, Popover, Radio, Result, Select, Space, Spin, Typography, Image } from "antd"
|
|
|
+import { Button, Card, Checkbox, Divider, Empty, Form, message, Pagination, Popover, Radio, Result, Select, Space, Spin, Typography, Image, Tooltip } from "antd"
|
|
|
import { useAjax } from "@/Hook/useAjax"
|
|
|
import { getPageRemoteImageDataListApi } from "@/services/adqV3/cloudNew"
|
|
|
-import { formatBytes, formatSecondsToTime, groupBy } from "@/utils/utils"
|
|
|
+import { formatBytes, formatSecondsToTime } from "@/utils/utils"
|
|
|
import SelectGroupSearch from "./selectGroupSearch"
|
|
|
import './global.less'
|
|
|
import '../../tencentAdPutIn/index.less'
|
|
@@ -13,7 +13,7 @@ import PlayVideo from "./playVideo"
|
|
|
import Lazyimg from "react-lazyimg-component"
|
|
|
import { useLocalStorageState } from "ahooks"
|
|
|
import SyncCloudSc from "./syncCloudSc"
|
|
|
-import { checkAccountUnitApi, getUserAccountListApi } from "@/services/launchAdq/adAuthorize"
|
|
|
+import { checkAccountUnitApi } from "@/services/launchAdq/adAuthorize"
|
|
|
|
|
|
const { Text, Paragraph } = Typography;
|
|
|
|
|
@@ -26,6 +26,7 @@ const SelectGroupUnitNew: React.FC<CLOUDNEW.SelectGroupCloudNewProps> = ({ num,
|
|
|
|
|
|
/*****************************************/
|
|
|
const [rowNum, setRowNum] = useState<number>(0)
|
|
|
+ const refScllor = useRef<HTMLDivElement>(null)
|
|
|
|
|
|
const [checkFolderAll, setCheckFolderAll] = useState<boolean>(false);
|
|
|
const [indeterminateFolder, setIndeterminateFolder] = useState<boolean>(false);
|
|
@@ -36,6 +37,7 @@ const SelectGroupUnitNew: React.FC<CLOUDNEW.SelectGroupCloudNewProps> = ({ num,
|
|
|
const [previewData, setPreviewData] = useState<{ visible: boolean, url?: string }>({ visible: false })
|
|
|
const [sortData, setSortData] = useLocalStorageState<{ sortField: string | undefined, sortType: boolean }>('sort-data-unit', { sortField: undefined, sortType: false });
|
|
|
const [showField, setShowField] = useLocalStorageState<string[]>('show-field-unit', ['material.create_time', 'material_data_day.cost', 'material_data_day.ctr', 'material_data_day.conversions_rate', 'material_data_day.dynamic_creative_count']);
|
|
|
+ const [isShowAll, setIsShowAll] = useState<boolean>(false)
|
|
|
|
|
|
const getPageRemoteImageDataList = useAjax((params) => getPageRemoteImageDataListApi(params))
|
|
|
const checkAccountUnit = useAjax((params) => checkAccountUnitApi(params))
|
|
@@ -81,9 +83,19 @@ const SelectGroupUnitNew: React.FC<CLOUDNEW.SelectGroupCloudNewProps> = ({ num,
|
|
|
if (sortData?.sortField) {
|
|
|
params = { ...params, ...sortData }
|
|
|
}
|
|
|
+ if (params?.sizeList?.length) {
|
|
|
+ params.sizeQueries = params.sizeList.map(item => {
|
|
|
+ const [width, height, relation] = item.split('*')
|
|
|
+ return { width: Number(width), height: Number(height), relation: relation || '=' }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ delete params?.sizeList
|
|
|
+ if (isShowAll) {
|
|
|
+ delete params?.sizeQueries
|
|
|
+ }
|
|
|
getPageRemoteImageDataList.run(params)
|
|
|
}
|
|
|
- }, [queryParams, defaultParams, searchParams, sortData, showField, unitAccountId])
|
|
|
+ }, [queryParams, defaultParams, searchParams, sortData, showField, unitAccountId, isShowAll])
|
|
|
|
|
|
// 选择
|
|
|
const onCheckboxChange = (checked: boolean, item: any) => {
|
|
@@ -112,7 +124,11 @@ const SelectGroupUnitNew: React.FC<CLOUDNEW.SelectGroupCloudNewProps> = ({ num,
|
|
|
{/* 搜索 */}
|
|
|
<SelectGroupSearch
|
|
|
type={defaultParams.materialType}
|
|
|
- onSearch={(value) => { setSearchParams(value) }}
|
|
|
+ sizeQueries={defaultParams.sizeQueries}
|
|
|
+ onSearch={(value) => {
|
|
|
+ refScllor.current?.scrollTo(0, 0)
|
|
|
+ setSearchParams(value)
|
|
|
+ }}
|
|
|
/>
|
|
|
<Card
|
|
|
style={{ height: '100%', flex: '1 0', overflow: 'hidden' }}
|
|
@@ -149,7 +165,7 @@ const SelectGroupUnitNew: React.FC<CLOUDNEW.SelectGroupCloudNewProps> = ({ num,
|
|
|
}
|
|
|
setCheckedFolderList(newCheckedFolderList)
|
|
|
}}
|
|
|
- disabled={checkedFolderList?.length >= num || !!active || active === 0}
|
|
|
+ disabled={checkedFolderList?.length >= num || !!active || active === 0 || isShowAll}
|
|
|
indeterminate={indeterminateFolder}
|
|
|
checked={checkFolderAll}
|
|
|
>全选</Checkbox>
|
|
@@ -162,6 +178,11 @@ const SelectGroupUnitNew: React.FC<CLOUDNEW.SelectGroupCloudNewProps> = ({ num,
|
|
|
/>
|
|
|
</div>
|
|
|
<div className={style.left_bts}>
|
|
|
+ <Checkbox onChange={(e) => setIsShowAll(e.target.checked)} checked={isShowAll}>
|
|
|
+ <Tooltip title="勾选只展示,不支持选择投放">
|
|
|
+ <span style={{ fontSize: 12 }}>显示所有{defaultParams?.materialType === 'video' ? '视频' : '图片'}素材</span>
|
|
|
+ </Tooltip>
|
|
|
+ </Checkbox>
|
|
|
<Popover
|
|
|
content={<div style={{ width: 320 }}>
|
|
|
<Form
|
|
@@ -227,13 +248,13 @@ const SelectGroupUnitNew: React.FC<CLOUDNEW.SelectGroupCloudNewProps> = ({ num,
|
|
|
</div>
|
|
|
<div className={`${style.content} content_global`}>
|
|
|
<Spin spinning={getPageRemoteImageDataList.loading}>
|
|
|
- <div className={`${style.content_scroll} scroll`}>
|
|
|
+ <div className={`${style.content_scroll} scroll`} ref={refScllor}>
|
|
|
{getPageRemoteImageDataList?.data?.records?.length > 0 ? <Checkbox.Group value={checkedFolderList?.filter((_, index) => (active || active === 0) ? index === active : true)?.map(item => item.id)} style={{ width: '100%' }}>
|
|
|
<div className={style.content_scroll_div}>
|
|
|
{getPageRemoteImageDataList?.data?.records.map((item: any) => {
|
|
|
let id = defaultParams.materialType === 'image' ? item.image_id : item.video_id
|
|
|
const isSelect = checkedFolderList?.filter((_, index) => (active || active === 0) ? index === active : true)?.map(item => item.id).includes(id)
|
|
|
- const disabled = (active || active === 0) ? false : (checkedFolderList.length >= num && !isSelect)
|
|
|
+ const disabled = ((active || active === 0) ? false : (checkedFolderList.length >= num && !isSelect)) || isShowAll
|
|
|
return <div key={id} className={style.content_row} style={{ width: rowNum ? (1 / rowNum * 100) + '%' : 220 }}>
|
|
|
<Card
|
|
|
hoverable
|
|
@@ -313,6 +334,7 @@ const SelectGroupUnitNew: React.FC<CLOUDNEW.SelectGroupCloudNewProps> = ({ num,
|
|
|
pageSize={getPageRemoteImageDataList?.data?.size || 20}
|
|
|
current={getPageRemoteImageDataList?.data?.current || 1}
|
|
|
onChange={(page: number, pageSize: number) => {
|
|
|
+ refScllor.current?.scrollTo(0, 0)
|
|
|
setQueryParams({ ...queryParams, pageNum: page, pageSize })
|
|
|
}}
|
|
|
pageSizeOptions={[10, 15, 20, 50, 100]}
|