From 78afe558e23226958ce4390c5222fe4a849854f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E7=95=85?= Date: Sun, 12 Sep 2021 16:12:53 +0800 Subject: [PATCH] add --- src/views/sce/sceInfo/index.vue | 183 ++++++++++++++++++++++---------- src/views/sce/tips/index.vue | 21 +++- src/views/user/index.vue | 2 +- 3 files changed, 142 insertions(+), 64 deletions(-) diff --git a/src/views/sce/sceInfo/index.vue b/src/views/sce/sceInfo/index.vue index 59e3b36..5c08e20 100644 --- a/src/views/sce/sceInfo/index.vue +++ b/src/views/sce/sceInfo/index.vue @@ -76,7 +76,9 @@ 编辑 - Tips维护 + Tips维护 删除 @@ -92,7 +94,7 @@ /> - + - + { - var a = [] - var b = [] - var c = [] + var a = []; + var b = []; + var c = []; if (n.mediaType == 1 && n.sourceType == 2) { - a.push(n) + a.push(n); this.ruleForm.radioImg = a.map(n => { return { mediaType: n.mediaType, sourceType: n.sourceType, title: n.title, url: n.url, - processId: n.processId.split(',') + processId: n.processId.split(",") }; }); this.radioImg = n.sourceType; } else if (n.mediaType == 1 && n.sourceType == 1) { a.push(n); + var tmp = [] this.imgData = a + this.radioImg = n.sourceType; } if (n.mediaType == 2 && n.sourceType == 1) { - b.push(n) - this.musicData = b + b.push(n); + this.musicData = b; this.radioMusic = n.sourceType; } else if (n.mediaType == 2 && n.sourceType == 2) { - console.log('进来了1') - b.push(n) + 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, - processId: n.processId.split(',') + processId: n.processId.split(",") }; - }); + }); this.radioMusic = n.sourceType; } if (n.mediaType == 3 && n.sourceType == 1) { - c.push(n) - this.videoData = c + c.push(n); + this.videoData = c; this.radioVideo = n.sourceType; } else if (n.mediaType == 3 && n.sourceType == 2) { - c.push(n) + c.push(n); this.ruleForm.radioVideo = c.map(n => { return { mediaType: n.mediaType, sourceType: n.sourceType, title: n.title, url: n.url, - processId: n.processId.split(',') + processId: n.processId.split(",") }; }); this.radioVideo = n.sourceType; } }); - console.log(this.ruleForm, "处理后详情"); + console.log( + this.ruleForm, + this.musicData, + this.imgData, + this.videoData, + "处理后详情" + ); } catch (err) { console.log(err); } @@ -909,6 +948,12 @@ export default { // 新增 handleAdd() { this.ruleForm = { + studioName: "", + title: "", + labelName: "", + imgUrl: "", + cover: "", + introduction: "", processesList: [], imgUrl: "", radioImg: [], @@ -916,6 +961,9 @@ export default { radioVideo: [], resourcesList: [] }; + this.imgData = [] + this.musicData = [] + this.videoData = [] this.radioMusic = 1; this.radioVideo = 1; this.radioImg = 1; @@ -981,20 +1029,20 @@ export default { this.$refs["ruleForm"].validate(async valid => { if (valid) { if (this.type == "add") { - var res = await addJbInfo(this.ruleForm); + var res = await addJbInfo(this.ruleForm); } else if (this.type == "edit") { - var res = await updateJbInfo(this.ruleForm); + var res = await updateJbInfo(this.ruleForm); + } + if (res.code == 200) { + this.$message.success("新增成功"); + this.dialog.Visible = false; + this.queryList(); + } else { + this.$message({ + message: res.msg, + type: "error" + }); } - if (res.code == 200) { - this.$message.success("新增成功"); - this.dialog.Visible = false; - this.queryList(); - } else { - this.$message({ - message: res.msg, - type: "error" - }); - } } }); } catch (err) { @@ -1192,7 +1240,7 @@ export default { this.imgData.push({ url: res.data.wjUrl, processName: "", - title: "" + title: res.data.wjDx }); this.imgType = true; }); @@ -1205,7 +1253,7 @@ export default { this.musicData.push({ url: res.data.wjUrl, processName: "", - title: "" + title: res.data.wjDx }); this.musicType = true; }); @@ -1218,9 +1266,9 @@ export default { this.videoData.push({ url: res.data.wjUrl, processName: "", - title: "" + title: res.data.wjDx }); - this.musicType = true; + this.radioType = true; }); }, // 图片删除 @@ -1255,7 +1303,7 @@ export default { if (type == "img") { this.imgIndex = i; } else if (type == "music") { - this.musicIdnex = i; + this.musicIndex = i; } else if (type == "video") { this.videoIndex = i; } @@ -1268,30 +1316,49 @@ export default { this.process.Visible = false; if (this.typeUrl == "img") { this.imgType = false; - this.imgData[this.imgIndex].processName = this.ForChannel( - this.processId - ); - this.imgData[this.imgIndex].processId = [this.processId]; + var tmp = []; + for (var i = 0; i < this.ruleForm.processesList.length; i++) { + for (var s = 0; s < this.processId.length; s++) { + if (this.ruleForm.processesList[i].code == this.processId[s]) { + tmp.push(this.ruleForm.processesList[i].title); + } + } + } + this.imgData[this.imgIndex].processName = tmp.join(","); + this.imgData[this.imgIndex].processId = this.processId; this.imgData[this.imgIndex].mediaType = 1; this.imgData[this.imgIndex].sourceType = this.radioImg; + console.log(this.imgData, "处理后img数据"); } if (this.typeUrl == "music") { this.musicType = false; - this.musicData[this.imgIndex].processName = this.ForChannel( - this.processId - ); - this.musicData[this.musicIndex].processId = [this.processId]; + var tmp = []; + for (var i = 0; i < this.ruleForm.processesList.length; i++) { + for (var s = 0; s < this.processId.length; s++) { + if (this.ruleForm.processesList[i].code == this.processId[s]) { + tmp.push(this.ruleForm.processesList[i].title); + } + } + } + this.musicData[this.musicIndex].processName = tmp.join(","); + this.musicData[this.musicIndex].processId = this.processId; this.musicData[this.musicIndex].mediaType = 2; - this.musicData[this.musicIndex].sourceType = this.radioImg; + this.musicData[this.musicIndex].sourceType = this.radioMusic; } if (this.typeUrl == "video") { this.videoType = false; - this.videoData[this.videoIndex].processName = this.ForChannel( - this.processId - ); - this.videoData[this.videoIndex].processId = [this.processId]; + var tmp = []; + for (var i = 0; i < this.ruleForm.processesList.length; i++) { + for (var s = 0; s < this.processId.length; s++) { + if (this.ruleForm.processesList[i].code == this.processId[s]) { + tmp.push(this.ruleForm.processesList[i].title); + } + } + } + this.videoData[this.videoIndex].processName = tmp.join(","); + this.videoData[this.videoIndex].processId = this.processId; this.videoData[this.videoIndex].mediaType = 3; - this.videoData[this.videoIndex].sourceType = this.radioImg; + this.videoData[this.videoIndex].sourceType = this.radioVideo; } } } diff --git a/src/views/sce/tips/index.vue b/src/views/sce/tips/index.vue index 6c3530e..6588c6e 100644 --- a/src/views/sce/tips/index.vue +++ b/src/views/sce/tips/index.vue @@ -122,10 +122,10 @@ :title="dialog.title" :visible.sync="dialog.Visible" center - width="35%" + width="500px" > - - + + - + - +