Commit ff3d5c8c authored by wangwei's avatar wangwei

课包编辑 编写

parent fa70b206
......@@ -96,16 +96,20 @@
methods:{
onSave(){
if(this.editorObj.type===1){
alert(this.editorObj.category_id)
let json = {
category_id:this.editorObj.category_id,
title:this.formData.title,
content:JSON.stringify(this.formData.content),
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){
alert(this.editorObj.category_id)
let json = {
category_id:this.editorObj.category_id,
title:this.formData.title,
......@@ -113,59 +117,65 @@
cover:this.formData.cover
};
addElementApi(json,0).then(res=>{
this.$message({
type: 'success',
message: '保存成功!'
});
this.$emit('reflash')
})
}
}
},
watch:{
'editorObj.id'(value){
if(value){
getElemenetDetailApi(value).then(res=>{
res.content = JSON.parse(res.content);
this.formData = res
})
}else{
this.formData={
title:'',
cover:'',
content:{
base:{},
tips:{
content:'',
title1:'',
title1_content:'',
title2:'',
title2_content:''
},
look:{
content:'',
'editorObj.show'(t){
if(t){
let value = this.editorObj.id
if(value){
getElemenetDetailApi(value).then(res=>{
res.content = JSON.parse(res.content);
this.formData = res
})
}else{
this.formData={
title:'',
cover:'',
content:{
base:{},
tips:{
content:'',
title1:'',
title1_content:'',
title2:'',
title2_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: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
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