|
@@ -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
|
|