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,13 +117,19 @@ ...@@ -113,13 +117,19 @@
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(t){
let value = this.editorObj.id
if(value){ if(value){
getElemenetDetailApi(value).then(res=>{ getElemenetDetailApi(value).then(res=>{
res.content = JSON.parse(res.content); res.content = JSON.parse(res.content);
...@@ -165,7 +175,7 @@ ...@@ -165,7 +175,7 @@
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