Browse Source

视频号-未完成

xiuli.gao 1 year ago
parent
commit
db411d8fd3

+ 13 - 0
src/components/businessMoudle/batchGdt/configArea/basicInfo/ts/basicApi.ts

@@ -107,4 +107,17 @@ export async function unionPositionPackagesGet(params: {account_id: string, type
107 107
   } else {
108 108
     return []
109 109
   }
110
+}
111
+
112
+/** 获取推广目标列表(视频号)*/
113
+export function adcreativesGetObjects(params: {account_ids: string[], promoted_object_type: string}) {
114
+  return new Promise(async (resolve,reject)=>{
115
+    const res: any = await http.get('/api/adcreatives/getObjects',params)
116
+    if (res.errNo == 0) {
117
+      resolve(res.rst)
118
+    } else {
119
+      reject()
120
+      ElMessage.warning(res.errMsg)
121
+    }
122
+  })
110 123
 }

+ 262 - 0
src/components/businessMoudle/batchGdt/configArea/basicInfo/weChatVideoAccount.vue

@@ -0,0 +1,262 @@
1
+<template>
2
+  <el-dialog class="gdt-dialog" v-model="dialogVisible" :destroy-on-close="true" key="weChatVideoAccountDialog" title="选择视频号" width="1000px" top="40px"
3
+    :before-close="handleClose">
4
+    <div class="flex marT15">
5
+      <el-icon color="#ff9b48"><WarningFilled /></el-icon>
6
+      <p class="f13 c-555 lMar5">视频号需要提前在投放管理平台(路径:工具-微信生态授权管理)进行授权绑定,完成后可以通过刷新重新获取新授权的视频号。</p>
7
+    </div>
8
+    <div class="flex marT15">
9
+        <label class="form-block-item-title">视频号分配规则</label>
10
+        <el-radio-group v-model="rule" size="default" @change="ruleChange">
11
+          <template v-for="item in ruleList">
12
+            <el-radio-button :label="item.id">{{ item.name }}</el-radio-button>
13
+          </template>
14
+        </el-radio-group>
15
+        <el-tooltip placement="right" effect="light">
16
+          <template #content><span v-html="ruleTooltip"></span></template>
17
+          <span><el-icon class="questionFilled lMar5">
18
+              <QuestionFilled />
19
+            </el-icon></span>
20
+        </el-tooltip>
21
+        <!-- <div class="num_pre" v-if="multiCopyTesting == 0">
22
+          <span>账户数:</span><span class="num">{{ count_info?.accNum || 0 }},</span>
23
+          <span>计划数:</span><span class="num">{{ count_info?.planNum || 0 }},</span>
24
+          <span>广告数:</span><span class="num">{{ count_info?.adNum || 0 }};</span>
25
+        </div> -->
26
+      </div>
27
+
28
+    <div class="container tabelListBox" v-loading="loading">
29
+      <div class="ids">
30
+        <div class="accItem" v-for="(item, idx) in accIdsList" :key="item.id" :class="item.id == accId ? 'active' : ''"
31
+          @click="accItemEvent(item)">
32
+          {{ item.name || '-' }}
33
+          <el-icon :size="14" :color="item.id == accId ? '#197afb' : '#606266'" class="lMarauto">
34
+            <CircleCheck v-if="params[item.id] && params[item.id] != ''" />
35
+            <i-ep-ArrowRight v-else />
36
+          </el-icon>
37
+        </div>
38
+      </div>
39
+      <div class="tabelCon">
40
+        <div class="listCon rMar10">
41
+          <div class="flex_between operate">
42
+            <div class="flex f13 c-333">
43
+              <span class="rMar15">计划数:2</span>
44
+              <span>广告数:2</span>
45
+            </div>
46
+            <div class="f13 c-theme flex"><el-icon class="rMar5"><Refresh /></el-icon> 刷新</div>
47
+          </div>
48
+          <div class="infoTitle">视频号名称</div>
49
+          <div class="infoBlock">
50
+            <div class="empty-block" v-if="!tableDataAll || !tableDataAll[accId] || !tableDataAll[accId]?.list || tableDataAll[accId]?.list.length == 0">
51
+              <img src="@/assets/img/mobgi_ic_addata_nodata.png">
52
+              <p class="empty-description">暂无数据</p>
53
+            </div>
54
+            <el-checkbox-group v-else v-model="checkValue" @change="checkboxChange">
55
+              <el-checkbox :label="item.promoted_object_id" v-for="item in tableDataAll[accId]?.list">{{ item.promoted_object_name }}</el-checkbox>
56
+            </el-checkbox-group>
57
+          </div>
58
+        </div>
59
+        <div class="selectedList">
60
+          <div class="flex_between operate">
61
+            <div class="f13 c-333">已选:1/1</div>
62
+            <div class="f13 c-theme flex"><el-icon class="rMar5"><RefreshRight /></el-icon> 清空</div>
63
+          </div>
64
+          <div class="infoTitle">视频号</div>
65
+          <div class="infoBlock">
66
+            <div class="okInfo f13" v-for="item in params[accId]"><span>{{ item.promoted_object_name }}</span><el-icon color="#666"><CloseBold /></el-icon></div>
67
+          </div>
68
+        </div>
69
+      </div>
70
+    </div>
71
+    <template #footer>
72
+        <span class="dialog-footer">
73
+          <el-button @click="handleClose"> 取 消 </el-button>
74
+          <el-button type="primary" @click="submitEvent"> 确 定 </el-button>
75
+        </span>
76
+    </template>
77
+  </el-dialog>
78
+</template>
79
+<script setup lang="ts">
80
+import { reactive, ref, watch } from 'vue';
81
+import { adcreativesGetObjects } from './ts/basicApi'
82
+import { ElMessage } from "element-plus";
83
+const props = defineProps({
84
+  visible: {
85
+    type: Boolean,
86
+    default: false
87
+  },
88
+  accIdsList: {
89
+    type: Array<{ id: string, name: string }>,
90
+    default: () => []
91
+  },
92
+  fillback: {
93
+    type: Object,
94
+  },
95
+ 
96
+})
97
+const emit = defineEmits<{
98
+  (event: "close", val?: any): void;
99
+}>();
100
+const accId = ref('')
101
+const loading = ref(false)
102
+const dialogVisible = ref(props.visible)
103
+const params = reactive({})
104
+const tableDataAll = ref([])
105
+const checkValue = ref<string[]>([])
106
+const maxCheckCount = ref(1)
107
+const rule = ref(1)
108
+
109
+const ruleList = ref<any[]>([
110
+  { id: 1, name: '按账户分配' },
111
+  { id: 2, name: '按计划分配' },
112
+  { id: 3, name: '按广告分配' },
113
+])
114
+const ruleTooltip = `可选视频号数量根据分配规则制定:<br/>- 按账户分配:一个账户内广告使用同一个视频号<br/>- 按计划分配:一个计划内广告使用同一个视频号<br/>- 按广告分配:一个广告一个视频号`
115
+/**关闭弹框 */
116
+const handleClose = () => {
117
+  emit('close')
118
+}
119
+/**点击媒体账户 */
120
+const accItemEvent = (item) => {
121
+  accId.value = item?.id;
122
+  checkValue.value = params[accId.value].map((v)=>{v.promoted_object_id})
123
+}
124
+/**多选变化 */
125
+const checkboxChange = (val) => {
126
+  if (val.length > maxCheckCount.value) {
127
+    // 如果超过最大选择数,取消最后一个选中的复选框
128
+    const lastSelectedValue = val[val.length - 1];
129
+    checkValue.value = checkValue.value.filter(
130
+      (value) => value !== lastSelectedValue
131
+    );
132
+  }
133
+  params[accId.value] = tableDataAll.value[accId.value].list.reduce((total, value)=>{
134
+    if(checkValue.value.includes(value.promoted_object_id)){
135
+      return total.concat(value)
136
+    }
137
+  },[])
138
+}
139
+/**获取视频号列表 */
140
+const getInit = () => {
141
+  return new Promise((resolve) => {
142
+    loading.value = true;
143
+    adcreativesGetObjects({ 'account_ids': props.accIdsList.map((v)=>v.id), promoted_object_type: 'PROMOTED_OBJECT_TYPE_WECHAT_CHANNELS'}).then((res:any) => {
144
+      tableDataAll.value = res;
145
+      loading.value = false;
146
+      resolve(res)
147
+    }).catch(() => {
148
+      loading.value = false;
149
+    })
150
+  })
151
+}
152
+/**确定提交 */
153
+const submitEvent = () => {
154
+  for(let i = 0; i < props.accIdsList?.length; i++){
155
+    let key = props.accIdsList[i].id;
156
+    if(!params[key] || params[key] == '' || params[key].length < maxCheckCount.value){
157
+      ElMessage.warning(`账户${key},应选择${maxCheckCount.value}个转化,当前只选择1个`)
158
+      return
159
+    }
160
+  }
161
+  let obj = {};
162
+  for (let i in params) {
163
+    if (params[i] && params[i] != '') {
164
+      obj[i] = params[i]
165
+    }
166
+  }
167
+  emit('close', {
168
+    type: 'submit',
169
+    val: Object.keys(obj)?.length == 0 ? null : obj
170
+  })
171
+}
172
+
173
+
174
+/**分配规则 */
175
+const ruleChange = () => {
176
+
177
+}
178
+/**弹框显隐监听 */
179
+watch(
180
+  () => props.visible,
181
+  async (newValue, oldValue) => {
182
+    dialogVisible.value = newValue
183
+    if (newValue) {
184
+      if(props.accIdsList.length == 0 ){return}
185
+      props.accIdsList.forEach((item)=>{
186
+        params[item.id] = []
187
+      })
188
+      await getInit()
189
+      let side_init = props.accIdsList.map((v)=>{return v.id}).includes(accId.value) ? {id: accId.value} : props.accIdsList[0]; //如果侧边栏初始值不存在,则默认第一个为初始点击
190
+      accItemEvent(side_init)
191
+    }
192
+  }, { immediate: true })
193
+</script>
194
+<style lang="scss" scoped>
195
+@import "@/assets/style/batchDialogGdt.scss";
196
+@import './outer.scss';
197
+
198
+.tabelListBox {
199
+  margin-top: 15px;
200
+  height: 62vh !important;
201
+  padding-left: 0 !important;
202
+}
203
+
204
+.tabelCon{
205
+  display: flex;
206
+  padding: 10px;
207
+}
208
+.selectedList,.listCon{
209
+  box-sizing: border-box;
210
+  border: 1px solid #e8eaec;
211
+  border-radius: 4px;
212
+}
213
+.selectedList{
214
+  width: 200px;
215
+}
216
+.listCon{
217
+  flex: 1;
218
+}
219
+.operate{
220
+    height: 48px;
221
+    padding: 0 8px;
222
+    border-bottom: 1px solid #dcdfe6;
223
+  }
224
+  .infoTitle{
225
+    box-sizing: border-box;
226
+    display: flex;
227
+    padding-right: 10px;
228
+    padding-left: 10px;
229
+    line-height: 30px;
230
+    background-color: #f8f9fd;
231
+    border-bottom: 1px solid #dcdfe6;
232
+    font-size: 14px;
233
+    color: #333;
234
+  }
235
+  .infoBlock{
236
+    height: 47vh;
237
+    overflow: auto;
238
+    padding: 10px;
239
+    .okInfo{
240
+      display: flex;
241
+      align-items: center;
242
+      justify-content: space-between;
243
+      line-height: 32px;
244
+      color: #444;
245
+    }
246
+  }
247
+  .empty-block {
248
+  display: flex;
249
+  flex-direction: column;
250
+  align-items: center;
251
+  justify-content: center;
252
+  padding-top: 70px;
253
+
254
+  .empty-description {
255
+    margin-top: 25px;
256
+    font-size: 14px;
257
+    font-weight: 500;
258
+    line-height: 20px;
259
+    color: #808695;
260
+  }
261
+}
262
+</style>

+ 63 - 255
src/components/businessMoudle/batchGdt/configArea/index.vue

@@ -131,6 +131,8 @@
131 131
   <ExpandPopulation :visible="basicInfoData.outerConfig.targetingPartyData.visible" :accIdsList="pageInfo.accIdsList" :fillback="basicInfoData.outerConfig['targetingPartyData'].value" @close="(obj)=>{basicOuterClose({val: obj?.val || null, type: obj?.type || null, key:'targetingPartyData'})}" title="一方数据助攻"></ExpandPopulation>
132 132
   <!-- 精准匹配归因 -->
133 133
   <AttributionOuter :visible="basicInfoData.outerConfig.attributionOuter.visible" :accIdsList="pageInfo.accIdsList" :fillback="basicInfoData.outerConfig['attributionOuter'].value" @close="(obj)=>{basicOuterClose({val: obj?.val || null, type: obj?.type || null , key:'attributionOuter'})}"></AttributionOuter>
134
+  <!-- 配置视频号 -->
135
+  <WeChatVideoAccount :visible="basicInfoData.outerConfig.weChatVideoAccount.visible" :accIdsList="pageInfo.accIdsList" :fillback="basicInfoData.outerConfig['weChatVideoAccount'].value" @close="(obj)=>{basicOuterClose({val: obj?.val || null, type: obj?.type || null , key:'weChatVideoAccount'})}"></WeChatVideoAccount>
134 136
   <!-- 优量汇流量包 -->
135 137
   <UnionPosition :visible="basicInfoData.outerConfig.unionPosition.visible" :accIdsList="pageInfo.accIdsList" :infoSelect="basicInfoData.outerConfig.unionPosition.infoSelect" :fillback="basicInfoData.outerConfig['unionPosition'].value"  @close="(obj)=>{basicOuterClose({val: obj?.val || null, type: obj?.type || null , key:'unionPosition'})}"></UnionPosition>
136 138
   <!-- 复用配置 -->
@@ -150,16 +152,17 @@ import {ElMessage} from "element-plus";
150 152
 import BasicInfo from "./basicInfo/index.vue";
151 153
 import ExpandPopulation from './basicInfo/expandPopulation.vue'
152 154
 import AttributionOuter from './basicInfo/attributionOuter.vue'
155
+import WeChatVideoAccount from './basicInfo/weChatVideoAccount.vue'
153 156
 import UnionPosition from './basicInfo/unionPosition.vue'
154 157
 import OriginalityBasic from './originalityBasic/index.vue'
155 158
 import Copywriter from './copywriter/index.vue'
156 159
 import LandPage from "./landPage/index.vue";
157
-import { getAdPresets, getPromotedObjectType } from './basicInfo/ts/basicApi'
158
-import { FillBackData } from './basicInfo/ts/fillBack'
160
+import { getPromotedObjectType } from './basicInfo/ts/basicApi'
159 161
 import _ from "lodash";
160 162
 import { previewCompute } from './ts/preview'
161
-import { getDay } from '@/common/common'
162
-import handleMultiple from './ts/material'
163
+import { materialDeclare, handleMultiple } from './ts/material'
164
+import { basicInfoDeclare, handleAdBasic} from './ts/adBasic'
165
+import handleJudge from './ts/judgeEvent'
163 166
 const { proxy } = getCurrentInstance() as any;
164 167
 // 全局方法定义
165 168
 const NumberHandle = proxy.$NumberHandle
@@ -167,6 +170,16 @@ const emit = defineEmits<{
167 170
   (event: "openPreEvent", val: boolean,arr:any): void; //打开预览区
168 171
 }>();
169 172
 
173
+// S 参数声明
174
+const {
175
+  basicInfoData
176
+} = basicInfoDeclare()
177
+const {
178
+  CreativeMaterialRef,
179
+  cMaterial
180
+} = materialDeclare()
181
+// E 参数声明
182
+
170 183
 const openPreAreaLoading = ref(false)
171 184
 const targetRef = ref<{value:any}>()
172 185
 const originalityBasicRef = ref()
@@ -208,49 +221,6 @@ const pageInfo = reactive<reactiveTableAndAny>({
208 221
   },
209 222
 })
210 223
 
211
-
212
-//广告基本信息
213
-const basicInfoData = reactive<any>({
214
-  visible:false,
215
-  copywriting:[],
216
-  fillBack: {},
217
-  outerConfig: { //外层配置
218
-    attributionOuter: {
219
-      enabled: false,
220
-      visible:false,
221
-      optional: false,
222
-      isComplete: false, // 是否完成填写
223
-      name: '精准匹配归因',
224
-      value: {},
225
-    },
226
-    unionPosition: {
227
-      enabled: false,
228
-      visible:false,
229
-      optional: false,
230
-      isComplete: false, // 是否完成填写
231
-      infoSelect: [],//流量包type
232
-      name: '优量汇流量包',
233
-      value: {},
234
-    },
235
-    expandPopulation: {
236
-      enabled: false, //是否需要配置
237
-      visible:false, //对应弹框显隐
238
-      optional: true, //选填
239
-      isComplete: false, // 是否完成填写
240
-      name: '扩量种子人群(选填)',
241
-      value: {},
242
-    },
243
-    targetingPartyData: {
244
-      enabled: false, //是否需要配置
245
-      visible:false,
246
-      optional: true,
247
-      isComplete: false, // 是否完成填写
248
-      name: '一方数据助攻(选填)',
249
-      value: {},
250
-    },
251
-
252
-  }
253
-})
254 224
 //创意基本信息
255 225
 const originalityBasicInfoData = reactive<any>({
256 226
   positionKey: 0,//广告基本信息版位变化+1
@@ -447,19 +417,6 @@ const get_ruleConfig_info = async () => {
447 417
   }
448 418
 }
449 419
 
450
-
451
-
452
-// S 创意素材
453
-const {
454
-  CreativeMaterialRef,
455
-  cMaterial,
456
-  assignEvent_CreativeMaterial,
457
-  get_cover_info,
458
-  close_reuse_loading
459
-} = handleMultiple({originalityBasicInfoData, ResuseConfigRef, 'computeCount': () => { computeCount() }})
460
-// E 创意素材
461
-
462
-
463 420
 //监听创意素材点击了确定
464 421
 watch(()=>cMaterial.key,()=>{
465 422
   cMaterial.list = _.cloneDeep(cMaterial.list_copy)
@@ -511,101 +468,7 @@ const openDialogEvent = async (sub:any) => {
511 468
     LandPageRef.value[0]?.initFun(true, pageInfo.num_total, pageInfo.last_ad_show_list)
512 469
   }
513 470
 }
514
-/**每个模块判断是否可以点击添加 id:模块ID*/
515
-const judgeEvent = (id, msgFlag?) => {
516
-  if(pageInfo.accIdsList && pageInfo.accIdsList.length<=0){
517
-    !msgFlag && ElMessage.error('请选择媒体账户!')
518
-    return false
519
-  }
520
-  if(!pageInfo.targetValue || pageInfo.targetValue == ''){
521
-    !msgFlag && ElMessage.error('请选择推广目标!')
522
-    return false
523
-  }
524 471
 
525
-  if(id == 2) return true;//广告基本信息
526
-  if(!basicInfoData.fillBack || basicInfoData.fillBack == '' || JSON.stringify(basicInfoData.fillBack) == '{}'){
527
-    !msgFlag && ElMessage.warning('请完善广告基本信息!')
528
-    return false
529
-  }
530
-  if(id == 3) return true;//定向包
531
-  if(id == 5) return true;//创意基本信息
532
-
533
-
534
-  if(id != 6 ){
535
-    if((!pageInfo.directObj || pageInfo.directObj == '' || JSON.stringify(pageInfo.directObj) == '{}' || !pageInfo.directObj?.chooseList)){
536
-      !msgFlag && ElMessage.warning('请选择定向包!')
537
-      return false
538
-    }
539
-    for(let i = 0; i < pageInfo.directObj?.chooseList.length; i++) {
540
-      let item = pageInfo.directObj?.chooseList[i].chooseList
541
-      if(!item || item.length == 0){
542
-        !msgFlag && ElMessage.warning('请选择定向包!')
543
-        return false
544
-      }
545
-    }
546
-  }
547
-  if(id == -2) return true; //外部配置,需要定向包配置完成
548
-  if(!originalityBasicInfoData.params || originalityBasicInfoData.params == '' || originalityBasicInfoData.params.length <= 0){
549
-    !msgFlag && ElMessage.warning('完善创意基本信息!')
550
-    return false
551
-  }
552
-  if(id == 6) return true;//创意素材 不用判断定向包是否填写
553
-  if(!cMaterial.resResult || cMaterial.resResult.length == 0){
554
-    !msgFlag && ElMessage.warning('请选择创意素材!')
555
-    return false
556
-  }
557
-  if(id == 7) {//创意文案
558
-    if( !originalityBasicInfoData.apiResult?.adTemplateItem?.adcreative_elements?.description ){
559
-      !msgFlag && ElMessage.warning('此创意形式下不可使用创意文案!')
560
-      return false
561
-    } else{
562
-      return true
563
-    }
564
-  };
565
-  if(id == 8) {
566
-    if(!originalityBasicInfoData?.receiveForm?.landingPageExample?.page_type){
567
-      !msgFlag && ElMessage.warning('此创意形式下不可使用落地页!')
568
-      return false;//落地页
569
-    } else {
570
-      return true
571
-    }
572
-  }
573
-  if(id == -1){ // 提交预览时,判断是否全部完善
574
-    if(originalityBasicInfoData.apiResult?.adTemplateItem?.adcreative_elements?.description && (!pageInfo.copywriterInfoData.data || pageInfo.copywriterInfoData.data.length == 0 || JSON.stringify(pageInfo.copywriterInfoData.data) == '{}')){
575
-      !msgFlag && ElMessage.warning('请选择创意文案!')
576
-      return false
577
-    }
578
-    if(originalityBasicInfoData?.receiveForm?.landingPageExample?.page_type && (!pageInfo.copyLandPageInfoData.data || JSON.stringify(pageInfo.copyLandPageInfoData.data) == '{}' || pageInfo.copyLandPageInfoData.data.length == 0)) {
579
-      !msgFlag && ElMessage.warning('请选择落地页!')
580
-      return false
581
-    }
582
-    for(let i in basicInfoData.outerConfig) {
583
-      if(basicInfoData.outerConfig[i].enabled && !basicInfoData.outerConfig[i].optional && !basicInfoData.outerConfig[i].isComplete){
584
-        !msgFlag && ElMessage.error(`请配置${basicInfoData.outerConfig[i].name}!`)
585
-        return false
586
-      }
587
-    }
588
-    //判断广告基本信息投放日期是否大于今日
589
-    if(new Date(basicInfoData.fillBack.begin_date).getTime() < new Date(getDay(0,false) as string).getTime()) {
590
-      !msgFlag && ElMessage.error('开始投放日期必须大于今日!')
591
-      return false
592
-    }
593
-    if(basicInfoData.fillBack.first_day_begin_time && basicInfoData.fillBack.first_day_begin_time != ''){
594
-      let daysOfWeek = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'];
595
-      let time_series = _.cloneDeep(basicInfoData.fillBack.time_series)?.split(',')
596
-      for(let i = 0; i < time_series.length; i++){
597
-        time_series[i] = time_series[i].split('')
598
-      }
599
-      let hour = _.cloneDeep(basicInfoData.fillBack.first_day_begin_time).split(':')[0]
600
-      let week = new Date(basicInfoData.fillBack.begin_date).getDay()
601
-      if( time_series[week == 0 ? 6 : (week - 1)][Number(hour) * 2] != 1) {
602
-        !msgFlag && ElMessage.error(`当前投放开始日期为:${basicInfoData.fillBack.begin_date},${daysOfWeek[week]}, 投放时间段中应包含${daysOfWeek[week]}的${basicInfoData.fillBack.first_day_begin_time.slice(0,5)}`)
603
-        return false
604
-      }
605
-    }
606
-  }
607
-  return true
608
-}
609 472
 
610 473
 
611 474
 
@@ -726,108 +589,7 @@ const clearOriginalityInfo = () => {
726 589
   originalityBasicInfoData.params = []
727 590
   originalityBasicInfoData.apiResult = {}
728 591
 }
729
-/**广告基础信息回调 */
730
-const basicInfoClose = (obj) => {
731
-  if(obj?.type=='update'){
732
-    //判断版位是否变化,版位变化则创意基本信息、创意文案、落地页 、素材 清空
733
-    if(obj.params.automatic_site != basicInfoData.fillBack?.automatic_site || obj.params.site_ids != basicInfoData.fillBack?.site_ids){
734
-      clearOriginalityInfo()
735
-      updateHaveContent(5,0,false,true)
736
-      CreativeMaterialRef.value?.clearAllEvent()
737
-      updateHaveContent(6,0,false,true)
738
-      if(CopywriterRef.value){
739
-        CopywriterRef.value[0]?.clearEvent()
740
-      }
741
-      updateHaveContent(7,0,false,true)
742
-      if(LandPageRef.value){
743
-        LandPageRef.value[0]?.clearEvent()
744
-      }
745
-      updateHaveContent(8,0,false,true)
746
-    }
747 592
 
748
-    basicInfoData.copywriting = obj.copywriting
749
-    basicInfoData.fillBack = obj.params
750
-    getButtonBasicOuter(obj.params)
751
-  }
752
-  basicInfoData.visible = false
753
-}
754
-/**广告预存信息获取 */
755
-const getAdPresetsInfo = () => {
756
-  getAdPresets({'promoted_object_type': targetRef.value?.value}).then((res)=>{
757
-    getButtonBasicOuter(res)
758
-    FillBackData({data: res, type: 'api', cb: (data: {params: any,copywriting: []}) => {
759
-      if (data.copywriting && Array.isArray(data.copywriting) && data.copywriting.length > 0) {
760
-        basicInfoData.copywriting = data.copywriting
761
-        basicInfoData.fillBack = data.params
762
-        updateHaveContent(2,-1,false)
763
-      }
764
-    }})
765
-  })
766
-}
767
-/**广告信息外部配置获取 */
768
-const getButtonBasicOuter = (res) => {
769
-  for(let i in basicInfoData.outerConfig) {
770
-    basicInfoData.outerConfig[i].enabled = false
771
-  }
772
-  if(res?.expand_enabled == 1) { // 扩量种子人群
773
-    basicInfoData.outerConfig.expandPopulation.enabled = true;
774
-  }
775
-  if(res?.smart_targeting_switch == 1) { // 智能定向外层配置
776
-    basicInfoData.outerConfig.targetingPartyData.enabled = true;
777
-  }
778
-  if(res?.attribution_type == 2) { // 精准匹配归因
779
-    basicInfoData.outerConfig.attributionOuter.enabled = true;
780
-  }
781
-  if(res?.union_position_enabled == 1 || res?.exclude_union_position_enabled == 1) { //优量汇流量包 -- 需要定向包完成填写
782
-    basicInfoData.outerConfig.unionPosition.enabled = true;
783
-    basicInfoData.outerConfig.unionPosition.infoSelect = []
784
-    res?.union_position_enabled == 1 && basicInfoData.outerConfig.unionPosition.infoSelect.push({name:'定投流量包',id: 1})
785
-    res?.exclude_union_position_enabled == 1 && basicInfoData.outerConfig.unionPosition.infoSelect.push({name:'屏蔽流量包',id:2})
786
-  }
787
-}
788
-/**点击基础信息外层配置 */
789
-const basicOuterClick = (key) => {
790
-  if(key == 'unionPosition') { //优量汇流量包 - 需要定向包完成填写
791
-    if(!judgeEvent(-2)) return
792
-  }
793
-  basicInfoData.outerConfig[key].visible = true;
794
-}
795
-/** 外部配置回调 */
796
-interface IBasicOuterClose {
797
-  'type': string,
798
-  'key': string,
799
-  'val'?: string
800
-}
801
-const basicOuterClose = ({key,val,type}:IBasicOuterClose) => {
802
-  basicInfoData.outerConfig[key].visible = false;
803
-  if(type == 'submit') {
804
-    basicInfoData.outerConfig[key].value = val ? val : {};
805
-    basicInfoData.outerConfig[key].isComplete = isCompleteEvent(basicInfoData.outerConfig[key]);
806
-  }
807
-}
808
-const isCompleteEvent = (data) => {
809
-  for(let i = 0; i < pageInfo.accIdsList.length; i++){
810
-    let info = data.value[pageInfo.accIdsList[i].id]
811
-    if(Array.isArray(info) && info.length == 0) {
812
-      return false
813
-    } else if (Object.prototype.toString.call(info) == '[object Object]' && Object.keys(info).length == 0){
814
-      return false
815
-    } else if (!info || info == '') {
816
-      return false
817
-    }
818
-  }
819
-  return true
820
-}
821
-/**基础外部配置 - 获取对象公共数据 */
822
-const getCommonValue = (data) => {
823
-  let obj = {}
824
-  pageInfo.accIdsList.forEach((item) => {
825
-    if(data[item.id] && data[item.id] != '') {
826
-      obj[item.id] = data[item.id]
827
-    }
828
-  });
829
-  return obj
830
-}
831 593
 
832 594
 onMounted(()=>{
833 595
   nextTick(async ()=>{
@@ -844,6 +606,52 @@ onMounted(()=>{
844 606
     get_ruleConfig_info() //规则配置获取
845 607
   })
846 608
 })
609
+
610
+// S 每个模块判断是否可添加编辑
611
+const { 
612
+  judgeEvent
613
+ } = handleJudge({
614
+  pageInfo,
615
+  basicInfoData,
616
+  originalityBasicInfoData,
617
+  cMaterial,
618
+})
619
+// E 每个模块判断是否可添加编辑
620
+
621
+// S 创意素材
622
+const {
623
+  assignEvent_CreativeMaterial,
624
+  get_cover_info,
625
+  close_reuse_loading,
626
+} = handleMultiple({
627
+  originalityBasicInfoData, 
628
+  ResuseConfigRef, 
629
+  computeCount,
630
+  cMaterial
631
+})
632
+// E 创意素材
633
+
634
+// S 广告基本信息 及 外部配置
635
+const {
636
+  basicInfoClose,
637
+  getAdPresetsInfo,
638
+  basicOuterClick,
639
+  basicOuterClose,
640
+  getCommonValue,
641
+  isCompleteEvent
642
+} = handleAdBasic({
643
+  CreativeMaterialRef,
644
+  CopywriterRef,
645
+  LandPageRef,
646
+  targetRef,
647
+  pageInfo,
648
+  basicInfoData,
649
+  clearOriginalityInfo,
650
+  updateHaveContent,
651
+  judgeEvent,
652
+})
653
+// E 广告基本信息 及 外部配置
654
+
847 655
 //传值
848 656
 provide('accountIds',toRef(pageInfo,'accIdsList'))
849 657
 

+ 13 - 8
src/components/businessMoudle/batchGdt/configArea/originalityBasic/components/brand/profiles.vue

@@ -74,26 +74,31 @@ onMounted(()=>{
74 74
   })
75 75
 })
76 76
 const init = (keyword)=>{
77
-  getListPage({
78
-    page: 1,
79
-    page_size: 20,
80
-    keyword: keyword,
81
-    type: 'profiles'
82
-  }).then((res)=>{
83
-    options.value = res.data
77
+  return new Promise((resolve) => {
78
+    getListPage({
79
+      page: 1,
80
+      page_size: 20,
81
+      keyword: keyword,
82
+      type: 'profiles'
83
+    }).then((res:any)=>{
84
+      options.value = res.data
85
+      resolve(true)
86
+    })
84 87
   })
88
+  
85 89
 }
86 90
 const modelValue = ref()
87 91
 const remoteMethod = (query: string) => {
88 92
   init(query)
89 93
 }
90
-const selectChange = () => {
94
+const selectChange = async () => {
91 95
   if(profiles.value){
92 96
     let obj = {
93 97
       required: profiles.value.required,
94 98
       description: `请选择头像及昵称跳转页`,
95 99
       api_value: {},
96 100
     };
101
+    await init('')
97 102
     let arr = options.value.filter((v)=>{
98 103
       return v.id == modelValue.value
99 104
     })

+ 1 - 1
src/components/businessMoudle/batchGdt/configArea/originalityBasic/components/wechatChannelsSpec.vue

@@ -1,6 +1,6 @@
1 1
 <template>
2 2
   <div class="flex-baseline marT15" v-if="adTemplateItem?.adcreative_elements?.wechat_channels_spec">
3
-    <div class="form-block-item-title">微信视频号名称</div>
3
+    <div class="form-block-item-title">微信视频号名称</div> 废弃
4 4
     <div class="marT15">
5 5
       <div class="flex"><el-input v-model="username" placeholder="请输入微信视频号名称" max="200" style="width:300px" @input="radioChange"/><span style="color:#666;font-size:14px;margin-left:4px;">{{ username?.length }}/200</span></div>
6 6
     </div>

+ 4 - 10
src/components/businessMoudle/batchGdt/configArea/originalityBasic/index.vue

@@ -60,9 +60,6 @@
60 60
             <!-- 视频广告评论开关 -->
61 61
             <FeedsVideoCommentSwitch ref="FeedsVideoCommentSwitchRef" :adTemplateItem="adTemplateItem"
62 62
               @backhaul="backhaul"></FeedsVideoCommentSwitch>
63
-            <!-- 微信视频号名称 -->
64
-            <WechatChannelsSpec ref="WechatChannelsSpecRef" :adTemplateItem="adTemplateItem"
65
-              @backhaul="backhaul"></WechatChannelsSpec>
66 63
             <!-- 创意名称 -->
67 64
             <wildcard ref="wildcardRef" class="marT15" title="创意名称" placeholder="请输入创意名称"
68 65
               :fillBack="`${adTemplateItem.adcreative_template_appellation}-创意-<时间戳>-<标号>`" @change="(val) => {
@@ -107,7 +104,6 @@ import FloatingZoneStruct from './components/floatingZoneStruct.vue'
107 104
 import FeedsVideoCommentSwitch from './components/feedsVideoCommentSwitch.vue';
108 105
 import VideoEndPage from './components/videoEndPage.vue';
109 106
 import wildcard from '../basicInfo/components/wildcard.vue';
110
-import WechatChannelsSpec from './components/wechatChannelsSpec.vue'
111 107
 import Label from './components/label/index.vue'
112 108
 import _ from 'lodash';
113 109
 // import DynamicCreativeGroupUsed from './components/dynamicCreativeGroupUsed.vue';
@@ -123,7 +119,6 @@ const FeedsVideoCommentSwitchRef = ref()
123 119
 const ButtonTextRef = ref()
124 120
 const VideoEndPageRef = ref()
125 121
 const wildcardRef = ref()
126
-const WechatChannelsSpecRef = ref()
127 122
 /** E 创意资产 */
128 123
 
129 124
 const props = defineProps({
@@ -212,7 +207,7 @@ const backhaul = (obj) => {
212 207
 }
213 208
 /**确认 isMultiplex是否复用 */
214 209
 const submitEvent = (isMultiplex?: boolean, multiplexApiForm:any[] = []) => {
215
-  console.log(form)
210
+  console.log('2222', form)
216 211
   let promise_arr: any = []
217 212
   let multiplex_load_acc: any[] = [];//复用需要上传的账号
218 213
   for (let i in form) {//检索是否有未填写信息
@@ -356,7 +351,7 @@ const brand_event = (type, { isMultiplex, multiplex_load_acc }: { isMultiplex?:
356 351
         return
357 352
       }
358 353
       // E 复用判断
359
-      adcreativesAddUpload(params).then((res) => {
354
+      adcreativesAddUpload(params).then((res:any) => {
360 355
         adcreativesGetUploadResEvent({
361 356
           'up_record_id': res.up_record_id, 'target_id': target_id, 'count': 15, 'type': type, 'cb': (flag) => {
362 357
             if (flag) {
@@ -376,7 +371,7 @@ const brand_event = (type, { isMultiplex, multiplex_load_acc }: { isMultiplex?:
376 371
 const adcreativesGetUploadResEvent = ({ up_record_id, target_id, count, type, cb }: IAdcreativesGetUploadResEvent) => {
377 372
   adcreativesGetUploadRes({
378 373
     up_record_id: up_record_id
379
-  }).then((result) => {
374
+  }).then((result:any) => {
380 375
     if (result.status == 2) {
381 376
       ElMessage.error(result.err_msg)
382 377
       cb ? cb(false) : '';
@@ -437,7 +432,7 @@ const getAdcreativeTemplateInfo = () => {
437 432
   if (props.adBasicInfo.automatic_site == '1') {
438 433
     params['automatic_site_enabled'] = true
439 434
   }
440
-  getAdcreativeTemplate(params).then((res) => {
435
+  getAdcreativeTemplate(params).then((res:any) => {
441 436
     adTemplateItem.value = res
442 437
     if (!res || res?.length <= 0) {
443 438
       ElMessage.warning(`当前广告版位下,自定义创意不支持该${templateCurr.value.adcreative_template_appellation}。`)
@@ -507,7 +502,6 @@ const elementFillBack = () => {
507 502
       DataDisplayRef.value?.switchShow(fillBackInfo.value.data_display)
508 503
       FloatingZoneStructRef.value?.switchShow(fillBackInfo.value.floating_zone_struct)
509 504
       FeedsVideoCommentSwitchRef.value?.switchShow(fillBackInfo.value.feeds_video_comment_switch)
510
-      WechatChannelsSpecRef.value?.switchShow(fillBackInfo.value.wechat_channels_spec)
511 505
       ButtonTextRef.value?.switchShow(fillBackInfo.value.button_text)
512 506
       VideoEndPageRef.value?.switchShow(fillBackInfo.value.end_page)
513 507
       wildcardRef.value?.switchShow(fillBackInfo.value.adcreative_name)

+ 199 - 0
src/components/businessMoudle/batchGdt/configArea/ts/adBasic.ts

@@ -0,0 +1,199 @@
1
+import { ref, computed, reactive, nextTick } from 'vue'
2
+import { reactiveTableAndAny } from '@/api/ApiModel'
3
+import { getAdPresets, getPromotedObjectType } from '../basicInfo/ts/basicApi'
4
+import { FillBackData } from '../basicInfo/ts/fillBack'
5
+import _ from 'lodash'
6
+
7
+export function basicInfoDeclare() {
8
+  //广告基本信息
9
+  const basicInfoData = reactive<any>({
10
+    visible: false,
11
+    copywriting: [],
12
+    fillBack: {},
13
+    outerConfig: { //外层配置
14
+      attributionOuter: {
15
+        enabled: false,
16
+        visible: false,
17
+        optional: false,
18
+        isComplete: false, // 是否完成填写
19
+        name: '精准匹配归因',
20
+        value: {},
21
+      },
22
+      unionPosition: {
23
+        enabled: false,
24
+        visible: false,
25
+        optional: false,
26
+        isComplete: false, // 是否完成填写
27
+        infoSelect: [],//流量包type
28
+        name: '优量汇流量包',
29
+        value: {},
30
+      },
31
+      weChatVideoAccount: {
32
+        enabled: false,
33
+        visible: false,
34
+        optional: false,
35
+        isComplete: false, // 是否完成填写
36
+        name: '配置视频号',
37
+        value: {},
38
+      },
39
+      expandPopulation: {
40
+        enabled: false, //是否需要配置
41
+        visible: false, //对应弹框显隐
42
+        optional: true, //选填
43
+        isComplete: false, // 是否完成填写
44
+        name: '扩量种子人群(选填)',
45
+        value: {},
46
+      },
47
+      targetingPartyData: {
48
+        enabled: false, //是否需要配置
49
+        visible: false,
50
+        optional: true,
51
+        isComplete: false, // 是否完成填写
52
+        name: '一方数据助攻(选填)',
53
+        value: {},
54
+      },
55
+
56
+    }
57
+  })
58
+  return {
59
+    basicInfoData
60
+  }
61
+}
62
+
63
+
64
+interface IHandleAdBasic {
65
+  updateHaveContent: (...args: any[]) => void,
66
+  judgeEvent: (...args: any[]) => boolean,
67
+  clearOriginalityInfo: (...args: any[]) => void,
68
+  [propName: string]: any
69
+}
70
+//广告基本信息 - 广告外层配置
71
+export function handleAdBasic({
72
+  clearOriginalityInfo,
73
+  updateHaveContent,
74
+  judgeEvent,
75
+  basicInfoData,
76
+  CreativeMaterialRef,
77
+  CopywriterRef,
78
+  LandPageRef,
79
+  targetRef,
80
+  pageInfo
81
+}: IHandleAdBasic) {
82
+  /**广告基础信息回调 */
83
+  const basicInfoClose = (obj) => {
84
+    if (obj?.type == 'update') {
85
+      //判断版位是否变化,版位变化则创意基本信息、创意文案、落地页 、素材 清空
86
+      if (obj.params.automatic_site != basicInfoData.fillBack?.automatic_site || obj.params.site_ids != basicInfoData.fillBack?.site_ids) {
87
+        clearOriginalityInfo()
88
+        updateHaveContent(5, 0, false, true)
89
+        CreativeMaterialRef.value?.clearAllEvent()
90
+        updateHaveContent(6, 0, false, true)
91
+        if (CopywriterRef.value) {
92
+          CopywriterRef.value[0]?.clearEvent()
93
+        }
94
+        updateHaveContent(7, 0, false, true)
95
+        if (LandPageRef.value) {
96
+          LandPageRef.value[0]?.clearEvent()
97
+        }
98
+        updateHaveContent(8, 0, false, true)
99
+      }
100
+
101
+      basicInfoData.copywriting = obj.copywriting
102
+      basicInfoData.fillBack = obj.params
103
+      getButtonBasicOuter(obj.params)
104
+    }
105
+    basicInfoData.visible = false
106
+  }
107
+  /**广告预存信息获取 */
108
+  const getAdPresetsInfo = () => {
109
+    getAdPresets({ 'promoted_object_type': targetRef.value?.value }).then((res) => {
110
+      getButtonBasicOuter(res)
111
+      FillBackData({
112
+        data: res, type: 'api', cb: (data: { params: any, copywriting: [] }) => {
113
+          if (data.copywriting && Array.isArray(data.copywriting) && data.copywriting.length > 0) {
114
+            basicInfoData.copywriting = data.copywriting
115
+            basicInfoData.fillBack = data.params
116
+            updateHaveContent(2, -1, false)
117
+          }
118
+        }
119
+      })
120
+    })
121
+  }
122
+  /**广告信息外部配置获取 */
123
+  const getButtonBasicOuter = (res) => {
124
+    console.log(res)
125
+    for (let i in basicInfoData.outerConfig) {
126
+      basicInfoData.outerConfig[i].enabled = false
127
+    }
128
+    if (res?.expand_enabled == 1) { // 扩量种子人群
129
+      basicInfoData.outerConfig.expandPopulation.enabled = true;
130
+    }
131
+    if (res?.smart_targeting_switch == 1) { // 智能定向外层配置
132
+      basicInfoData.outerConfig.targetingPartyData.enabled = true;
133
+    }
134
+    if (res?.attribution_type == 2) { // 精准匹配归因
135
+      basicInfoData.outerConfig.attributionOuter.enabled = true;
136
+    }
137
+    if(res?.site_ids.indexOf('SITE_SET_CHANNELS') != -1){ //微信视频号
138
+      basicInfoData.outerConfig.weChatVideoAccount.enabled = true;
139
+    }
140
+    if (res?.union_position_enabled == 1 || res?.exclude_union_position_enabled == 1) { //优量汇流量包 -- 需要定向包完成填写
141
+      basicInfoData.outerConfig.unionPosition.enabled = true;
142
+      basicInfoData.outerConfig.unionPosition.infoSelect = []
143
+      res?.union_position_enabled == 1 && basicInfoData.outerConfig.unionPosition.infoSelect.push({ name: '定投流量包', id: 1 })
144
+      res?.exclude_union_position_enabled == 1 && basicInfoData.outerConfig.unionPosition.infoSelect.push({ name: '屏蔽流量包', id: 2 })
145
+    }
146
+  }
147
+  /**点击基础信息外层配置 */
148
+  const basicOuterClick = (key) => {
149
+    if (key == 'unionPosition') { //优量汇流量包 - 需要定向包完成填写
150
+      if (!judgeEvent(-2)) return
151
+    }
152
+    basicInfoData.outerConfig[key].visible = true;
153
+  }
154
+  /** 外部配置回调 */
155
+  interface IBasicOuterClose {
156
+    'type': string,
157
+    'key': string,
158
+    'val'?: string
159
+  }
160
+  const basicOuterClose = ({ key, val, type }: IBasicOuterClose) => {
161
+    basicInfoData.outerConfig[key].visible = false;
162
+    if (type == 'submit') {
163
+      basicInfoData.outerConfig[key].value = val ? val : {};
164
+      basicInfoData.outerConfig[key].isComplete = isCompleteEvent(basicInfoData.outerConfig[key]);
165
+    }
166
+  }
167
+
168
+  const isCompleteEvent = (data) => {
169
+    for (let i = 0; i < pageInfo.accIdsList.length; i++) {
170
+      let info = data.value[pageInfo.accIdsList[i].id]
171
+      if (Array.isArray(info) && info.length == 0) {
172
+        return false
173
+      } else if (Object.prototype.toString.call(info) == '[object Object]' && Object.keys(info).length == 0) {
174
+        return false
175
+      } else if (!info || info == '') {
176
+        return false
177
+      }
178
+    }
179
+    return true
180
+  }
181
+  /**基础外部配置 - 获取对象公共数据 */
182
+  const getCommonValue = (data) => {
183
+    let obj = {}
184
+    pageInfo.accIdsList.forEach((item) => {
185
+      if (data[item.id] && data[item.id] != '') {
186
+        obj[item.id] = data[item.id]
187
+      }
188
+    });
189
+    return obj
190
+  }
191
+  return {
192
+    basicInfoClose,
193
+    getAdPresetsInfo,
194
+    basicOuterClick,
195
+    basicOuterClose,
196
+    getCommonValue,
197
+    isCompleteEvent
198
+  }
199
+}

+ 110 - 0
src/components/businessMoudle/batchGdt/configArea/ts/judgeEvent.ts

@@ -0,0 +1,110 @@
1
+import { getDay } from "@/common/common"
2
+import { ElMessage } from "element-plus"
3
+import _ from "lodash"
4
+
5
+function handleJudge({
6
+  pageInfo,
7
+  basicInfoData,
8
+  originalityBasicInfoData,
9
+  cMaterial,
10
+}) {
11
+  /**每个模块判断是否可以点击添加 id:模块ID*/
12
+  const judgeEvent = (id, msgFlag?) => {
13
+    if (pageInfo.accIdsList && pageInfo.accIdsList.length <= 0) {
14
+      !msgFlag && ElMessage.error('请选择媒体账户!')
15
+      return false
16
+    }
17
+    if (!pageInfo.targetValue || pageInfo.targetValue == '') {
18
+      !msgFlag && ElMessage.error('请选择推广目标!')
19
+      return false
20
+    }
21
+
22
+    if (id == 2) return true;//广告基本信息
23
+    if (!basicInfoData.fillBack || basicInfoData.fillBack == '' || JSON.stringify(basicInfoData.fillBack) == '{}') {
24
+      !msgFlag && ElMessage.warning('请完善广告基本信息!')
25
+      return false
26
+    }
27
+    if (id == 3) return true;//定向包
28
+    if (id == 5) return true;//创意基本信息
29
+
30
+
31
+    if (id != 6) {
32
+      if ((!pageInfo.directObj || pageInfo.directObj == '' || JSON.stringify(pageInfo.directObj) == '{}' || !pageInfo.directObj?.chooseList)) {
33
+        !msgFlag && ElMessage.warning('请选择定向包!')
34
+        return false
35
+      }
36
+      for (let i = 0; i < pageInfo.directObj?.chooseList.length; i++) {
37
+        let item = pageInfo.directObj?.chooseList[i].chooseList
38
+        if (!item || item.length == 0) {
39
+          !msgFlag && ElMessage.warning('请选择定向包!')
40
+          return false
41
+        }
42
+      }
43
+    }
44
+    if (id == -2) return true; //外部配置,需要定向包配置完成
45
+    if (!originalityBasicInfoData.params || originalityBasicInfoData.params == '' || originalityBasicInfoData.params.length <= 0) {
46
+      !msgFlag && ElMessage.warning('完善创意基本信息!')
47
+      return false
48
+    }
49
+    if (id == 6) return true;//创意素材 不用判断定向包是否填写
50
+    if (!cMaterial.resResult || cMaterial.resResult.length == 0) {
51
+      !msgFlag && ElMessage.warning('请选择创意素材!')
52
+      return false
53
+    }
54
+    if (id == 7) {//创意文案
55
+      if (!originalityBasicInfoData.apiResult?.adTemplateItem?.adcreative_elements?.description) {
56
+        !msgFlag && ElMessage.warning('此创意形式下不可使用创意文案!')
57
+        return false
58
+      } else {
59
+        return true
60
+      }
61
+    };
62
+    if (id == 8) {
63
+      if (!originalityBasicInfoData?.receiveForm?.landingPageExample?.page_type) {
64
+        !msgFlag && ElMessage.warning('此创意形式下不可使用落地页!')
65
+        return false;//落地页
66
+      } else {
67
+        return true
68
+      }
69
+    }
70
+    if (id == -1) { // 提交预览时,判断是否全部完善
71
+      if (originalityBasicInfoData.apiResult?.adTemplateItem?.adcreative_elements?.description && (!pageInfo.copywriterInfoData.data || pageInfo.copywriterInfoData.data.length == 0 || JSON.stringify(pageInfo.copywriterInfoData.data) == '{}')) {
72
+        !msgFlag && ElMessage.warning('请选择创意文案!')
73
+        return false
74
+      }
75
+      if (originalityBasicInfoData?.receiveForm?.landingPageExample?.page_type && (!pageInfo.copyLandPageInfoData.data || JSON.stringify(pageInfo.copyLandPageInfoData.data) == '{}' || pageInfo.copyLandPageInfoData.data.length == 0)) {
76
+        !msgFlag && ElMessage.warning('请选择落地页!')
77
+        return false
78
+      }
79
+      for (let i in basicInfoData.outerConfig) {
80
+        if (basicInfoData.outerConfig[i].enabled && !basicInfoData.outerConfig[i].optional && !basicInfoData.outerConfig[i].isComplete) {
81
+          !msgFlag && ElMessage.error(`请配置${basicInfoData.outerConfig[i].name}!`)
82
+          return false
83
+        }
84
+      }
85
+      //判断广告基本信息投放日期是否大于今日
86
+      if (new Date(basicInfoData.fillBack.begin_date).getTime() < new Date(getDay(0, false) as string).getTime()) {
87
+        !msgFlag && ElMessage.error('开始投放日期必须大于今日!')
88
+        return false
89
+      }
90
+      if (basicInfoData.fillBack.first_day_begin_time && basicInfoData.fillBack.first_day_begin_time != '') {
91
+        let daysOfWeek = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'];
92
+        let time_series = _.cloneDeep(basicInfoData.fillBack.time_series)?.split(',')
93
+        for (let i = 0; i < time_series.length; i++) {
94
+          time_series[i] = time_series[i].split('')
95
+        }
96
+        let hour = _.cloneDeep(basicInfoData.fillBack.first_day_begin_time).split(':')[0]
97
+        let week = new Date(basicInfoData.fillBack.begin_date).getDay()
98
+        if (time_series[week == 0 ? 6 : (week - 1)][Number(hour) * 2] != 1) {
99
+          !msgFlag && ElMessage.error(`当前投放开始日期为:${basicInfoData.fillBack.begin_date},${daysOfWeek[week]}, 投放时间段中应包含${daysOfWeek[week]}的${basicInfoData.fillBack.first_day_begin_time.slice(0, 5)}`)
100
+          return false
101
+        }
102
+      }
103
+    }
104
+    return true
105
+  }
106
+  return {
107
+    judgeEvent
108
+  }
109
+}
110
+export default handleJudge

+ 19 - 16
src/components/businessMoudle/batchGdt/configArea/ts/material.ts

@@ -1,13 +1,9 @@
1
-import { ref, computed, reactive, nextTick } from 'vue'
1
+import { ref, reactive, nextTick } from 'vue'
2 2
 import { reactiveTableAndAny } from '@/api/ApiModel'
3 3
 import _ from 'lodash'
4 4
 
5
-//创意素材
6
-function handleMultiple({
7
-  originalityBasicInfoData,
8
-  computeCount,
9
-  ResuseConfigRef
10
-}) {
5
+//变量声明
6
+export function materialDeclare () {
11 7
   const CreativeMaterialRef = ref<{
12 8
     switchShow: (val: boolean, isEdit: boolean, arr: any) => void,
13 9
     clearAllEvent: () => void, creatice_reuseEvent: () => void, deleAcEvent: (arr: any, haveAssign: boolean) => void
@@ -28,7 +24,19 @@ function handleMultiple({
28 24
     },
29 25
     imgOrVideoInfo: {},//视频或者图片需要的数据详情
30 26
   })
27
+  return {
28
+    CreativeMaterialRef,
29
+    cMaterial
30
+  }
31
+}
31 32
 
33
+//创意素材
34
+export function handleMultiple({
35
+  originalityBasicInfoData,
36
+  computeCount,
37
+  ResuseConfigRef,
38
+  cMaterial
39
+}) {
32 40
   //处理素材返回来的值
33 41
   const handle_resResult = (resResult: any, val: any) => {
34 42
     // let str_imageorVideo: any = originalityBasicInfoData?.receiveForm?.originalityForm?.api_value?.originalityForm
@@ -49,7 +57,8 @@ function handleMultiple({
49 57
             if(cMaterial.haveCoverOrVideo == 1) {//视频和图片
50 58
               if (item[i]?.material_res?.video_id) {
51 59
                 setValueInNestedObject(itemObj, 'video_id', item[i].material_res.video_id);
52
-              } else if (item[i]?.material_res?.cover?.image_id) {
60
+              }
61
+              if (item[i]?.material_res?.cover?.image_id) {
53 62
                 setValueInNestedObject(itemObj, 'image_id', item[i].material_res.cover.image_id);
54 63
               }
55 64
               if (cMaterial.haveShowVideoObj.show && cMaterial.haveShowVideoObj.name) {
@@ -114,12 +123,10 @@ function handleMultiple({
114 123
     val.forEach(vItem => {
115 124
       cMaterial_resResult_list = cMaterial_resResult_list.concat(vItem.resResult)
116 125
     })
117
-    console.log('cMaterial_resResult_list', cMaterial_resResult_list);
118 126
 
119 127
     let arr_: any = []
120 128
     let cloneRes: any = await handle_resResult(_.cloneDeep(cMaterial_resResult_list), _.cloneDeep(val))
121 129
     //图片形式的originalityBasicInfoData.params格式需要给
122
-    console.log(originalityBasicInfoData, 'assignEvent_CreativeMaterial');
123 130
     console.log(cloneRes, 'cloneRes');
124 131
     await originalityBasicInfoData.params.forEach(item => {
125 132
       cloneRes.forEach(cItem => {
@@ -204,7 +211,6 @@ function handleMultiple({
204 211
       cMaterial.array_property = obj?.image_list?.array_property;
205 212
       cMaterial.imgOrVideoInfo['image_list'] = 'image_list'
206 213
     }
207
-    console.log('situationArr', situationArr)
208 214
     // 留口子 现在逻辑是image video image_list不共存 暂未发现共存的情况
209 215
     situationArr.forEach((item)=>{
210 216
       if(item.type == 'video'){
@@ -224,6 +230,7 @@ function handleMultiple({
224 230
     } else if (transit_arr.includes('image_list')) {
225 231
       cMaterial.haveCoverOrVideo = 3
226 232
     }
233
+    console.log(situationArr, '===cMaterial.haveCoverOrVideo ==>', cMaterial.haveCoverOrVideo)
227 234
   }
228 235
 
229 236
   //关闭复用loading和弹框
@@ -252,12 +259,8 @@ function handleMultiple({
252 259
   }
253 260
 
254 261
   return {
255
-    CreativeMaterialRef,
256
-    cMaterial,
257 262
     assignEvent_CreativeMaterial,
258 263
     get_cover_info,
259 264
     close_reuse_loading
260 265
   }
261
-}
262
-
263
-export default handleMultiple
266
+}