|
|
@ -13,11 +13,13 @@ |
|
|
|
|
|
|
|
|
|
|
|
<div id="editor"> |
|
|
|
<div id="editor"> |
|
|
|
<mavon-editor |
|
|
|
<mavon-editor |
|
|
|
|
|
|
|
ref="md" |
|
|
|
v-model="postToStage.originalContent" |
|
|
|
v-model="postToStage.originalContent" |
|
|
|
:boxShadow="false" |
|
|
|
:boxShadow="false" |
|
|
|
:toolbars="toolbars" |
|
|
|
:toolbars="toolbars" |
|
|
|
:ishljs="true" |
|
|
|
:ishljs="true" |
|
|
|
:autofocus="false" |
|
|
|
:autofocus="false" |
|
|
|
|
|
|
|
@imgAdd="pictureUploadHandle" |
|
|
|
/> |
|
|
|
/> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</a-col> |
|
|
|
</a-col> |
|
|
@ -202,6 +204,7 @@ import 'mavon-editor/dist/css/index.css' |
|
|
|
import categoryApi from '@/api/category' |
|
|
|
import categoryApi from '@/api/category' |
|
|
|
import postApi from '@/api/post' |
|
|
|
import postApi from '@/api/post' |
|
|
|
import optionApi from '@/api/option' |
|
|
|
import optionApi from '@/api/option' |
|
|
|
|
|
|
|
import attachmentApi from '@/api/attachment' |
|
|
|
export default { |
|
|
|
export default { |
|
|
|
components: { |
|
|
|
components: { |
|
|
|
TagSelect, |
|
|
|
TagSelect, |
|
|
@ -347,6 +350,21 @@ export default { |
|
|
|
this.autoSavePost() |
|
|
|
this.autoSavePost() |
|
|
|
}, 15000) |
|
|
|
}, 15000) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
pictureUploadHandle(pos, $file) { |
|
|
|
|
|
|
|
var formdata = new FormData() |
|
|
|
|
|
|
|
formdata.append('file', $file) |
|
|
|
|
|
|
|
attachmentApi.upload(formdata).then((response) => { |
|
|
|
|
|
|
|
var responseObject = response.data |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (responseObject.status === 200) { |
|
|
|
|
|
|
|
var MavonEditor = this.$refs.md |
|
|
|
|
|
|
|
MavonEditor.$img2Url(pos, responseObject.data.path) |
|
|
|
|
|
|
|
this.$message.success('图片上传成功') |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
this.$message.error('图片上传失败:' + responseObject.message) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|