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