diff --git a/src/views/immediateRelease/index.vue b/src/views/immediateRelease/index.vue index c836aee..d2f4688 100644 --- a/src/views/immediateRelease/index.vue +++ b/src/views/immediateRelease/index.vue @@ -183,7 +183,7 @@
展示时长 - +
@@ -309,6 +309,7 @@ export default { release_weekly: '', // 发布每周 如果设置为每天则为空 release_device: '', // 发布设备 1.全部 2.部分 release_deviceDTOs: [], // {"device_id": "设备id"} + del_rmids: [], // 删除绑定素材关联集合id release_end: '', // “发布结束时间 yyyy-MM-dd HH:mm:ss” release_id: null, // 发布id 为null则为新增 release_materialDTOs: [], @@ -464,6 +465,16 @@ export default { FetchFindMaterialById(params).then(res => { if (res.code == 200) { this.selectedMaterial = res.data + // 获取图片设置的animation + this.selectedMaterial.forEach((item, index) => { + if (item.material_type == 0) { + item.showTime = this.isEditMaterial[index].duration + item.showAnimation = this.isEditMaterial[index].effect + item.showAnimationName = this.animationData[item.showAnimation].name + item.showAudioUrl = this.isEditMaterial[index].bgm_path + item.showAudioName = this.isEditMaterial[index].bgm_name + } + }) } }) // 设备list @@ -531,10 +542,12 @@ export default { json.duration = (item.showTime || item.showAnimationName || item.showAnimation) ? item.showTime : 15 json.effect = (item.showTime || item.showAnimationName || item.showAnimation) ? item.showAnimation : 0 json.bgm_path = (item.showAudioName || item.showAudioUrl) ? item.showAudioUrl : null + json.bgm_name = (item.showAudioName || item.showAudioUrl) ? item.showAudioName : null } else { json.duration = 0 json.effect = 0 json.bgm_path = null + json.bgm_name = null } json.material_id = item.material_id json.material_name = item.material_name @@ -565,6 +578,7 @@ export default { } else { this.form.bgm_main = null } + console.log(this.form) // 保存提交 FetchSaveRelease(this.form).then(res => { if (res.code == 200) { @@ -656,6 +670,15 @@ export default { this.contentIds.splice(index, 1) this.selectedEditData.splice(index, 1) this.selectedMaterial.splice(i, 1) + + // 编辑的情况下 + if (this.release_id) { + this.isEditMaterial.find(item => { + if (item.material_id == id) { + this.form.del_rmids.push(item.id) + } + }) + } // localStorage.setItem('selectedMaterial', JSON.stringify(this.selectedMaterial)) }, // 选中可编辑的 @@ -675,16 +698,16 @@ export default { // 编辑-已选择的 selectEdit() { this.listEditVisible = true - const form = { - showTime: '15', - showAnimation: '', - showAnimationName: '' - } - this.selectedEditData.map((item, index) => { - if (item.material_type == 0) { - this.setMaterialForm.push(form) - } - }) + // const form = { + // showTime: '15', + // showAnimation: '', + // showAnimationName: '' + // } + // this.selectedEditData.map((item, index) => { + // if (item.material_type == 0) { + // this.setMaterialForm.push(form) + // } + // }) }, dragEnd() { // console.log(this.selectedEditData) @@ -744,6 +767,7 @@ export default { }, // 动画切换 selectAnimation(event, item) { + this.$forceUpdate() item.showAnimationName = event.name item.showAnimation = event.key }, @@ -766,10 +790,12 @@ export default { this.$refs.MaterialList.selectedListId = [] this.$refs.MaterialList.selectedMaterial = [] // 已选择的内容中-list是否包含,包含即选中状态 - this.selectedMaterial.forEach(item => { - this.$refs.MaterialList.selectedListId.push(item.material_id) - this.$refs.MaterialList.selectedMaterial.push(item) - }) + if (this.selectedMaterial) { + this.selectedMaterial.forEach(item => { + this.$refs.MaterialList.selectedListId.push(item.material_id) + this.$refs.MaterialList.selectedMaterial.push(item) + }) + } } else { if (type == 'audio') { this.mulitText = '选择' diff --git a/src/views/materialContent/materialList/index.vue b/src/views/materialContent/materialList/index.vue index dea885f..fcb8bfe 100644 --- a/src/views/materialContent/materialList/index.vue +++ b/src/views/materialContent/materialList/index.vue @@ -345,14 +345,25 @@ export default { }, // 选择素材 - to 即时发布/定时发布 publishHandle(index) { + localStorage.removeItem('selectedMaterial') + localStorage.removeItem('releaseId') + localStorage.setItem('selectedMaterial', JSON.stringify(this.selectedMaterial)) + // 判断是否选择了多个音频文件 + const resultAudio = [] + this.selectedMaterial.map(item => { + if (item.material_type == 2) { + resultAudio.push(item) + } + }) + if (resultAudio.length > 1) { + this.$message.error('音频类型的文件只可选择1个') + return + } this.$router.push( { path: '/release', query: { tag: index } } ) - localStorage.removeItem('selectedMaterial') - localStorage.removeItem('releaseId') - localStorage.setItem('selectedMaterial', JSON.stringify(this.selectedMaterial)) }, // 素材 - 编辑 editContent() { @@ -378,7 +389,6 @@ export default { // 上传素材 saveMaterial() { if (!this.isEditMaterial) { - console.log('新增') console.log(this.$refs.uploadMaterial.fileSize) const formatType = this.$refs.uploadMaterial.formatType this.uploadFileUrl = this.$refs.uploadMaterial.uploadFileUrl