Browse Source

Refactor SheetList.

pull/9/head
ruibaby 6 years ago
parent
commit
6dc59a5e2a
  1. 12
      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

12
src/api/theme.js

@ -124,4 +124,14 @@ themeApi.reload = () => {
}) })
} }
export default themeApi 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-item>
</a-list> </a-list>
</a-tab-pane> </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> </a-tabs>
</div> </div>
</a-spin> </a-spin>
@ -109,7 +80,7 @@
> >
<a-badge <a-badge
dot dot
v-if="postComments.length > 0" v-if="postComments.length > 0 || sheetComments.length > 0"
> >
<a-icon type="bell" /> <a-icon type="bell" />
</a-badge> </a-badge>
@ -131,8 +102,7 @@ export default {
loadding: false, loadding: false,
visible: false, visible: false,
postComments: [], postComments: [],
sheetComments: [], sheetComments: []
journalComments: []
} }
}, },
created() { created() {
@ -150,12 +120,6 @@ export default {
comment.content = marked(comment.content, { sanitize: true }) comment.content = marked(comment.content, { sanitize: true })
return comment return comment
}) })
},
converttedJournalComments() {
return this.journalComments.map(comment => {
comment.content = marked(comment.content, { sanitize: true })
return comment
})
} }
}, },
methods: { methods: {
@ -177,10 +141,6 @@ export default {
this.sheetComments = response.data.data this.sheetComments = response.data.data
this.loadding = false 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> <recent-comment-tab type="sheets"></recent-comment-tab>
</a-tab-pane> </a-tab-pane>
<a-tab-pane <!-- <a-tab-pane
tab="日志" tab="日志"
key="3" key="3"
> >
<recent-comment-tab type="journals"></recent-comment-tab> <recent-comment-tab type="journals"></recent-comment-tab>
</a-tab-pane> </a-tab-pane> -->
</a-tabs> </a-tabs>
</div> </div>
</a-tab-pane> </a-tab-pane>

26
src/views/sheet/SheetList.vue

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

Loading…
Cancel
Save