Browse Source

Refactor SheetList.

pull/9/head
ruibaby 6 years ago
parent
commit
6dc59a5e2a
  1. 10
      src/api/theme.js
  2. 44
      src/components/Tools/HeaderComment.vue
  3. 4
      src/views/dashboard/Dashboard.vue
  4. 26
      src/views/sheet/SheetList.vue

10
src/api/theme.js

@ -124,4 +124,14 @@ themeApi.reload = () => {
})
}
themeApi.exists = template => {
return service({
url: `${baseUrl}/activation/template/exists`,
method: 'get',
params: {
template: template
}
})
}
export default themeApi

44
src/components/Tools/HeaderComment.vue

@ -70,35 +70,6 @@
</a-list-item>
</a-list>
</a-tab-pane>
<a-tab-pane
tab="日志"
key="3"
>
<a-list :dataSource="converttedJournalComments">
<a-list-item
slot="renderItem"
slot-scope="item"
>
<a-list-item-meta>
<a-avatar
style="background-color: white"
slot="avatar"
:src="'https://gravatar.loli.net/avatar/' + item.gavatarMd5 + '&d=mm'"
size="large"
/>
<template slot="title">
<a
:href="item.authorUrl"
target="_blank"
>{{ item.author }}</a><span v-html="item.content"></span>
</template>
<template slot="description">
{{ item.createTime | timeAgo }}
</template>
</a-list-item-meta>
</a-list-item>
</a-list>
</a-tab-pane>
</a-tabs>
</div>
</a-spin>
@ -109,7 +80,7 @@
>
<a-badge
dot
v-if="postComments.length > 0"
v-if="postComments.length > 0 || sheetComments.length > 0"
>
<a-icon type="bell" />
</a-badge>
@ -131,8 +102,7 @@ export default {
loadding: false,
visible: false,
postComments: [],
sheetComments: [],
journalComments: []
sheetComments: []
}
},
created() {
@ -150,12 +120,6 @@ export default {
comment.content = marked(comment.content, { sanitize: true })
return comment
})
},
converttedJournalComments() {
return this.journalComments.map(comment => {
comment.content = marked(comment.content, { sanitize: true })
return comment
})
}
},
methods: {
@ -177,10 +141,6 @@ export default {
this.sheetComments = response.data.data
this.loadding = false
})
commentApi.latestComment('journals', 5, 'AUDITING').then(response => {
this.journalComments = response.data.data
this.loadding = false
})
}
}
}

4
src/views/dashboard/Dashboard.vue

@ -144,12 +144,12 @@
>
<recent-comment-tab type="sheets"></recent-comment-tab>
</a-tab-pane>
<a-tab-pane
<!-- <a-tab-pane
tab="日志"
key="3"
>
<recent-comment-tab type="journals"></recent-comment-tab>
</a-tab-pane>
</a-tab-pane> -->
</a-tabs>
</div>
</a-tab-pane>

26
src/views/sheet/SheetList.vue

@ -15,7 +15,7 @@
v-if="isMobile()"
>
<a-collapse-panel
v-for="(item,index) in internalPages"
v-for="(item,index) in internalSheets"
:key="index"
>
<a
@ -31,7 +31,7 @@
<a-table
:columns="internalColumns"
:dataSource="internalPages"
:dataSource="internalSheets"
:pagination="false"
:rowKey="page => page.id"
>
@ -58,7 +58,10 @@
<a href="javascript:void(0);">管理</a>
</router-link>
<a-divider type="vertical" />
<a :href="options.blog_url+record.url" target="_blank">查看</a>
<a
:href="options.blog_url+record.url"
target="_blank"
>查看</a>
</span>
</a-table>
</a-tab-pane>
@ -150,6 +153,10 @@ const internalColumns = [
title: '访问路径',
dataIndex: 'url'
},
{
title: '状态',
dataIndex: 'status'
},
{
title: '操作',
dataIndex: 'action',
@ -187,21 +194,24 @@ const customColumns = [
scopedSlots: { customRender: 'action' }
}
]
const internalPages = [
const internalSheets = [
{
id: '1',
name: '友情链接',
url: '/links'
url: '/links',
status: '可用'
},
{
id: '2',
name: '图库页面',
url: '/photos'
url: '/photos',
status: '可用'
},
{
id: '3',
name: '日志页面',
url: '/journals'
url: '/journals',
status: '实验性'
}
]
export default {
@ -211,7 +221,7 @@ export default {
sheetStatus: sheetApi.sheetStatus,
internalColumns,
customColumns,
internalPages,
internalSheets,
sheets: [],
options: [],
keys: ['blog_url']

Loading…
Cancel
Save