|
@@ -1,658 +0,0 @@
|
1
|
|
-<template>
|
2
|
|
- <div>
|
3
|
|
- <Dialog
|
4
|
|
- dialog_key="creaMaterial"
|
5
|
|
- :dialogVisible="dialogShow"
|
6
|
|
- @confirm="confirmEvent"
|
7
|
|
- @close="dialogShow = false"
|
8
|
|
- :closeOnModal="false"
|
9
|
|
- width="1000px"
|
10
|
|
- height="calc(100vh - 190px)"
|
11
|
|
- top="8px"
|
12
|
|
- dialog-title="创意素材">
|
13
|
|
- <template v-slot:content>
|
14
|
|
- <template v-if="haveCoverOrVideo == 1">
|
15
|
|
- <RadioGroup :id="pageInfo.radioId"
|
16
|
|
- :radioList="coverRadioList.list"
|
17
|
|
- :echoVal="coverRadioList.radioVal"
|
18
|
|
- :title="coverRadioList.name"
|
19
|
|
- @returnEvent="val=>{coverRadioList.radioVal = val}"></RadioGroup>
|
20
|
|
- </template>
|
21
|
|
- <template v-if="haveShowVideoObj.show">
|
22
|
|
- <RadioGroup :id="pageInfo.radioId"
|
23
|
|
- :radioList="videoRadioList.list"
|
24
|
|
- :echoVal="videoRadioList.radioVal"
|
25
|
|
- :title="videoRadioList.name"
|
26
|
|
- :haveNotes="videoRadioList.haveNotes"
|
27
|
|
- @returnEvent="val=>{videoRadioList.radioVal = val}"></RadioGroup>
|
28
|
|
- </template>
|
29
|
|
- <div class="titleBox flex borCon">
|
30
|
|
- <div class="title">创意内容</div>
|
31
|
|
- <div class="smallTitle lMar20">创意组数量: {{pageInfo.creativeTeamList&&pageInfo.creativeTeamList.length}}组</div>
|
32
|
|
- <div class="lMarauto">
|
33
|
|
- <el-button type="primary" v-if="haveCoverOrVideo == 1 || haveCoverOrVideo == 2" @click="openLibraryDialog(1)">批量添加视频</el-button>
|
34
|
|
- <el-button type="primary" v-if="haveCoverOrVideo == 1 || haveCoverOrVideo == 3" @click="openLibraryDialog(2)">批量添加封面</el-button>
|
35
|
|
- <el-button type="primary" @click="openTestNew">一键测新</el-button>
|
36
|
|
- </div>
|
37
|
|
- </div>
|
38
|
|
-
|
39
|
|
- <div class="content" v-loading="loading">
|
40
|
|
- {{pageInfo.creativeTeamList}}
|
41
|
|
- <template v-for="(item,idx) in pageInfo.creativeTeamList">
|
42
|
|
- <div class="flex tMar10" style="align-items: flex-start">
|
43
|
|
- <div class="TeamBox">
|
44
|
|
- <div class="TeamTitle flex">
|
45
|
|
- <div>创意组{{fillZero(idx+1)}}</div>
|
46
|
|
- <div class="lMarauto">
|
47
|
|
- <el-icon :size="14" color="#999" class="pointer" @click="item.show = !item.show"><i-ep-CaretBottom /></el-icon>
|
48
|
|
- <el-icon :size="14" color="red" class="lMar10 pointer" @click="deleItemEvent(item)"><i-ep-CircleClose /></el-icon>
|
49
|
|
- </div>
|
50
|
|
- </div>
|
51
|
|
- <div class="TeamContent">
|
52
|
|
- <el-collapse-transition>
|
53
|
|
- <CreativeTeam v-show="!item.show" :ITEM="item" :key="item.id"
|
54
|
|
- :minNum_imageList="minNum_imageList"
|
55
|
|
- :maxNum_imageList="maxNum_imageList"
|
56
|
|
- :typeList="haveCoverOrVideo == 3 ? [{name:'封面',key:'cover'}] :
|
57
|
|
- (haveCoverOrVideo == 2 ? [{name:'视频',key:'video'}] : [{name:'视频',key:'video'},{name:'封面',key:'cover'}])"
|
58
|
|
- @deleEvent="(type)=>{deleItemUrlEvent(item,type)}"
|
59
|
|
- @openEvent="(type,maxNum)=>{openLibraryDialog(type,maxNum,item.id)}"
|
60
|
|
- @autoCoverEvent="openAutoCover(item.itemId)"
|
61
|
|
- :video_tips="video_tips"
|
62
|
|
- :image_tips="image_tips"></CreativeTeam>
|
63
|
|
- </el-collapse-transition>
|
64
|
|
- </div>
|
65
|
|
- </div>
|
66
|
|
-
|
67
|
|
- <Tooltip notes="复制创意组" colorCss="c-theme" :iconSlotFalg="true">
|
68
|
|
- <template v-slot:iconSlot>
|
69
|
|
- <div class="iconBox" @click="copyItemEvent(item)">
|
70
|
|
- <el-icon :size="14" color="#3173FF"><i-ep-DocumentCopy /></el-icon>
|
71
|
|
- </div>
|
72
|
|
- </template>
|
73
|
|
- </Tooltip>
|
74
|
|
- </div>
|
75
|
|
- </template>
|
76
|
|
- <div class="addItem" @click="addItemEvent">添加创意组</div>
|
77
|
|
- </div>
|
78
|
|
- </template>
|
79
|
|
- <template v-slot:footerBtn>
|
80
|
|
- <el-button @click="clearEvent" size="default">清空</el-button>
|
81
|
|
- </template>
|
82
|
|
- </Dialog>
|
83
|
|
-
|
84
|
|
- <!--素材弹框-->
|
85
|
|
- <LibraryDialog ref="LibraryDialogRef"
|
86
|
|
- @assignEvent="assignEvent_LibraryDialog"
|
87
|
|
- :is_generate_cover="coverRadioList.radioVal"
|
88
|
|
- :video_tips="video_tips"
|
89
|
|
- :image_tips="image_tips"></LibraryDialog>
|
90
|
|
- <!-- 智能封面-->
|
91
|
|
- <AutoCoverDialog ref="AutoCoverDialogRef" @assignEvent="assignEvent_AutoCoverDialog"></AutoCoverDialog>
|
92
|
|
- <!-- 一件测新-->
|
93
|
|
- <TestNewDialog ref="TestNewDialogRef"
|
94
|
|
- @assignEvent="assignEvent_LibraryDialog"
|
95
|
|
- :propInfo="{testNewType,
|
96
|
|
- is_generate_cover:coverRadioList.radioVal,
|
97
|
|
- video_tips,
|
98
|
|
- image_tips
|
99
|
|
- }"></TestNewDialog>
|
100
|
|
- </div>
|
101
|
|
-</template>
|
102
|
|
-<script setup lang="ts">
|
103
|
|
-import RadioGroup from '@/components/businessMoudle/batchGdt/configArea/directPacket/common/radioGroup.vue'
|
104
|
|
-import CreativeTeam from '@/components/businessMoudle/batchGdt/configArea/creativeMaterial/creativeTeam.vue'
|
105
|
|
-import LibraryDialog from '@/components/businessMoudle/batchGdt/configArea/creativeMaterial/libraryDialog.vue'
|
106
|
|
-import AutoCoverDialog from '@/components/businessMoudle/batchGdt/configArea/creativeMaterial/autoCover.vue'
|
107
|
|
-import TestNewDialog from '@/components/businessMoudle/batchGdt/configArea/creativeMaterial/testNew.vue'
|
108
|
|
-import Tooltip from '@/components/capsulationMoudle/_tooltip.vue'
|
109
|
|
-import {getCurrentInstance, inject, nextTick, onMounted, reactive, ref, watch} from "vue";
|
110
|
|
-import {reactiveTableAndAny} from "@/api/ApiModel";
|
111
|
|
-import Dialog from '@/components/capsulationMoudle/_dialog.vue'
|
112
|
|
-import {fillZero} from '@/common/common'
|
113
|
|
-import {ElMessage} from "element-plus";
|
114
|
|
-import _ from "lodash";
|
115
|
|
-import {uploadAddGetResTs} from "@/components/businessMoudle/batchGdt/configArea/creativeMaterial/ts/uploadAddGetRes";
|
116
|
|
-
|
117
|
|
-
|
118
|
|
-const { proxy } = getCurrentInstance() as any;
|
119
|
|
-// 全局方法定义
|
120
|
|
-const NumberHandle = proxy.$NumberHandle
|
121
|
|
-
|
122
|
|
-const emit = defineEmits<{
|
123
|
|
- (event: "assignEvent", val: any, videoOnPuse?:any): void; //赋值给父组件
|
124
|
|
- (event: "closeLoading"): void; //赋值给父组件
|
125
|
|
-}>();
|
126
|
|
-
|
127
|
|
-const props = withDefaults(defineProps<{
|
128
|
|
- haveCoverOrVideo:number|string,
|
129
|
|
- video_tips:any,
|
130
|
|
- image_tips:any,
|
131
|
|
- testNewType?:string,
|
132
|
|
- haveShowVideoObj?:any,
|
133
|
|
- minNum_imageList?:number,
|
134
|
|
- maxNum_imageList?:number,
|
135
|
|
-}>(), {
|
136
|
|
- haveCoverOrVideo:1,
|
137
|
|
- testNewType:'video',
|
138
|
|
- video_tips:{},
|
139
|
|
- image_tips:{},
|
140
|
|
- haveShowVideoObj:{},
|
141
|
|
- minNum_imageList:1,
|
142
|
|
- maxNum_imageList:3,
|
143
|
|
-})
|
144
|
|
-
|
145
|
|
-interface radioFace{
|
146
|
|
- value:number | string,
|
147
|
|
- name:string,
|
148
|
|
- EgName:string,
|
149
|
|
- radioVal:string,
|
150
|
|
- haveNotes:boolean,
|
151
|
|
- list:any
|
152
|
|
-}
|
153
|
|
-const coverRadioList = reactive<radioFace>({
|
154
|
|
- value:1,
|
155
|
|
- name:'自动生成封面',
|
156
|
|
- EgName:'cover',
|
157
|
|
- radioVal:'On',
|
158
|
|
- haveNotes:true,
|
159
|
|
- list:[
|
160
|
|
- {name:'不开启',value:'Pause'},
|
161
|
|
- {name:'开启',value:'On'},
|
162
|
|
- ]
|
163
|
|
-})
|
164
|
|
-const videoRadioList = reactive<radioFace>({
|
165
|
|
- value:'false',
|
166
|
|
- name:'保存至视频号',
|
167
|
|
- EgName:'video',
|
168
|
|
- radioVal:'false',
|
169
|
|
- haveNotes:true,
|
170
|
|
- list:[
|
171
|
|
- {name:'不开启',value:'false'},
|
172
|
|
- {name:'开启',value:'true',notes:'开启后将同步上传至视频号动态、且广告投放期间浮层卡片可见'},
|
173
|
|
- ]
|
174
|
|
-})
|
175
|
|
-
|
176
|
|
-
|
177
|
|
-const inject_accountIds = inject('accountIds')
|
178
|
|
-
|
179
|
|
-//页面数据
|
180
|
|
-const pageInfo = reactive<reactiveTableAndAny>({
|
181
|
|
- radioId:0,
|
182
|
|
- creativeTeamList:[{
|
183
|
|
- id:0,
|
184
|
|
- itemId:0,
|
185
|
|
- videoUrl:'',
|
186
|
|
- picUrl:'',
|
187
|
|
- videoName:'',
|
188
|
|
- picName:'',
|
189
|
|
- }],
|
190
|
|
- updateKey:1,
|
191
|
|
- creativeTeamList_interim: [],//复制份
|
192
|
|
- keyUrl:'videoUrl',
|
193
|
|
- maxNum:0,//素材库最大可选个数
|
194
|
|
- CreativeTeamId:-1,//创意组ID
|
195
|
|
- resResult:[],//video_id和image_id在里边
|
196
|
|
- haveCoverOrVideoFlag:false
|
197
|
|
-})
|
198
|
|
-
|
199
|
|
-//删除创意组的视频或图片
|
200
|
|
-const deleItemUrlEvent = (item: any,type:string) => {
|
201
|
|
- let arr:any = pageInfo.creativeTeamList
|
202
|
|
- let idx:number = arr.findIndex(n=>n.id== item.id)
|
203
|
|
- let nameStr:string = type == 'videoUrl' ? 'videoName' : 'picName'
|
204
|
|
- arr[idx][type] = ''
|
205
|
|
- arr[idx][nameStr] = ''
|
206
|
|
- arr[idx].resResult = []
|
207
|
|
-}
|
208
|
|
-
|
209
|
|
-//添加创意组
|
210
|
|
-const addItemEvent = () => {
|
211
|
|
- let arr:any = pageInfo.creativeTeamList
|
212
|
|
- let _id:number = arr[arr.length-1].id
|
213
|
|
- arr.push({
|
214
|
|
- id:_id+1,
|
215
|
|
- itemId:0,
|
216
|
|
- videoUrl:'',
|
217
|
|
- picUrl:'',
|
218
|
|
- videoName:'',
|
219
|
|
- picName:'',
|
220
|
|
- })
|
221
|
|
-}
|
222
|
|
-//删除创意组
|
223
|
|
-const deleItemEvent = (item:any) => {
|
224
|
|
- let arr:any = pageInfo.creativeTeamList
|
225
|
|
- if(arr&&arr.length==1){
|
226
|
|
- ElMessage.error('至少保留1个创意组!')
|
227
|
|
- return
|
228
|
|
- }
|
229
|
|
- let idx:number = arr.findIndex(n=>n.id== item.id)
|
230
|
|
- arr.splice(idx,1)
|
231
|
|
- ElMessage.success('删除成功')
|
232
|
|
-}
|
233
|
|
-
|
234
|
|
-//复制创意组
|
235
|
|
-const copyItemEvent = async (item:any) => {
|
236
|
|
- let arr:any = pageInfo.creativeTeamList
|
237
|
|
- let idx:number = arr.findIndex(n=>n.id== item.id)
|
238
|
|
- let _id:number = arr[arr.length-1].id
|
239
|
|
- let obj:any = _.cloneDeep(arr[idx])
|
240
|
|
- if(await update_haveCoverOrVideoFlag(obj)){
|
241
|
|
- ElMessage.error('请完善素材')
|
242
|
|
- return
|
243
|
|
- }
|
244
|
|
- obj.id = _id+1
|
245
|
|
- arr.push(obj)
|
246
|
|
- ElMessage.success('复制成功')
|
247
|
|
-}
|
248
|
|
-
|
249
|
|
-//清空创意组
|
250
|
|
-const clearEvent = () => {
|
251
|
|
- pageInfo.creativeTeamList = [{
|
252
|
|
- id:0,
|
253
|
|
- itemId:0,
|
254
|
|
- videoUrl:'',
|
255
|
|
- picUrl:'',
|
256
|
|
- videoName:'',
|
257
|
|
- picName:'',
|
258
|
|
- }]
|
259
|
|
- pageInfo.creativeTeamList_interim = []
|
260
|
|
- pageInfo.resResult = []
|
261
|
|
-}
|
262
|
|
-
|
263
|
|
-//一件测新
|
264
|
|
-const TestNewDialogRef = ref<{switchShow:(val:boolean)=>void}>()
|
265
|
|
-const openTestNew = () => {
|
266
|
|
- nextTick(()=>{
|
267
|
|
- TestNewDialogRef.value!.switchShow(true)
|
268
|
|
- })
|
269
|
|
-}
|
270
|
|
-
|
271
|
|
-// 智能封面
|
272
|
|
-const AutoCoverDialogRef = ref<{switchShow:(val:boolean,fileId:number)=>void}>()
|
273
|
|
-const openAutoCover = (fileId:number) => {
|
274
|
|
- nextTick(()=>{
|
275
|
|
- AutoCoverDialogRef.value!.switchShow(true,fileId)
|
276
|
|
- })
|
277
|
|
-}
|
278
|
|
-const assignEvent_AutoCoverDialog = (val:string,fileId:number) => {
|
279
|
|
- if(fileId == 0){
|
280
|
|
- return
|
281
|
|
- }
|
282
|
|
- let arr:any = pageInfo.creativeTeamList
|
283
|
|
- let idx:number = arr.findIndex(n=>n.itemId == fileId)
|
284
|
|
- arr[idx].picUrl = val
|
285
|
|
-}
|
286
|
|
-
|
287
|
|
-//打开素材库弹框
|
288
|
|
-const LibraryDialogRef = ref<{switchShow:(val:boolean,mtype:number,maxNum:number)=>void}>()
|
289
|
|
-const openLibraryDialog = (type:number,maxNum?:any,id?:any) => {
|
290
|
|
- nextTick(()=>{
|
291
|
|
- pageInfo.maxNum = maxNum||0
|
292
|
|
- pageInfo.CreativeTeamId = (id || id==0) ? id : -1
|
293
|
|
- LibraryDialogRef.value!.switchShow(true,type,maxNum||0)
|
294
|
|
- })
|
295
|
|
-}
|
296
|
|
-//素材确认返回来的值
|
297
|
|
-const assignEvent_LibraryDialog = (val:any,mType:number,resResult:any) => {
|
298
|
|
- pageInfo.keyUrl = mType==1?'videoUrl':'picUrl'
|
299
|
|
- pageInfo.creativeTeamList_interim = _.cloneDeep(val)
|
300
|
|
- pageInfo.resResult = _.cloneDeep(resResult)
|
301
|
|
- pageInfo.updateKey++
|
302
|
|
-}
|
303
|
|
-
|
304
|
|
-//更新
|
305
|
|
-const update_haveCoverOrVideoFlag = (item:any) => {
|
306
|
|
- let flag:any = props.haveCoverOrVideo == 1 ? (!item.videoUrl || !item.picUrl) :
|
307
|
|
- (props.haveCoverOrVideo == 2 ? !item.videoUrl : !item.picUrl)
|
308
|
|
- return flag
|
309
|
|
-}
|
310
|
|
-
|
311
|
|
-//清空没用的
|
312
|
|
-const clearNoUse = (arr:any)=>{
|
313
|
|
- arr.forEach( async (item,idx)=>{
|
314
|
|
- if(await update_haveCoverOrVideoFlag(item)){
|
315
|
|
- arr.splice(idx,1)
|
316
|
|
- }
|
317
|
|
- })
|
318
|
|
-}
|
319
|
|
-
|
320
|
|
-watch(()=>pageInfo.updateKey,()=>{
|
321
|
|
- nextTick( ()=>{
|
322
|
|
- let arr:any = pageInfo.creativeTeamList
|
323
|
|
- let arr_interim:any = pageInfo.creativeTeamList_interim
|
324
|
|
- let CreativeTeamId:number = pageInfo.CreativeTeamId
|
325
|
|
- let flagCoverAuto:boolean = coverRadioList.radioVal == 'On' ? true :false//自动生成封面
|
326
|
|
- if(CreativeTeamId<0){ // 批量新增的时候
|
327
|
|
- //先清空没用的
|
328
|
|
- if(arr&&arr.length>=2){
|
329
|
|
- clearNoUse(arr)
|
330
|
|
- // arr.forEach( async (item,idx)=>{
|
331
|
|
- // if(await update_haveCoverOrVideoFlag(item)){
|
332
|
|
- // arr.splice(idx,1)
|
333
|
|
- // }
|
334
|
|
- // })
|
335
|
|
- }
|
336
|
|
- //将选中的全部push进去
|
337
|
|
- let _id:number = arr[arr.length-1].id
|
338
|
|
- if(props.haveCoverOrVideo == 2){ // 视频
|
339
|
|
- arr_interim.forEach((item,idx)=>{
|
340
|
|
- arr.push({
|
341
|
|
- id:_id+1+idx,
|
342
|
|
- itemId:item.id,
|
343
|
|
- videoUrl :item.oss_url,
|
344
|
|
- videoName:item.name,
|
345
|
|
- picUrl:flagCoverAuto ? item.pre_oss_url : '',
|
346
|
|
- picName:flagCoverAuto ? item.name : '',
|
347
|
|
- resResult: resResult_to_creativeTeamList(item.id)
|
348
|
|
- })
|
349
|
|
- })
|
350
|
|
- }else if(props.haveCoverOrVideo == 3){ //图片
|
351
|
|
- arr_interim.forEach((item,idx)=>{
|
352
|
|
- arr.push({
|
353
|
|
- id:_id+1+idx,
|
354
|
|
- itemId:item.id,
|
355
|
|
- picUrl :item.oss_url,
|
356
|
|
- picName:item.name,
|
357
|
|
- resResult: resResult_to_creativeTeamList(item.id)
|
358
|
|
- })
|
359
|
|
- })
|
360
|
|
- }else{ // 视频和封面
|
361
|
|
- if(pageInfo.keyUrl == 'videoUrl'){
|
362
|
|
- arr_interim.forEach((item,idx)=>{
|
363
|
|
- arr.push({
|
364
|
|
- id:_id+1+idx,
|
365
|
|
- itemId:item.id,
|
366
|
|
- videoUrl :item.oss_url,
|
367
|
|
- videoName:item.name,
|
368
|
|
- picUrl:flagCoverAuto ? item.pre_oss_url : '',
|
369
|
|
- picName:flagCoverAuto ? item.name : '',
|
370
|
|
- resResult: resResult_to_creativeTeamList(item.id)
|
371
|
|
- })
|
372
|
|
- })
|
373
|
|
- }else{ //封面
|
374
|
|
- arr_interim.forEach((item,idx)=>{
|
375
|
|
- arr.push({
|
376
|
|
- id:_id+1+idx,
|
377
|
|
- picUrl :item.oss_url,
|
378
|
|
- picName:item.name,
|
379
|
|
- })
|
380
|
|
- })
|
381
|
|
- }
|
382
|
|
- }
|
383
|
|
-
|
384
|
|
- //再清空没用的
|
385
|
|
- clearNoUse(arr)
|
386
|
|
- // arr.forEach(async (item,idx)=>{
|
387
|
|
- // if(await update_haveCoverOrVideoFlag(item)){
|
388
|
|
- // arr.splice(idx,1)
|
389
|
|
- // }
|
390
|
|
- // })
|
391
|
|
- }else{// 单个新增或更换
|
392
|
|
- let _idx:number = arr.findIndex(n=>n.id == CreativeTeamId)
|
393
|
|
- if(props.haveCoverOrVideo == 2) { // 视频
|
394
|
|
- arr_interim.forEach((item,idx)=>{
|
395
|
|
- arr[_idx].videoUrl = item.oss_url
|
396
|
|
- arr[_idx].videoName = item.name
|
397
|
|
- arr[_idx].itemId = item.id
|
398
|
|
- arr[_idx].resResult = resResult_to_creativeTeamList(item.id)
|
399
|
|
- if(arr[_idx].picUrl == '' && flagCoverAuto){
|
400
|
|
- arr[_idx].picUrl = item.pre_oss_url || ''
|
401
|
|
- }
|
402
|
|
- })
|
403
|
|
- }else if(props.haveCoverOrVideo == 3){ //图片
|
404
|
|
- arr_interim.forEach((item,idx)=>{
|
405
|
|
- arr[_idx].picUrl = item.oss_url
|
406
|
|
- arr[_idx].picName = item.name
|
407
|
|
- arr[_idx].itemId = item.id
|
408
|
|
- arr[_idx].resResult = resResult_to_creativeTeamList(item.id)
|
409
|
|
- })
|
410
|
|
- }else{
|
411
|
|
- if(pageInfo.keyUrl == 'videoUrl'){ //视频
|
412
|
|
- arr_interim.forEach((item,idx)=>{
|
413
|
|
- arr[_idx].videoUrl = item.oss_url
|
414
|
|
- arr[_idx].videoName = item.name
|
415
|
|
- arr[_idx].itemId = item.id
|
416
|
|
- arr[_idx].resResult = resResult_to_creativeTeamList(item.id)
|
417
|
|
- if(arr[_idx].picUrl == '' && flagCoverAuto){
|
418
|
|
- arr[_idx].picUrl = item.pre_oss_url || ''
|
419
|
|
- }
|
420
|
|
- })
|
421
|
|
- }else{ //封面
|
422
|
|
- arr_interim.forEach((item,idx)=>{
|
423
|
|
- arr[_idx].picUrl = item.oss_url
|
424
|
|
- arr[_idx].picName = item.name
|
425
|
|
- })
|
426
|
|
- }
|
427
|
|
- }
|
428
|
|
-
|
429
|
|
- }
|
430
|
|
- })
|
431
|
|
-})
|
432
|
|
-
|
433
|
|
-//将上传文件返回来的值 添加到 列表creativeTeamList中去
|
434
|
|
-const resResult_to_creativeTeamList = (id:any) => {
|
435
|
|
- //将上传后的每一个素材返回值分开给 itemId 下的resResult
|
436
|
|
- let resResult_arr:any = []
|
437
|
|
- pageInfo.resResult.forEach(resR=>{
|
438
|
|
- for(let r in resR){
|
439
|
|
- if(id == r){
|
440
|
|
- let obj:any = {}
|
441
|
|
- obj.account_id = resR.account_id
|
442
|
|
- obj[r] = resR[r]
|
443
|
|
- resResult_arr.push(obj)
|
444
|
|
- }
|
445
|
|
- }
|
446
|
|
- })
|
447
|
|
-
|
448
|
|
- return resResult_arr
|
449
|
|
-}
|
450
|
|
-
|
451
|
|
-
|
452
|
|
-// 切换显隐
|
453
|
|
-const dialogShow = ref<boolean>(false)
|
454
|
|
-const switchShow = (val:boolean,isEdit:boolean,arr:any)=>{
|
455
|
|
- dialogShow.value = val
|
456
|
|
- if(val){
|
457
|
|
- if(isEdit){ // 编辑
|
458
|
|
- videoRadioList.radioVal = props.haveShowVideoObj?.val?.toString()
|
459
|
|
- if(arr&&arr.length>0){
|
460
|
|
- pageInfo.creativeTeamList = _.cloneDeep(arr)
|
461
|
|
- }else{
|
462
|
|
- clearEvent()
|
463
|
|
- }
|
464
|
|
- }else{//新增
|
465
|
|
- clearEvent()
|
466
|
|
- }
|
467
|
|
- }
|
468
|
|
-}
|
469
|
|
-const loading = ref<boolean>(false)
|
470
|
|
-//确定按钮
|
471
|
|
-const confirmEvent = () => {
|
472
|
|
- let arr:any = pageInfo.creativeTeamList
|
473
|
|
- let flagBig:boolean = false // 大开关,判断是否还有未选的
|
474
|
|
- arr.forEach(async (item,idx)=>{
|
475
|
|
- if(await update_haveCoverOrVideoFlag(item)){
|
476
|
|
- flagBig = true
|
477
|
|
- }
|
478
|
|
- })
|
479
|
|
- if(flagBig){
|
480
|
|
- ElMessage.error('请完善素材')
|
481
|
|
- return
|
482
|
|
- }
|
483
|
|
- console.log(videoRadioList.radioVal,'videoRadioList.radioVal');
|
484
|
|
-
|
485
|
|
- if(props.haveShowVideoObj.show){
|
486
|
|
- emit('assignEvent',arr,videoRadioList.radioVal)
|
487
|
|
- }else{
|
488
|
|
- emit('assignEvent',arr)
|
489
|
|
- }
|
490
|
|
- dialogShow.value = false
|
491
|
|
-}
|
492
|
|
-
|
493
|
|
-//提供给主页面使用
|
494
|
|
-const clearAllEvent = async () => {
|
495
|
|
- pageInfo.creativeTeamList = []
|
496
|
|
- pageInfo.creativeTeamList_interim = []
|
497
|
|
- emit('assignEvent',pageInfo.creativeTeamList)
|
498
|
|
-}
|
499
|
|
-
|
500
|
|
-//删除一些账号的数据
|
501
|
|
-const deleAcEvent = (arr:any,haveAssign:boolean) => {
|
502
|
|
- //arr空 就清空数据
|
503
|
|
- console.log(arr,pageInfo.creativeTeamList)
|
504
|
|
- if(arr&&arr.length>0){
|
505
|
|
- arr.forEach(obj=>{
|
506
|
|
- if(pageInfo.creativeTeamList&&pageInfo.creativeTeamList.length>0){
|
507
|
|
- pageInfo.creativeTeamList.forEach((dir,dirIdx)=>{
|
508
|
|
- if(dir.resResult && Array.isArray(dir.resResult)) {
|
509
|
|
- dir.resResult.forEach((sub,subIdx)=>{
|
510
|
|
- if(sub.account_id == obj.id){}else{
|
511
|
|
- dir.resResult.splice(subIdx,1)
|
512
|
|
- }
|
513
|
|
- })
|
514
|
|
- }
|
515
|
|
- })
|
516
|
|
- }
|
517
|
|
- })
|
518
|
|
- if(haveAssign){
|
519
|
|
- emit('assignEvent',pageInfo.creativeTeamList)
|
520
|
|
- }
|
521
|
|
- }else{
|
522
|
|
- clearAllEvent()
|
523
|
|
- }
|
524
|
|
-}
|
525
|
|
-
|
526
|
|
-//复用 - 将选中的素材重新上传一遍到新账号 - 得到返回值 - 抛给主页面
|
527
|
|
-const get_new_ac_ids = () => {
|
528
|
|
- let arr:any = _.cloneDeep(inject_accountIds)
|
529
|
|
- let new_ac_ids:any = []
|
530
|
|
- let all_ac_ids:any = []
|
531
|
|
- pageInfo.creativeTeamList.forEach(pcItem=>{
|
532
|
|
- pcItem.resResult.forEach(sub=>{
|
533
|
|
- let ids_nn:number = all_ac_ids.findIndex(nn=>nn==sub.account_id)
|
534
|
|
- if(ids_nn==-1){
|
535
|
|
- all_ac_ids.push(sub.account_id)
|
536
|
|
- }
|
537
|
|
- })
|
538
|
|
- })
|
539
|
|
- arr._object[arr._key].forEach(a=>{
|
540
|
|
- let idx:number = all_ac_ids.findIndex(n=>n == a.id)
|
541
|
|
- if(idx==-1){
|
542
|
|
- new_ac_ids.push(a)
|
543
|
|
- }
|
544
|
|
- })
|
545
|
|
- console.log(new_ac_ids,'new_ac_ids');
|
546
|
|
- console.log(arr,'arr');
|
547
|
|
- return new_ac_ids
|
548
|
|
-}
|
549
|
|
-const get_new_target_ids = () => {
|
550
|
|
- let new_target_ids:any = []
|
551
|
|
- pageInfo.creativeTeamList.forEach(item=>{
|
552
|
|
- let ids_nn:number = new_target_ids.findIndex(nn=>nn==item.itemId)
|
553
|
|
- if(ids_nn==-1){
|
554
|
|
- new_target_ids.push(item.itemId)
|
555
|
|
- }
|
556
|
|
- })
|
557
|
|
- console.log(new_target_ids,'new_target_ids');
|
558
|
|
- return new_target_ids
|
559
|
|
-}
|
560
|
|
-
|
561
|
|
-
|
562
|
|
-const creatice_reuseEvent = async () => {
|
563
|
|
- requestObj.upload_flag = false
|
564
|
|
- clearTimeout(requestObj.timer_get_upload_res)
|
565
|
|
- let acArr:any = await get_new_ac_ids()
|
566
|
|
- let targetArr:any = await get_new_target_ids()
|
567
|
|
- if(targetArr&&targetArr.length==0){
|
568
|
|
- emit('closeLoading')
|
569
|
|
- return
|
570
|
|
- }
|
571
|
|
- if(acArr&&acArr.length==0){
|
572
|
|
- emit('closeLoading')
|
573
|
|
- return
|
574
|
|
- }
|
575
|
|
- await get_up_record_id(targetArr,acArr)
|
576
|
|
- await get_upload_res()
|
577
|
|
-}
|
578
|
|
-//上传素材成功后 走的代码
|
579
|
|
-const successEvent = (resResult:any) => {
|
580
|
|
- pageInfo.resResult = _.cloneDeep(resResult)
|
581
|
|
- pageInfo.creativeTeamList.forEach(item=>{
|
582
|
|
- item.resResult = item.resResult.concat(resResult_to_creativeTeamList(item.itemId))
|
583
|
|
- })
|
584
|
|
- emit('assignEvent',pageInfo.creativeTeamList)
|
585
|
|
-}
|
586
|
|
-
|
587
|
|
-const {get_up_record_id,get_upload_res,requestObj} =
|
588
|
|
- uploadAddGetResTs(coverRadioList.radioVal == 'On' ? 1 : 0,successEvent)
|
589
|
|
-
|
590
|
|
-
|
591
|
|
-// 父组件共享值
|
592
|
|
-defineExpose({
|
593
|
|
- switchShow,
|
594
|
|
- clearAllEvent,
|
595
|
|
- creatice_reuseEvent,
|
596
|
|
- deleAcEvent
|
597
|
|
-});
|
598
|
|
-
|
599
|
|
-</script>
|
600
|
|
-<style lang="scss" scoped>
|
601
|
|
-@import "src/assets/style/batchGdt.scss";
|
602
|
|
-.marPad{
|
603
|
|
- margin: 8px 24px;
|
604
|
|
-}
|
605
|
|
-.borCon{
|
606
|
|
- border: 1px solid #ebeef5;
|
607
|
|
- border-radius: 4px;
|
608
|
|
- color: #161E46;
|
609
|
|
- padding: 8px 24px;
|
610
|
|
-}
|
611
|
|
-.titleBox{
|
612
|
|
- .title{
|
613
|
|
- font-weight: 600;
|
614
|
|
- }
|
615
|
|
- .smallTitle{
|
616
|
|
- font-size: 12px;
|
617
|
|
- }
|
618
|
|
-}
|
619
|
|
-.content{
|
620
|
|
- .TeamBox{
|
621
|
|
- flex: 1;
|
622
|
|
- flex-shrink: 0;
|
623
|
|
- border: 1px solid #ebeef5;
|
624
|
|
- border-radius: 4px;
|
625
|
|
- color: #161E46;
|
626
|
|
- .TeamTitle{
|
627
|
|
- padding: 8px 24px;
|
628
|
|
- background-color: #fafafa;
|
629
|
|
- line-height: 32px;
|
630
|
|
- }
|
631
|
|
- .TeamContent{
|
632
|
|
- background-color: #fff;
|
633
|
|
- width: 100%;
|
634
|
|
- }
|
635
|
|
-
|
636
|
|
- }
|
637
|
|
- .iconBox{
|
638
|
|
- padding: 6px 8px;
|
639
|
|
- margin-left: 8px;
|
640
|
|
- width: 32px;
|
641
|
|
- cursor: pointer;
|
642
|
|
- border: 1px solid #ebeef5;
|
643
|
|
- border-radius: 4px;
|
644
|
|
- }
|
645
|
|
- .addItem{
|
646
|
|
- padding: 8px 24px;
|
647
|
|
- line-height: 24px;
|
648
|
|
- background-color: #fafafa;
|
649
|
|
- text-align: center;
|
650
|
|
- width: calc(100% - 32px - 8px);
|
651
|
|
- margin-top: 20px;
|
652
|
|
- cursor: pointer;
|
653
|
|
- &:hover{
|
654
|
|
- font-weight: 600;
|
655
|
|
- }
|
656
|
|
- }
|
657
|
|
-}
|
658
|
|
-</style>
|