liuxiaona 1 year ago
parent
commit
57c8f24482

+ 16 - 16
src/components/businessMoudle/batchGdt/configArea/index.vue

@@ -71,14 +71,14 @@
71 71
                   </template>
72 72
                 </div>
73 73
                 <template v-if="sub.name == '创意素材'" :key="sub.chooseNum">
74
-                  {{cMaterial.list}}
75
-                  <template  v-for="cItem in cMaterial.list" :key="cItem.id">
74
+                  {{cMaterial.fData.list}}
75
+                  <template  v-for="cItem in cMaterial.fData.list" :key="cItem.id">
76 76
                     <div class="flex bMar8">
77
-                      <template v-for="cSub in cItem.list" :key="cSub.subId">
78
-                        <div class="flex" style="width: 100%;justify-content: center" v-if="cMaterial.haveCoverOrVideo == 2 || cMaterial.haveCoverOrVideo == 1">
77
+                      <template v-for="cSub in cItem.list" :key="cItem.id+cSub.subId">
78
+                        <div class="flex" style="width: 100%;justify-content: center" v-if="cMaterial.fData.haveCoverOrVideo == 2 || cMaterial.fData.haveCoverOrVideo == 1">
79 79
                           <video :src="cSub.videoUrl" height="50"></video>
80 80
                         </div>
81
-                        <div style="width: 100%;justify-content: center" class="lMar10 flex" v-if="cMaterial.haveCoverOrVideo == 3 || cMaterial.haveCoverOrVideo == 1">
81
+                        <div style="width: 100%;justify-content: center" class="lMar10 flex" v-if="cMaterial.fData.haveCoverOrVideo == 3 || cMaterial.fData.haveCoverOrVideo == 1">
82 82
                           <img :src="cSub.picUrl" height="50"/>
83 83
                         </div>
84 84
                       </template>
@@ -114,13 +114,13 @@
114 114
   <RuleConfig ref="RuleConfigRef" @ExposeEvent="val=>pageInfo.RuleConfigObj = val"></RuleConfig>
115 115
   <!--  创意素材-->
116 116
   <CreativeMaterial ref="CreativeMaterialRef"
117
-                    :haveCoverOrVideo="cMaterial.haveCoverOrVideo"
118
-                    :haveShowVideoObj = "cMaterial.haveShowVideoObj"
119
-                    :video_tips="cMaterial.video_tips"
120
-                    :image_tips="cMaterial.image_tips"
117
+                    :haveCoverOrVideo="cMaterial.fData.haveCoverOrVideo"
118
+                    :haveShowVideoObj = "cMaterial.fData.haveShowVideoObj"
119
+                    :video_tips="cMaterial.fData.video_tips"
120
+                    :image_tips="cMaterial.fData.image_tips"
121 121
                     @closeLoading="close_reuse_loading"
122 122
                     :max_creative_num="pageInfo.RuleConfigObj?.adcreative_max || 0"
123
-                    :maxNum_imageList="cMaterial.array_property?.max_number || 1"
123
+                    :maxNum_imageList="cMaterial.fData.array_property?.max_number || 1"
124 124
                     @assignEvent="assignEvent_CreativeMaterial"></CreativeMaterial>
125 125
 
126 126
 
@@ -428,9 +428,9 @@ const get_ruleConfig_info = async () => {
428 428
 }
429 429
 
430 430
 //监听创意素材点击了确定
431
-watch(()=>cMaterial.key,()=>{
432
-  cMaterial.list = _.cloneDeep(cMaterial.list_copy)
433
-  let num = cMaterial.list&&cMaterial.list.length
431
+watch(()=>cMaterial.fData.key,()=>{
432
+  cMaterial.fData.list = _.cloneDeep(cMaterial.fData.list_copy)
433
+  let num = cMaterial.fData.list&&cMaterial.fData.list.length
434 434
   updateHaveContent(6,num)
435 435
 })
436 436
 
@@ -469,9 +469,9 @@ const openDialogEvent = async (sub:any) => {
469 469
 
470 470
   if(sub.name == '创意素材'){
471 471
     await get_cover_info()
472
-    console.log('打开之前CreativeMaterialRef',cMaterial.list);
473
-    CreativeMaterialRef.value?.switchShow(true,sub.haveContent,cMaterial.list,cMaterial.testNew_text)
474
-    console.log(cMaterial.array_property);
472
+    console.log('打开之前CreativeMaterialRef',cMaterial.fData.list);
473
+    CreativeMaterialRef.value?.switchShow(true,sub.haveContent,cMaterial.fData.list,cMaterial.fData.testNew_text)
474
+    console.log(cMaterial.fData.array_property);
475 475
   }
476 476
   if(sub.name == '创意文案' && CopywriterRef.value){
477 477
     CopywriterRef.value[0]?.initFun(true)

+ 1 - 1
src/components/businessMoudle/batchGdt/configArea/ts/judgeEvent.ts

@@ -47,7 +47,7 @@ function handleJudge({
47 47
       return false
48 48
     }
49 49
     if (id == 6) return true;//创意素材 不用判断定向包是否填写
50
-    if (!cMaterial.resResult || cMaterial.resResult.length == 0) {
50
+    if (!cMaterial.fData.resResult || cMaterial.fData.resResult.length == 0) {
51 51
       !msgFlag && ElMessage.warning('请选择创意素材!')
52 52
       return false
53 53
     }

+ 52 - 50
src/components/businessMoudle/batchGdt/configArea/ts/material.ts

@@ -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和弹框

+ 8 - 8
src/components/businessMoudle/batchGdt/configArea/ts/preview.ts

@@ -12,7 +12,7 @@ export const previewCompute = (pageInfo, cMaterial, basicInfoData_cr,) => {
12 12
     console.log('cMaterial', cMaterial)
13 13
     console.log('basicInfoData_cr', basicInfoData_cr)
14 14
     // console.log('定向包:', pageInfo.directObj)
15
-    // console.log('创意素材:', cMaterial.resResult)
15
+    // console.log('创意素材:', cMaterial.fData.resResult)
16 16
     // console.log('创意文案:', pageInfo.copywriterInfoData.data)
17 17
     // console.log('落地页:', pageInfo.copyLandPageInfoData)
18 18
     // console.log('规则配置:', pageInfo.RuleConfigObj)
@@ -56,7 +56,7 @@ export const previewCompute = (pageInfo, cMaterial, basicInfoData_cr,) => {
56 56
       let item = ad_show_list[index]
57 57
       for (let v_index = 0; v_index < item.chooseList.length; v_index++) {
58 58
         let v_item = item.chooseList[v_index]
59
-        cMaterial.resResult.forEach((main2) => {
59
+        cMaterial.fData.resResult.forEach((main2) => {
60 60
           if (item.id == main2.account_id) {
61 61
             let ad_list: any = _.cloneDeep(ad_show_list_scyc[index].chooseList[v_index].ad_list);
62 62
             let common_obj = {
@@ -168,7 +168,7 @@ export const previewCompute = (pageInfo, cMaterial, basicInfoData_cr,) => {
168 168
     })
169 169
     //落地页 - 自动分配
170 170
     if (pageInfo.copyLandPageInfoData.data && JSON.stringify(pageInfo.copyLandPageInfoData.data) != "{}") {
171
-      if (pageInfo.copyLandPageInfoData.allocation_type == 1) {//自动分配 //根据落地页分配规则 代码最后进行分配  
171
+      if (pageInfo.copyLandPageInfoData.allocation_type == 1) {//自动分配 //根据落地页分配规则 代码最后进行分配
172 172
         last_ad_show_list.forEach((item) => {
173 173
           let index_count = 0;
174 174
           item.chooseList.forEach((v, v_index) => {
@@ -187,7 +187,7 @@ export const previewCompute = (pageInfo, cMaterial, basicInfoData_cr,) => {
187 187
                       ad_v.adcreatives_info['link_page_spec']['mini_program_spec']['mini_program_path'] = pageInfo.copyLandPageInfoData.data[i][0].applink
188 188
                     }
189 189
                   }
190
-                  
190
+
191 191
                   if (pageInfo.copyLandPageInfoData.loadPageRule == 2) {
192 192
                     ad_v.adcreatives_info['page_spec']['mini_program_spec']['mini_program_id'] = pageInfo.copyLandPageInfoData.data[i][v_index].appid
193 193
                     ad_v.adcreatives_info['page_spec']['mini_program_spec']['mini_program_path'] = pageInfo.copyLandPageInfoData.data[i][v_index].applink
@@ -203,7 +203,7 @@ export const previewCompute = (pageInfo, cMaterial, basicInfoData_cr,) => {
203 203
                     ad_v.adcreatives_info['page_spec']['mini_program_spec']['mini_program_id'] = pageInfo.copyLandPageInfoData.data[i][index_count].appid
204 204
                     ad_v.adcreatives_info['page_spec']['mini_program_spec']['mini_program_path'] = pageInfo.copyLandPageInfoData.data[i][index_count].applink
205 205
                     ad_v.adcreatives_info['page_spec']['page_name'] = pageInfo.copyLandPageInfoData.data[i][index_count].appname
206
-                    
206
+
207 207
                     if(ad_v.adcreatives_info.link_page_spec && ad_v.adcreatives_info.link_page_spec.mini_program_spec) {
208 208
                       ad_v.adcreatives_info['link_page_spec']['mini_program_spec']['mini_program_id'] = pageInfo.copyLandPageInfoData.data[i][index_count].appid
209 209
                       ad_v.adcreatives_info['link_page_spec']['mini_program_spec']['mini_program_path'] = pageInfo.copyLandPageInfoData.data[i][index_count].applink
@@ -218,7 +218,7 @@ export const previewCompute = (pageInfo, cMaterial, basicInfoData_cr,) => {
218 218
         });
219 219
       }
220 220
     }
221
-    /** 
221
+    /**
222 222
      * 1、设置 计划名、广告名、素材名
223 223
      * 2、外部配置 - 视频号配置
224 224
      **/
@@ -280,7 +280,7 @@ export const previewCompute = (pageInfo, cMaterial, basicInfoData_cr,) => {
280 280
         plan_count++
281 281
       }
282 282
     });
283
-    
283
+
284 284
     resolve({
285 285
       acc_plan_ad_count,
286 286
       num_total: {
@@ -353,4 +353,4 @@ const getBidAmount = (ad_count, ad_total, type) => {
353 353
     }
354 354
     return last_num
355 355
   }
356
-}
356
+}