Commit ff3d5c8c authored by wangwei's avatar wangwei

课包编辑 编写

parent fa70b206
...@@ -96,16 +96,20 @@ ...@@ -96,16 +96,20 @@
methods:{ methods:{
onSave(){ onSave(){
if(this.editorObj.type===1){ if(this.editorObj.type===1){
alert(this.editorObj.category_id)
let json = { let json = {
category_id:this.editorObj.category_id, category_id:this.editorObj.category_id,
title:this.formData.title, title:this.formData.title,
content:JSON.stringify(this.formData.content), content:JSON.stringify(this.formData.content),
cover:this.formData.cover cover:this.formData.cover
}; };
editElementApi(this.editorObj.id,json) editElementApi(json,this.editorObj.id).then(res=>{
this.$message({
type: 'success',
message: '保存成功!'
});
this.$emit('reflash')
})
}else if(this.editorObj.type===0){ }else if(this.editorObj.type===0){
alert(this.editorObj.category_id)
let json = { let json = {
category_id:this.editorObj.category_id, category_id:this.editorObj.category_id,
title:this.formData.title, title:this.formData.title,
...@@ -113,59 +117,65 @@ ...@@ -113,59 +117,65 @@
cover:this.formData.cover cover:this.formData.cover
}; };
addElementApi(json,0).then(res=>{ addElementApi(json,0).then(res=>{
this.$message({
type: 'success',
message: '保存成功!'
});
this.$emit('reflash')
}) })
} }
} }
}, },
watch:{ watch:{
'editorObj.id'(value){ 'editorObj.show'(t){
if(value){ if(t){
getElemenetDetailApi(value).then(res=>{ let value = this.editorObj.id
res.content = JSON.parse(res.content); if(value){
this.formData = res getElemenetDetailApi(value).then(res=>{
}) res.content = JSON.parse(res.content);
}else{ this.formData = res
this.formData={ })
title:'', }else{
cover:'', this.formData={
content:{ title:'',
base:{}, cover:'',
tips:{ content:{
content:'', base:{},
title1:'', tips:{
title1_content:'', content:'',
title2:'', title1:'',
title2_content:'' title1_content:'',
}, title2:'',
look:{ title2_content:''
content:'', },
look:{
content:'',
},
play:{
type:false,
audio:[],
audio2:[],
video:[],
video2:[],
change:false,
change2:false,
age:false
},
fun:{
type:false,
audio:[],
audio2:[],
video:[],
video2:[],
change:false,
change2:false,
age:false
}
}, },
play:{ type:0
type:false, }
audio:[],
audio2:[],
video:[],
video2:[],
change:false,
change2:false,
age:false
},
fun:{
type:false,
audio:[],
audio2:[],
video:[],
video2:[],
change:false,
change2:false,
age:false
}
},
type:0
} }
} }
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment