添加评论功能
This commit is contained in:
parent
4d05c1a1a5
commit
321dd05d97
@ -467,21 +467,35 @@ export default {
|
||||
return
|
||||
}
|
||||
|
||||
const { data } = await this.$axios.post('/comments/commit', {
|
||||
postID,
|
||||
lastID,
|
||||
parentID,
|
||||
content: type === 'editor-reply' ? window.editorReplyObj.getValue() : window.editorObj.getValue()
|
||||
const editorObj = type === 'editor-reply' ? window.editorReplyObj : window.editorObj
|
||||
|
||||
const { data } = await this.$axios({
|
||||
method: 'post',
|
||||
url: process.env.baseURL + '/comments/commit',
|
||||
headers: {
|
||||
Authorization: 'Bearer ' + window.localStorage.visitorToken
|
||||
},
|
||||
data: {
|
||||
postID,
|
||||
lastID,
|
||||
parentID,
|
||||
content: editorObj.getValue()
|
||||
}
|
||||
})
|
||||
|
||||
if (data.status === 1) {
|
||||
// 获取评论
|
||||
const tmp = await this.$axios.get(`/public/comments/post?ID=${postID}`)
|
||||
const comments = tmp.result.list || []
|
||||
const commentAmount = tmp.result.amount || 0
|
||||
const tmp = await this.$axios.get(process.env.baseURL + `/public/comments/post?ID=${postID}`)
|
||||
const comments = tmp.data.result.list || []
|
||||
const commentAmount = tmp.data.result.amount || 0
|
||||
this.comments = comments
|
||||
this.commentAmount = commentAmount
|
||||
this.setCommentMap()
|
||||
editorObj.setValue('', true)
|
||||
this.$nextTick(() => {
|
||||
editorObj.focus()
|
||||
editorObj.insertValue('', true)
|
||||
})
|
||||
}
|
||||
},
|
||||
commentLogout () {
|
||||
|
Loading…
Reference in New Issue
Block a user