mirror of https://github.com/halo-dev/halo-admin
Refactor comment management.
parent
c5be555e02
commit
85f5114499
|
@ -0,0 +1,8 @@
|
|||
<template>
|
||||
<div></div>
|
||||
</template>
|
||||
<script>
|
||||
export default {}
|
||||
</script>
|
||||
<style lang="less" scoped>
|
||||
</style>
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
<script>
|
||||
import { PageView } from '@/layouts'
|
||||
import CommentTab from './CommentTab'
|
||||
import CommentTab from './components/CommentTab'
|
||||
export default {
|
||||
components: {
|
||||
PageView,
|
||||
|
|
|
@ -321,7 +321,7 @@ export default {
|
|||
type: {
|
||||
type: String,
|
||||
required: false,
|
||||
default: 'post',
|
||||
default: 'posts',
|
||||
validator: function(value) {
|
||||
return ['posts', 'sheets', 'journals'].indexOf(value) !== -1
|
||||
}
|
|
@ -136,19 +136,19 @@
|
|||
tab="文章"
|
||||
key="1"
|
||||
>
|
||||
<recent-comment-tab type="post"></recent-comment-tab>
|
||||
<recent-comment-tab type="posts"></recent-comment-tab>
|
||||
</a-tab-pane>
|
||||
<a-tab-pane
|
||||
tab="页面"
|
||||
key="2"
|
||||
>
|
||||
<recent-comment-tab type="sheet"></recent-comment-tab>
|
||||
<recent-comment-tab type="sheets"></recent-comment-tab>
|
||||
</a-tab-pane>
|
||||
<a-tab-pane
|
||||
tab="日志"
|
||||
key="3"
|
||||
>
|
||||
<recent-comment-tab type="journal"></recent-comment-tab>
|
||||
<recent-comment-tab type="journals"></recent-comment-tab>
|
||||
</a-tab-pane>
|
||||
</a-tabs>
|
||||
</div>
|
||||
|
|
|
@ -10,12 +10,18 @@
|
|||
:key="index"
|
||||
>
|
||||
<a-comment :avatar="'//gravatar.loli.net/avatar/'+item.gavatarMd5+'/?s=256&d=mp'">
|
||||
<template slot="author">
|
||||
<template slot="author" v-if="type==='posts'">
|
||||
{{ item.author }} 发表在 《<a
|
||||
href="javascript:void(0);"
|
||||
target="_blank"
|
||||
>{{ item.post.title }}</a>》
|
||||
</template>
|
||||
<template slot="author" v-else-if="type==='sheets'">
|
||||
{{ item.author }} 发表在 《<a
|
||||
href="javascript:void(0);"
|
||||
target="_blank"
|
||||
>{{ item.sheet.title }}</a>》
|
||||
</template>
|
||||
<template slot="actions">
|
||||
<span>回复</span>
|
||||
</template>
|
||||
|
@ -44,9 +50,9 @@ export default {
|
|||
type: {
|
||||
type: String,
|
||||
required: false,
|
||||
default: 'post',
|
||||
default: 'posts',
|
||||
validator: function(value) {
|
||||
return ['post', 'sheet', 'journal'].indexOf(value) !== -1
|
||||
return ['posts', 'sheets', 'journals'].indexOf(value) !== -1
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -70,26 +76,10 @@ export default {
|
|||
methods: {
|
||||
loadComments() {
|
||||
this.loading = true
|
||||
switch (this.type) {
|
||||
case 'post':
|
||||
commentApi.latestPostComment(5, 'PUBLISHED').then(response => {
|
||||
commentApi.latestComment(this.type, 5, 'PUBLISHED').then(response => {
|
||||
this.comments = response.data.data
|
||||
this.loading = false
|
||||
})
|
||||
break
|
||||
case 'sheet':
|
||||
commentApi.latestSheetComment(5, 'PUBLISHED').then(response => {
|
||||
this.comments = response.data.data
|
||||
this.loading = false
|
||||
})
|
||||
break
|
||||
case 'journal':
|
||||
commentApi.latestJournalComment(5, 'PUBLISHED').then(response => {
|
||||
this.comments = response.data.data
|
||||
this.loading = false
|
||||
})
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue