|
@@ -9,21 +9,23 @@ export function materialDeclare() {
|
9
|
9
|
clearAllEvent: () => void, creatice_reuseEvent: () => void, deleAcEvent: (arr: any, haveAssign: boolean) => void
|
10
|
10
|
}>()
|
11
|
11
|
const cMaterial = reactive<reactiveTableAndAny>({
|
12
|
|
- list: [],
|
13
|
|
- list_copy: [],
|
14
|
|
- key: 1,
|
15
|
|
- haveCoverOrVideo: 1, // 1:视频和图片 2:视频 3:图片
|
16
|
|
- video_tips: {},
|
17
|
|
- image_tips: {},
|
18
|
|
- array_property: {},//image_list 时图片个数限制 max_number min_number
|
19
|
|
- resResult: [],//提审后台需要的值
|
20
|
|
- haveShowVideoObj: {
|
21
|
|
- show: false, // 是否展示视频号
|
22
|
|
- name: '',
|
23
|
|
- val: false,// 视频号是否开启
|
24
|
|
- },
|
25
|
|
- imgOrVideoInfo: {},//视频或者图片需要的数据详情
|
26
|
|
- testNew_text:''
|
|
12
|
+ fData:{
|
|
13
|
+ list: [],
|
|
14
|
+ list_copy: [],
|
|
15
|
+ key: 1,
|
|
16
|
+ haveCoverOrVideo: 1, // 1:视频和图片 2:视频 3:图片
|
|
17
|
+ video_tips: {},
|
|
18
|
+ image_tips: {},
|
|
19
|
+ array_property: {},//image_list 时图片个数限制 max_number min_number
|
|
20
|
+ resResult: [],//提审后台需要的值
|
|
21
|
+ haveShowVideoObj: {
|
|
22
|
+ show: false, // 是否展示视频号
|
|
23
|
+ name: '',
|
|
24
|
+ val: false,// 视频号是否开启
|
|
25
|
+ },
|
|
26
|
+ imgOrVideoInfo: {},//视频或者图片需要的数据详情
|
|
27
|
+ testNew_text:''
|
|
28
|
+ }
|
27
|
29
|
})
|
28
|
30
|
return {
|
29
|
31
|
CreativeMaterialRef,
|
|
@@ -44,7 +46,7 @@ export function handleMultiple({
|
44
|
46
|
console.log('resResultresResult', resResult)
|
45
|
47
|
resResult.forEach(main => {
|
46
|
48
|
if (!main) return;//跳出本次循环
|
47
|
|
- let itemObj: any = _.cloneDeep(cMaterial.imgOrVideoInfo)
|
|
49
|
+ let itemObj: any = _.cloneDeep(cMaterial.fData.imgOrVideoInfo)
|
48
|
50
|
let imageArr: any = []
|
49
|
51
|
let self_info_arr:any = []
|
50
|
52
|
let obj: any = {}
|
|
@@ -55,7 +57,7 @@ export function handleMultiple({
|
55
|
57
|
self_info_arr.push(item.self_info)
|
56
|
58
|
for (let i in item) {
|
57
|
59
|
if (item[i]?.material_res) {
|
58
|
|
- if (cMaterial.haveCoverOrVideo == 1) {//视频和图片
|
|
60
|
+ if (cMaterial.fData.haveCoverOrVideo == 1) {//视频和图片
|
59
|
61
|
if (item[i]?.material_res?.video_id) {
|
60
|
62
|
setValueInNestedObject(itemObj, 'video_id', item[i].material_res.video_id);
|
61
|
63
|
setValueInNestedObject(itemObj, 'self_video_count', 1);
|
|
@@ -64,17 +66,17 @@ export function handleMultiple({
|
64
|
66
|
setValueInNestedObject(itemObj, 'image_id', item[i].material_res.cover.image_id);
|
65
|
67
|
setValueInNestedObject(itemObj, 'self_image_count', 1);
|
66
|
68
|
}
|
67
|
|
- if (cMaterial.haveShowVideoObj.show && cMaterial.haveShowVideoObj.name) {
|
68
|
|
- itemObj[cMaterial.haveShowVideoObj.name] = cMaterial.haveShowVideoObj.val
|
|
69
|
+ if (cMaterial.fData.haveShowVideoObj.show && cMaterial.fData.haveShowVideoObj.name) {
|
|
70
|
+ itemObj[cMaterial.fData.haveShowVideoObj.name] = cMaterial.fData.haveShowVideoObj.val
|
69
|
71
|
}
|
70
|
72
|
}
|
71
|
|
- if (cMaterial.haveCoverOrVideo == 2) {//视频
|
|
73
|
+ if (cMaterial.fData.haveCoverOrVideo == 2) {//视频
|
72
|
74
|
if (item[i]?.material_res?.video_id) {
|
73
|
75
|
setValueInNestedObject(itemObj, 'video_id', item[i].material_res.video_id);
|
74
|
76
|
setValueInNestedObject(itemObj, 'self_video_count', 1);
|
75
|
77
|
}
|
76
|
78
|
}
|
77
|
|
- if (cMaterial.haveCoverOrVideo == 3) {//图片
|
|
79
|
+ if (cMaterial.fData.haveCoverOrVideo == 3) {//图片
|
78
|
80
|
if (itemObj.image && item[i]?.material_res?.image_id) {
|
79
|
81
|
setValueInNestedObject(itemObj, 'image_id', item[i].material_res.cover.image_id);
|
80
|
82
|
setValueInNestedObject(itemObj, 'self_image_count', 1);
|
|
@@ -98,8 +100,8 @@ export function handleMultiple({
|
98
|
100
|
}
|
99
|
101
|
//创意素材值回显
|
100
|
102
|
const assignEvent_CreativeMaterial = async (val: any, videoOnPuse?: any) => {
|
101
|
|
- cMaterial.list_copy = _.cloneDeep(val)
|
102
|
|
- cMaterial.haveShowVideoObj.val = videoOnPuse
|
|
103
|
+ cMaterial.fData.list_copy = _.cloneDeep(val)
|
|
104
|
+ cMaterial.fData.haveShowVideoObj.val = videoOnPuse
|
103
|
105
|
console.log('val', val)
|
104
|
106
|
//所有素材列表,此时的素材个数已是正确的
|
105
|
107
|
let cMaterial_resResult_list: any = []
|
|
@@ -146,9 +148,9 @@ export function handleMultiple({
|
146
|
148
|
})
|
147
|
149
|
})
|
148
|
150
|
|
149
|
|
- cMaterial.key++
|
150
|
|
- cMaterial.resResult = arr_
|
151
|
|
- console.log('cMaterial.resResult', cMaterial.resResult);
|
|
151
|
+ cMaterial.fData.key++
|
|
152
|
+ cMaterial.fData.resResult = arr_
|
|
153
|
+ console.log('cMaterial.fData.resResult', cMaterial.fData.resResult);
|
152
|
154
|
await computeCount()
|
153
|
155
|
if (val && val.length > 0) {
|
154
|
156
|
close_reuse_loading()
|
|
@@ -159,56 +161,56 @@ export function handleMultiple({
|
159
|
161
|
const get_cover_info = () => {
|
160
|
162
|
console.log('创意基本信息originalityBasicInfoData', originalityBasicInfoData)
|
161
|
163
|
let obj: any = originalityBasicInfoData?.apiResult?.adTemplateItem?.adcreative_elements
|
162
|
|
- cMaterial.testNew_text = originalityBasicInfoData?.apiResult?.adTemplateItem?.adcreative_template_appellation
|
|
164
|
+ cMaterial.fData.testNew_text = originalityBasicInfoData?.apiResult?.adTemplateItem?.adcreative_template_appellation
|
163
|
165
|
if (obj?.finder_object_visibility?.name) { // 是否展示视频号
|
164
|
|
- cMaterial.haveShowVideoObj.show = true
|
165
|
|
- cMaterial.haveShowVideoObj.name = obj.finder_object_visibility.name
|
|
166
|
+ cMaterial.fData.haveShowVideoObj.show = true
|
|
167
|
+ cMaterial.fData.haveShowVideoObj.name = obj.finder_object_visibility.name
|
166
|
168
|
} else {
|
167
|
|
- cMaterial.haveShowVideoObj.show = false
|
|
169
|
+ cMaterial.fData.haveShowVideoObj.show = false
|
168
|
170
|
}
|
169
|
171
|
|
170
|
|
- for (let key in cMaterial.imgOrVideoInfo) {//清空数据
|
171
|
|
- delete cMaterial.imgOrVideoInfo[key]
|
|
172
|
+ for (let key in cMaterial.fData.imgOrVideoInfo) {//清空数据
|
|
173
|
+ delete cMaterial.fData.imgOrVideoInfo[key]
|
172
|
174
|
}
|
173
|
175
|
//获取数据
|
174
|
176
|
let situationArr: { type: string, _tips: any }[] = []
|
175
|
|
- cMaterial.array_property = {}
|
|
177
|
+ cMaterial.fData.array_property = {}
|
176
|
178
|
if (obj.video) {
|
177
|
179
|
situationArr.push({
|
178
|
180
|
type: 'video',
|
179
|
181
|
_tips: obj?.video?.restriction?.video_restriction
|
180
|
182
|
})
|
181
|
|
- cMaterial.imgOrVideoInfo['video'] = 'video_id'
|
|
183
|
+ cMaterial.fData.imgOrVideoInfo['video'] = 'video_id'
|
182
|
184
|
}
|
183
|
185
|
if (obj.image) {
|
184
|
186
|
situationArr.push({
|
185
|
187
|
type: 'image',
|
186
|
188
|
_tips: obj?.image?.restriction?.image_restriction
|
187
|
189
|
})
|
188
|
|
- cMaterial.imgOrVideoInfo['image'] = 'image_id'
|
|
190
|
+ cMaterial.fData.imgOrVideoInfo['image'] = 'image_id'
|
189
|
191
|
}
|
190
|
192
|
if (obj.short_video_struct && obj.short_video_struct.child) {
|
191
|
|
- cMaterial.imgOrVideoInfo['short_video_struct'] = {}
|
|
193
|
+ cMaterial.fData.imgOrVideoInfo['short_video_struct'] = {}
|
192
|
194
|
if (obj.short_video_struct.child.short_video1) {
|
193
|
195
|
situationArr.push({
|
194
|
196
|
type: 'video',
|
195
|
197
|
_tips: obj?.short_video_struct?.child?.short_video1?.restriction?.video_restriction
|
196
|
198
|
})
|
197
|
|
- cMaterial.imgOrVideoInfo['short_video_struct']['short_video1'] = 'video_id'
|
|
199
|
+ cMaterial.fData.imgOrVideoInfo['short_video_struct']['short_video1'] = 'video_id'
|
198
|
200
|
}
|
199
|
201
|
if (obj.short_video_struct.child.short_video2) {
|
200
|
202
|
situationArr.push({
|
201
|
203
|
type: 'video',
|
202
|
204
|
_tips: obj?.short_video_struct?.child?.short_video2?.restriction?.video_restriction
|
203
|
205
|
})
|
204
|
|
- cMaterial.imgOrVideoInfo['short_video_struct']['short_video2'] = 'video_id'
|
|
206
|
+ cMaterial.fData.imgOrVideoInfo['short_video_struct']['short_video2'] = 'video_id'
|
205
|
207
|
}
|
206
|
208
|
if (obj.short_video_struct.child.video_cover_img_id) {
|
207
|
209
|
situationArr.push({
|
208
|
210
|
type: 'image',
|
209
|
211
|
_tips: obj?.short_video_struct?.child?.video_cover_img_id?.restriction?.image_restriction
|
210
|
212
|
})
|
211
|
|
- cMaterial.imgOrVideoInfo['short_video_struct']['video_cover_img_id'] = 'image_id'
|
|
213
|
+ cMaterial.fData.imgOrVideoInfo['short_video_struct']['video_cover_img_id'] = 'image_id'
|
212
|
214
|
}
|
213
|
215
|
}
|
214
|
216
|
if (obj.image_list) {
|
|
@@ -216,31 +218,31 @@ export function handleMultiple({
|
216
|
218
|
type: 'image_list',
|
217
|
219
|
_tips: obj?.image_list?.restriction?.image_restriction
|
218
|
220
|
})
|
219
|
|
- cMaterial.array_property = obj?.image_list?.array_property;
|
220
|
|
- cMaterial.imgOrVideoInfo['image_list'] = 'image_list'
|
|
221
|
+ cMaterial.fData.array_property = obj?.image_list?.array_property;
|
|
222
|
+ cMaterial.fData.imgOrVideoInfo['image_list'] = 'image_list'
|
221
|
223
|
}
|
222
|
|
- cMaterial.imgOrVideoInfo['self_image_count'] = 'self_image_count'
|
223
|
|
- cMaterial.imgOrVideoInfo['self_video_count'] = 'self_video_count'
|
|
224
|
+ cMaterial.fData.imgOrVideoInfo['self_image_count'] = 'self_image_count'
|
|
225
|
+ cMaterial.fData.imgOrVideoInfo['self_video_count'] = 'self_video_count'
|
224
|
226
|
// 留口子 现在逻辑是image video image_list不共存 暂未发现共存的情况
|
225
|
227
|
situationArr.forEach((item) => {
|
226
|
228
|
if (item.type == 'video') {
|
227
|
|
- cMaterial.video_tips = item._tips
|
|
229
|
+ cMaterial.fData.video_tips = item._tips
|
228
|
230
|
}
|
229
|
231
|
if (item.type == 'image' || item.type == 'image_list') {
|
230
|
|
- cMaterial.image_tips = item._tips
|
|
232
|
+ cMaterial.fData.image_tips = item._tips
|
231
|
233
|
}
|
232
|
234
|
})
|
233
|
235
|
let transit_arr = situationArr.map((v) => v.type)
|
234
|
236
|
if (transit_arr.includes('image') && transit_arr.includes('video')) {
|
235
|
|
- cMaterial.haveCoverOrVideo = 1
|
|
237
|
+ cMaterial.fData.haveCoverOrVideo = 1
|
236
|
238
|
} else if (transit_arr.includes('video')) {
|
237
|
|
- cMaterial.haveCoverOrVideo = 2
|
|
239
|
+ cMaterial.fData.haveCoverOrVideo = 2
|
238
|
240
|
} else if (transit_arr.includes('image')) {
|
239
|
|
- cMaterial.haveCoverOrVideo = 3
|
|
241
|
+ cMaterial.fData.haveCoverOrVideo = 3
|
240
|
242
|
} else if (transit_arr.includes('image_list')) {
|
241
|
|
- cMaterial.haveCoverOrVideo = 3
|
|
243
|
+ cMaterial.fData.haveCoverOrVideo = 3
|
242
|
244
|
}
|
243
|
|
- console.log(situationArr, '===cMaterial.haveCoverOrVideo ==>', cMaterial.haveCoverOrVideo)
|
|
245
|
+ console.log(situationArr, '===cMaterial.fData.haveCoverOrVideo ==>', cMaterial.fData.haveCoverOrVideo)
|
244
|
246
|
}
|
245
|
247
|
|
246
|
248
|
//关闭复用loading和弹框
|