|
@@ -19,75 +19,12 @@ const Material: React.FC = () => {
|
|
|
/***************************************/
|
|
|
|
|
|
useEffect(() => {
|
|
|
- console.log(materialData)
|
|
|
if (materialData && Object.keys(materialData).length > 0) {
|
|
|
let type = Object.keys(materialData)[0];
|
|
|
setMtype(type)
|
|
|
}
|
|
|
}, [materialData])
|
|
|
|
|
|
- // 提交测试用 后期删除
|
|
|
- useEffect(() => {
|
|
|
- if (dynamicMaterialDTos && Object.keys(dynamicMaterialDTos) && mType) {
|
|
|
- console.log('创意素材拼装', dynamicMaterialDTos)
|
|
|
- console.log(dynamicMaterialDTos.dynamicGroup?.map((item: any) => {
|
|
|
- if (mType === 'image') {
|
|
|
- return [{
|
|
|
- type: mType,
|
|
|
- valueJson: JSON.stringify({
|
|
|
- value: {
|
|
|
- imageUrl: item?.image_id?.url,
|
|
|
- imageId: item?.image_id?.id,
|
|
|
- materialType: item?.image_id?.materialType
|
|
|
- }
|
|
|
- })
|
|
|
- }]
|
|
|
- } else if (mType === 'image_list' || mType === 'element_story') {
|
|
|
- let key = 'image_list'
|
|
|
- if (mType === 'element_story') {
|
|
|
- key = 'element_story'
|
|
|
- }
|
|
|
- let list = item?.[key]?.map((l: any) => {
|
|
|
- return {
|
|
|
- imageUrl: l?.url,
|
|
|
- imageId: l?.id,
|
|
|
- materialType: l?.materialType
|
|
|
- }
|
|
|
- })
|
|
|
- return [{
|
|
|
- type: mType,
|
|
|
- valueJson: JSON.stringify({
|
|
|
- value: {
|
|
|
- list
|
|
|
- }
|
|
|
- })
|
|
|
- }]
|
|
|
- } else if (['short_video', 'video'].includes(mType)) {
|
|
|
- let value: any = {
|
|
|
- materialType: item?.video_id?.materialType || item?.short_video1?.materialType || 0,
|
|
|
- videoUrl: item?.video_id?.url || item?.short_video1?.url,
|
|
|
- videoId: item?.video_id?.id || item?.short_video1?.id
|
|
|
- }
|
|
|
- if (item?.cover_id?.url) {
|
|
|
- value.imageUrl = item?.cover_id?.url
|
|
|
- value.imageId = item?.cover_id?.id
|
|
|
- value.materialCoverType = item?.cover_id?.materialType
|
|
|
- }
|
|
|
- return [{
|
|
|
- type: mType,
|
|
|
- valueJson: JSON.stringify({
|
|
|
- value
|
|
|
- })
|
|
|
- }]
|
|
|
- }
|
|
|
- return [{
|
|
|
- type: mType,
|
|
|
- valueJson: ''
|
|
|
- }]
|
|
|
- }))
|
|
|
- }
|
|
|
- }, [dynamicMaterialDTos, mType])
|
|
|
-
|
|
|
return <div className={`${style.settingsBody_content_row} ${style.row4}`}>
|
|
|
<div className={style.title}>
|
|
|
<span>创意素材 <span className={style.selected}>已选 {dynamicMaterialDTos?.dynamicGroup?.length || 0}</span></span>
|