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,13 +117,19 @@
cover:this.formData.cover
};
addElementApi(json,0).then(res=>{
this.$message({
type: 'success',
message: '保存成功!'
});
this.$emit('reflash')
})
}
}
},
watch:{
'editorObj.id'(value){
'editorObj.show'(t){
if(t){
let value = this.editorObj.id
if(value){
getElemenetDetailApi(value).then(res=>{
res.content = JSON.parse(res.content);
......@@ -165,7 +175,7 @@
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