Refactor CommentTab.

pull/9/head
ruibaby 6 years ago
parent 8cda3bc740
commit c2070c808b

@ -118,8 +118,8 @@
<a-list-item-meta>
<a
slot="title"
href="javascript:void(0);"
@click="handleEditPostClick(item)"
:href="options.blog_url+'/archives/'+item.url"
target="_blank"
>{{ item.title }}</a>
</a-list-item-meta>
<div>{{ item.createTime | timeAgo }}</div>
@ -297,6 +297,7 @@ import { PageView } from '@/layouts'
import AnalysisCard from './components/AnalysisCard'
import RecentCommentTab from './components/RecentCommentTab'
import { mixin, mixinDevice } from '@/utils/mixin.js'
import optionApi from '@/api/option'
import postApi from '@/api/post'
import logApi from '@/api/log'
@ -323,6 +324,8 @@ export default {
countsData: {},
journal: {},
logs: [],
options: [],
keys: ['blog_url'],
logPagination: {
page: 1,
size: 50,
@ -334,6 +337,7 @@ export default {
this.getCounts()
this.listLatestPosts()
this.listLatestLogs()
this.loadOptions()
},
computed: {
formattedPostData() {
@ -357,6 +361,11 @@ export default {
}
},
methods: {
loadOptions() {
optionApi.listAll(this.keys).then(response => {
this.options = response.data.data
})
},
listLatestPosts() {
postApi.listLatest(5).then(response => {
this.postData = response.data.data

@ -10,21 +10,33 @@
:key="index"
>
<a-comment :avatar="'//gravatar.loli.net/avatar/'+item.gavatarMd5+'/?s=256&d=mp'">
<template slot="author" v-if="type==='posts'">
{{ item.author }} 发表在 <a
href="javascript:void(0);"
<template
slot="author"
v-if="type==='posts'"
>
<a
:href="item.authorUrl"
target="_blank"
>{{ item.author }}</a> 发表在 <a
:href="options.blog_url+'/archives/'+item.post.url"
target="_blank"
>{{ item.post.title }}</a>
</template>
<template slot="author" v-else-if="type==='sheets'">
{{ item.author }} 发表在 <a
href="javascript:void(0);"
<template
slot="author"
v-else-if="type==='sheets'"
>
<a
:href="item.authorUrl"
target="_blank"
>{{ item.author }}</a> 发表在 <a
:href="options.blog_url+'/s/'+item.sheet.url"
target="_blank"
>{{ item.sheet.title }}</a>
</template>
<template slot="actions">
<!-- <template slot="actions">
<span>回复</span>
</template>
</template> -->
<p
class="comment-content-wrapper"
slot="content"
@ -43,6 +55,8 @@
<script>
import commentApi from '@/api/comment'
import optionApi from '@/api/option'
import marked from 'marked'
export default {
name: 'RecentCommentTab',
@ -59,7 +73,9 @@ export default {
data() {
return {
comments: [],
loading: false
loading: false,
options: [],
keys: ['blog_url']
}
},
computed: {
@ -72,8 +88,14 @@ export default {
},
created() {
this.loadComments()
this.loadOptions()
},
methods: {
loadOptions() {
optionApi.listAll(this.keys).then(response => {
this.options = response.data.data
})
},
loadComments() {
this.loading = true
commentApi.latestComment(this.type, 5, 'PUBLISHED').then(response => {

@ -43,19 +43,19 @@
:to="{name:'LinkList'}"
v-if="record.id==1"
>
<a href="javascript:void(0);">编辑</a>
<a href="javascript:void(0);">管理</a>
</router-link>
<router-link
:to="{name:'PhotoList'}"
v-if="record.id==2"
>
<a href="javascript:void(0);">编辑</a>
<a href="javascript:void(0);">管理</a>
</router-link>
<router-link
:to="{name:'JournalList'}"
v-if="record.id==3"
>
<a href="javascript:void(0);">编辑</a>
<a href="javascript:void(0);">管理</a>
</router-link>
<a-divider type="vertical" />
<a :href="options.blog_url+record.url" target="_blank">查看</a>

Loading…
Cancel
Save