|
@@ -9,6 +9,10 @@
|
9
|
9
|
<div class="f14">添加图片</div>
|
10
|
10
|
</div>
|
11
|
11
|
</el-upload>
|
|
12
|
+ <div class="flex-align-center" style="margin-top:10px;">
|
|
13
|
+ <el-button type="primary" size="mini" style="margin-right:10px;" @click="onClickSelectMaterials('TP')">选择素材</el-button>
|
|
14
|
+ <div class="uploadImgHint" style="margin:0">可直接从素材库选择图片。</div>
|
|
15
|
+ </div>
|
12
|
16
|
<el-dialog append-to-body :visible.sync="imgVisible">
|
13
|
17
|
<img width="100%" :src="dialogImageUrl" alt="">
|
14
|
18
|
</el-dialog>
|
|
@@ -60,6 +64,10 @@
|
60
|
64
|
<div class="f14">添加封面</div>
|
61
|
65
|
</div>
|
62
|
66
|
</el-upload>
|
|
67
|
+ <div class="flex-align-center" style="margin-top:10px;">
|
|
68
|
+ <el-button type="primary" size="mini" style="margin-right:10px;" @click="onClickSelectMaterials('TWLJ')">选择素材</el-button>
|
|
69
|
+ <div class="uploadImgHint" style="margin:0">可直接从素材库选择图片。</div>
|
|
70
|
+ </div>
|
63
|
71
|
<el-dialog append-to-body :visible.sync="coverVisible">
|
64
|
72
|
<img width="100%" :src="dialogcoverUrl" alt="">
|
65
|
73
|
</el-dialog>
|
|
@@ -88,15 +96,23 @@
|
88
|
96
|
<template v-if="conType==0">因企业微信限制,图片长宽建议不超过1440x1080,大小不超过10M,最多9张图片</template>
|
89
|
97
|
<template v-if="conType==1">因企业微信限制,视频建议不超过1280X720,帧率30FPS,视频码率1.67Mbps,最长不超过30s,最大不超过10MB,最多1个视频</template>
|
90
|
98
|
</div>
|
|
99
|
+
|
|
100
|
+ <!-- 选择素材 -->
|
|
101
|
+ <selectMaterials :selectVisible="selectMaterialsVisible" @cancel="selectMaterialsVisible = false" @selectObj="selectMaterialsConfirm"></selectMaterials>
|
91
|
102
|
</div>
|
92
|
103
|
</template>
|
93
|
104
|
|
94
|
105
|
<script>
|
95
|
106
|
import radarEntrance from './radarEntrance.vue'
|
|
107
|
+import selectMaterials from "@/components/manage/materialLibrary/dialog/selectMaterials.vue"
|
|
108
|
+
|
96
|
109
|
export default {
|
97
|
110
|
name: "conTwo",
|
98
|
111
|
props: ['conType', 'reBackData', 'disabled'],
|
99
|
|
- components:{radarEntrance},
|
|
112
|
+ components:{
|
|
113
|
+ radarEntrance,
|
|
114
|
+ selectMaterials,
|
|
115
|
+ },
|
100
|
116
|
data () {
|
101
|
117
|
return {
|
102
|
118
|
imageFileList: [],
|
|
@@ -144,7 +160,9 @@ export default {
|
144
|
160
|
videoFlag: false,
|
145
|
161
|
hoverInFlag: false,
|
146
|
162
|
radarIds:[],
|
147
|
|
- radar_attach:[]
|
|
163
|
+ radar_attach:[],
|
|
164
|
+ selectMaterialsVisible: false, // 选择素材弹框
|
|
165
|
+ selectMaterialsSource:'', // 选择素材 - 判断是从哪里点击的
|
148
|
166
|
}
|
149
|
167
|
},
|
150
|
168
|
created () {
|
|
@@ -231,7 +249,7 @@ export default {
|
231
|
249
|
})
|
232
|
250
|
} else if (this.conType == 2) {
|
233
|
251
|
this.$message({
|
234
|
|
- message: '最多上传1个照片',
|
|
252
|
+ message: '最多上传1张图片',
|
235
|
253
|
type: "warning"
|
236
|
254
|
})
|
237
|
255
|
}
|
|
@@ -276,6 +294,7 @@ export default {
|
276
|
294
|
} else if (this.conType == 2) {
|
277
|
295
|
this.linkUrl.link.media_id = res.rst.material_id
|
278
|
296
|
this.linkUrl.link.pic_url = res.rst.url
|
|
297
|
+ this.handleSetCoverFileList()
|
279
|
298
|
this.$loading(this.$loadingConfig).close()
|
280
|
299
|
}
|
281
|
300
|
this.fromRebackGetInfo = false
|
|
@@ -312,18 +331,20 @@ export default {
|
312
|
331
|
// type: 'warning'
|
313
|
332
|
// })
|
314
|
333
|
// }
|
315
|
|
-
|
316
|
334
|
if (res.status == 'success') {
|
317
|
335
|
if (this.conType == 0) {
|
|
336
|
+ const delId = res.media_id || res.response.rst.material_id
|
318
|
337
|
let ids = []//所有图片的id集合
|
319
|
338
|
this.imgUrls.forEach(item => {
|
320
|
339
|
ids.push(item.image.media_id)
|
321
|
340
|
})
|
322
|
|
- let deleImgidx = ids.indexOf(finallyRes.rst.material_id)
|
|
341
|
+ let deleImgidx = ids.indexOf(delId)
|
323
|
342
|
this.imgUrls.splice(deleImgidx, 1)
|
|
343
|
+ this.handleSetImageFileList()
|
324
|
344
|
} else if (this.conType == 2) {
|
325
|
345
|
this.linkUrl.link.media_id = ''
|
326
|
346
|
this.linkUrl.link.pic_url = ''
|
|
347
|
+ this.handleSetCoverFileList()
|
327
|
348
|
}
|
328
|
349
|
}
|
329
|
350
|
},
|
|
@@ -340,10 +361,73 @@ export default {
|
340
|
361
|
beforeUploadUpload (file) {
|
341
|
362
|
this.$loading(this.$loadingConfig);
|
342
|
363
|
},
|
|
364
|
+
|
|
365
|
+ // 点击选择素材
|
|
366
|
+ onClickSelectMaterials(val) {
|
|
367
|
+ this.selectMaterialsSource = val
|
|
368
|
+ if (this.selectMaterialsSource == 'TP' && this.imgUrls && this.imgUrls.length == 9) { // 图片
|
|
369
|
+ this.handleExceed()
|
|
370
|
+ return false
|
|
371
|
+ } else if (this.selectMaterialsSource == 'TWLJ' && this.linkUrl && this.linkUrl.link.media_id) { // 图文链接
|
|
372
|
+ this.handleExceed()
|
|
373
|
+ return false
|
|
374
|
+ }
|
|
375
|
+ this.selectMaterialsVisible = true
|
|
376
|
+ },
|
|
377
|
+ // 选择素材回调
|
|
378
|
+ selectMaterialsConfirm(data){
|
|
379
|
+ if (data && data.url) {
|
|
380
|
+ if (this.selectMaterialsSource == 'TP') { // 图片
|
|
381
|
+ this.imgUrls.push({
|
|
382
|
+ msgtype: 'image',
|
|
383
|
+ image: {
|
|
384
|
+ media_id: data.material_id,
|
|
385
|
+ pic_url: data.url,
|
|
386
|
+ }
|
|
387
|
+ })
|
|
388
|
+ this.handleSetImageFileList()
|
|
389
|
+ } else if (this.selectMaterialsSource == 'TWLJ') { // 图文链接
|
|
390
|
+ this.linkUrl.link.media_id = data.material_id
|
|
391
|
+ this.linkUrl.link.pic_url = data.url
|
|
392
|
+ this.handleSetCoverFileList()
|
|
393
|
+ }
|
|
394
|
+ this.selectMaterialsVisible = false
|
|
395
|
+ } else {
|
|
396
|
+ this.$message({ message: '所选素材不可用,请重新选择!', type: 'warning' })
|
|
397
|
+ }
|
|
398
|
+ },
|
|
399
|
+ async handleSetImageFileList() {
|
|
400
|
+ this.imageFileList = []
|
|
401
|
+ await this.$nextTick()
|
|
402
|
+ this.imgUrls.forEach(img => {
|
|
403
|
+ this.imageFileList.push({
|
|
404
|
+ media_id: img.image.media_id,
|
|
405
|
+ url: img.image.pic_url,
|
|
406
|
+ })
|
|
407
|
+ })
|
|
408
|
+ },
|
|
409
|
+ async handleSetCoverFileList() {
|
|
410
|
+ this.coverFileList = []
|
|
411
|
+ await this.$nextTick()
|
|
412
|
+ if (this.linkUrl.link.media_id) {
|
|
413
|
+ this.coverFileList.push({
|
|
414
|
+ media_id: this.linkUrl.link.media_id,
|
|
415
|
+ url: this.linkUrl.link.pic_url,
|
|
416
|
+ })
|
|
417
|
+ }
|
|
418
|
+ },
|
343
|
419
|
}
|
344
|
420
|
}
|
345
|
421
|
</script>
|
346
|
422
|
<style lang="scss">
|
|
423
|
+.uploadImgHint {
|
|
424
|
+ font-size: 13px;
|
|
425
|
+ line-height: 30px;
|
|
426
|
+ color: #f9a527;
|
|
427
|
+ margin-left: 60px;
|
|
428
|
+ margin-top: -10px;
|
|
429
|
+ margin-bottom: 10px;
|
|
430
|
+}
|
347
|
431
|
.friendCircleUploader {
|
348
|
432
|
.imgUploader {
|
349
|
433
|
.el-upload--picture-card {
|
|
@@ -460,7 +544,7 @@ export default {
|
460
|
544
|
margin-right: 6px;
|
461
|
545
|
}
|
462
|
546
|
.conEle {
|
463
|
|
- width: 50%;
|
|
547
|
+ width: 52%;
|
464
|
548
|
}
|
465
|
549
|
}
|
466
|
550
|
}
|