diff --git a/src/views/sce/sceInfo/index.vue b/src/views/sce/sceInfo/index.vue index 6b03bc2..f6e454f 100644 --- a/src/views/sce/sceInfo/index.vue +++ b/src/views/sce/sceInfo/index.vue @@ -315,7 +315,7 @@ class="urlTable" > { - var a = []; - var b = []; - var c = []; - if (n.mediaType == 1 && n.sourceType == 2) { - a.push(n); - this.ruleForm.radioImg = a.map(n => { - return { - mediaType: n.mediaType, - sourceType: n.sourceType, - title: n.title, - url: n.url, - processNames: n.processNames, - processId: n.processId.split(",") - }; - }); + var img = []; + var music = []; + var video = [] + for (var i in res.data.resourcesList) { + if ( + res.data.resourcesList[i].mediaType == 1 && + res.data.resourcesList[i].sourceType == 2 + ) { this.radioImg = 2; + img.push(res.data.resourcesList[i]); } - if (n.mediaType == 1 && n.sourceType == 1) { - a.push(n); - var tmp = []; - this.imgData = a; - + if ( + res.data.resourcesList[i].mediaType == 1 && + res.data.resourcesList[i].sourceType == 1 + ) { this.radioImg = 1; + img.push(res.data.resourcesList[i]); } - if (n.mediaType == 2 && n.sourceType == 1) { - b.push(n); - this.musicData = b; - this.radioMusic = 1; - } - if (n.mediaType == 2 && n.sourceType == 2) { - console.log("进来了1"); - b.push(n); - this.ruleForm.radioMusic = b.map(n => { - return { - mediaType: n.mediaType, - sourceType: n.sourceType, - title: n.title, - url: n.url, - processNames: n.processNames, - processId: n.processId.split(",") - }; - }); + } + console.log(this.radioImg); + if (this.radioImg == 1) { + this.imgData = img; + console.log(this.imgData); + } else if (this.radioImg == 2) { + this.ruleForm.radioImg = img.map(n => { + return { + mediaType: n.mediaType, + sourceType: n.sourceType, + title: n.title, + url: n.url, + processNames: n.processNames, + processId: n.processId.split(",") + }; + }); + } + for (var i in res.data.resourcesList) { + if ( + res.data.resourcesList[i].mediaType == 2 && + res.data.resourcesList[i].sourceType == 2 + ) { this.radioMusic = 2; + music.push(res.data.resourcesList[i]); } - if (n.mediaType == 3 && n.sourceType == 1) { - c.push(n); - this.videoData = c; - this.radioVideo = 1; + if ( + res.data.resourcesList[i].mediaType == 2 && + res.data.resourcesList[i].sourceType == 1 + ) { + this.radioMusic = 1; + music.push(res.data.resourcesList[i]); } - if (n.mediaType == 3 && n.sourceType == 2) { - c.push(n); - this.ruleForm.radioVideo = c.map(n => { - return { - mediaType: n.mediaType, - sourceType: n.sourceType, - title: n.title, - url: n.url, - processNames: n.processNames, - processId: n.processId.split(",") - }; - }); + } + if (this.radioMusic == 1) { + this.musicData = music; + } else if (this.radioMusic == 2) { + this.ruleForm.radioMusic = music.map(n => { + return { + mediaType: n.mediaType, + sourceType: n.sourceType, + title: n.title, + url: n.url, + processNames: n.processNames, + processId: n.processId.split(",") + }; + }); + } + for (var i in res.data.resourcesList) { + if ( + res.data.resourcesList[i].mediaType == 3 && + res.data.resourcesList[i].sourceType == 2 + ) { this.radioVideo = 2; + video.push(res.data.resourcesList[i]); + } + if ( + res.data.resourcesList[i].mediaType == 3 && + res.data.resourcesList[i].sourceType == 1 + ) { + this.radioVideo = 1; + video.push(res.data.resourcesList[i]); } - }); - console.log(this.ruleForm); - if (this.ruleForm.radioImg == undefined) { - this.$set(this.radioImg,'radioImg',[]) - } - if (this.ruleForm.radioMusic == undefined) { - // this.ruleForm.radioMusic = []; - this.$set(this.ruleForm,'radioMusic',[]) } - if (this.ruleForm.radioVideo == undefined) { - this.$set(this.ruleForm,'radioVideo',[]) + if (this.radioVideo == 1) { + this.videoData = video; + } else if (this.radioVideo == 2) { + this.ruleForm.radioVideo = video.map(n => { + return { + mediaType: n.mediaType, + sourceType: n.sourceType, + title: n.title, + url: n.url, + processNames: n.processNames, + processId: n.processId.split(",") + }; + }); } - + // res.data.resourcesList.map(n => { + // var a = []; + // var b = []; + // var c = []; + // if (n.mediaType == 2 && n.sourceType == 1) { + // consooe.log(1111); + // b.push(n); + // this.musicData = b; + // this.radioMusic = 1; + // } + // if (n.mediaType == 2 && n.sourceType == 2) { + // b.push(n); + // this.ruleForm.radioMusic = b.map(n => { + // return { + // mediaType: n.mediaType, + // sourceType: n.sourceType, + // title: n.title, + // url: n.url, + // processNames: n.processNames, + // processId: n.processId.split(",") + // }; + // }); + // this.radioMusic = 2; + // } + // if (n.mediaType == 3 && n.sourceType == 1) { + // c.push(n); + // this.videoData = c; + // this.radioVideo = 1; + // } + // if (n.mediaType == 3 && n.sourceType == 2) { + // c.push(n); + // this.ruleForm.radioVideo = c.map(n => { + // return { + // mediaType: n.mediaType, + // sourceType: n.sourceType, + // title: n.title, + // url: n.url, + // processNames: n.processNames, + // processId: n.processId.split(",") + // }; + // }); + // this.radioVideo = 2; + // } + // }); console.log(this.ruleForm, "处理后详情"); } catch (err) { console.log(err); @@ -1072,9 +1134,9 @@ export default { this.disabled = false; this.type = "add"; this.dialog.title = "新增剧本"; - setTimeout(()=>{ + setTimeout(() => { this.dialog.Visible = true; - },500) + }, 500); }, async subMit() { console.log(this.imgType, this.musicType, this.videoType); @@ -1224,18 +1286,18 @@ export default { this.type = "edit"; this.disabled = false; this.dialog.title = "编辑剧本"; - setTimeout(()=>{ + setTimeout(() => { this.dialog.Visible = true; - },500) + }, 500); }, // 查看 handleView(row) { this.queryListDetail(row.id); this.type = "view"; this.disabled = true; - setTimeout(()=>{ + setTimeout(() => { this.dialog.Visible = true; - },500) + }, 500); }, // 删除 async hanDel(row) { @@ -1374,9 +1436,13 @@ export default { mediaType: 1, sourceType: this.radioImg }); - this.$refs.img.data = this.ruleForm.radioImg + + if (this.$refs.img.data.length == 0) { + this.$refs.img.data = this.ruleForm.radioImg; + } }, handleAddMusic() { + console.log(this.$refs.music.data, 1231); this.ruleForm.radioMusic.push({ title: "", url: "", @@ -1384,7 +1450,9 @@ export default { mediaType: 2, sourceType: this.radioMusic }); - this.$refs.music.data = this.ruleForm.radioMusic + if (this.$refs.music.data.length == 0) { + this.$refs.music.data = this.ruleForm.radioMusic; + } }, handleAddVideo() { this.ruleForm.radioVideo.push({ @@ -1394,7 +1462,9 @@ export default { mediaType: 3, sourceType: this.radioVideo }); - this.$refs.video.data = this.ruleForm.radioVideo + if (this.$refs.video.data.length == 0) { + this.$refs.video.data = this.ruleForm.radioVideo; + } }, // 上传资源蹄片 labeluploadimg({ file }) {