|
@@ -150,7 +150,7 @@ export default {
|
|
|
// 表单
|
|
|
form: [],
|
|
|
// 模板
|
|
|
- module: [],
|
|
|
+ module: {},
|
|
|
// 弹窗
|
|
|
dialogVisible: false,
|
|
|
// 弹窗表单
|
|
@@ -237,7 +237,7 @@ export default {
|
|
|
moduleList(this.$route.query.moduleTypeId).then(res => {
|
|
|
if (res.code === 0) {
|
|
|
res.data.elementIds.map(i => {
|
|
|
- this.module.push(moduleOptions[i])
|
|
|
+ this.module[moduleOptions[i]] = ''
|
|
|
})
|
|
|
if (this.$route.query.threeId) {
|
|
|
this.getDetail()
|
|
@@ -251,27 +251,33 @@ export default {
|
|
|
getDetail() {
|
|
|
detail(this.$route.query.threeId).then(res => {
|
|
|
if (res.code === 0 && res.data.list.length > 0) {
|
|
|
- // 组件模板
|
|
|
- let obj = {}
|
|
|
- this.module.map(j => {
|
|
|
- obj[j] = ''
|
|
|
- })
|
|
|
// 将详情数据遍历
|
|
|
res.data.list.map((i, index) => {
|
|
|
- let newObj = {}
|
|
|
+ let obj = {}
|
|
|
+
|
|
|
+ // 是否有简介
|
|
|
+ if ('description' in this.module) {
|
|
|
+ obj.description = i.module.description
|
|
|
+ }
|
|
|
+
|
|
|
// 只保留组件模板的参数
|
|
|
for (const key in i) {
|
|
|
- if (obj.hasOwnProperty(key)) {
|
|
|
- newObj[key] = i[key]
|
|
|
+ if (this.module.hasOwnProperty(key)) {
|
|
|
+ obj[key] = i[key]
|
|
|
// 跳转方式关联 内容 栏目 地址
|
|
|
if ([0, 1, 2, 3, 4].includes(i.forwardType)) {
|
|
|
- newObj.contentName = i.contentName
|
|
|
- newObj.module = i.module
|
|
|
+ obj.contentName = i.contentName
|
|
|
+ obj.module = i.module
|
|
|
} else if ([5, 6].includes(i.forwardType)) {
|
|
|
- newObj.forwardUrl = i.forwardUrl
|
|
|
+ obj.forwardUrl = i.forwardUrl
|
|
|
} else if ([7].includes(i.forwardType)) {
|
|
|
- newObj.contentId = i.module.contentId
|
|
|
- newObj.module = i.module
|
|
|
+ obj.contentId = i.module.contentId
|
|
|
+ obj.module = i.module
|
|
|
+ }
|
|
|
+
|
|
|
+ // 是否有内容
|
|
|
+ if (key === 'contentName') {
|
|
|
+ obj.module = i.module
|
|
|
}
|
|
|
|
|
|
// 封面模式关联 图片
|
|
@@ -279,9 +285,9 @@ export default {
|
|
|
this.picList[index] = i.pic
|
|
|
}
|
|
|
}
|
|
|
- newObj.status = i.status
|
|
|
+ obj.status = i.status
|
|
|
}
|
|
|
- this.form.push(newObj)
|
|
|
+ this.form.push(obj)
|
|
|
})
|
|
|
}
|
|
|
})
|
|
@@ -403,6 +409,10 @@ export default {
|
|
|
e.pic = row.audioPic
|
|
|
// 封面模式自定义封面会丢失内容封面图片 所以缓存以便改回来使用
|
|
|
this.picList[this.index] = row.audioPic
|
|
|
+ // 是否有简介 若有则将音频的简介赋值进去
|
|
|
+ if ('description' in this.module) {
|
|
|
+ e.description = row.description
|
|
|
+ }
|
|
|
this.$message.success('选择成功!')
|
|
|
this.dialogVisible = false
|
|
|
},
|
|
@@ -438,8 +448,10 @@ export default {
|
|
|
threeId: this.threeId,
|
|
|
list: this.form
|
|
|
}
|
|
|
- for (const key in this.form) {
|
|
|
- delete this.form[key].contentId
|
|
|
+ // 删除仅作展示的缓存数据
|
|
|
+ for (const index in this.form) {
|
|
|
+ delete this.form[index].contentId
|
|
|
+ delete this.form[index].description
|
|
|
}
|
|
|
submitThree(data).then(res => {
|
|
|
if (res.code === 0) {
|