refactor: refactor post preview and private post view.

pull/3445/head
ruibaby 2019-12-19 17:50:23 +08:00
parent 00064d1d47
commit 741c4f97cd
12 changed files with 74 additions and 71 deletions

4
.npmignore Normal file
View File

@ -0,0 +1,4 @@
/node_modules/*
/.idea/*
/.git/*
/.github/*

View File

@ -1,7 +1,6 @@
{
"name": "halo-admin",
"version": "1.2.0-beta.1",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
@ -126,5 +125,16 @@
"> 1%",
"last 2 versions",
"not ie <= 10"
]
],
"description": "Halo admin client.",
"repository": {
"type": "git",
"url": "git+https://github.com/halo-dev/halo-admin.git"
},
"author": "halo-dev",
"license": "ISC",
"bugs": {
"url": "https://github.com/halo-dev/halo-admin/issues"
},
"homepage": "https://github.com/halo-dev/halo-admin#readme"
}

View File

@ -116,4 +116,14 @@ adminApi.getLogFiles = lines => {
})
}
adminApi.downloadLogFiles = lines => {
return service({
url: `${baseUrl}/halo/logfile/download`,
params: {
lines: lines
},
method: 'get'
})
}
export default adminApi

View File

@ -36,3 +36,12 @@ Vue.filter('fileSizeFormat', function(value) {
size = size.toFixed(2)
return size + ' ' + unitArr[index]
})
Vue.filter('dayTime', function(value) {
var days = Math.floor(value / 86400)
var hours = Math.floor((value % 86400) / 3600)
var minutes = Math.floor(((value % 86400) % 3600) / 60)
var seconds = Math.floor(((value % 86400) % 3600) % 60)
var duration = days + 'd ' + hours + 'h ' + minutes + 'm ' + seconds + 's'
return duration
})

View File

@ -122,17 +122,11 @@
>
<a-list-item-meta>
<a
v-if="item.status=='PUBLISHED'"
v-if="item.status=='PUBLISHED' || item.status == 'INTIMATE'"
slot="title"
:href="options.blog_url+'/archives/'+item.url"
target="_blank"
>{{ item.title }}</a>
<a
v-else-if="item.status == 'INTIMATE'"
slot="title"
:href="options.blog_url+'/archives/'+item.url+'/password'"
target="_blank"
>{{ item.title }}</a>
<a
v-else-if="item.status=='DRAFT'"
slot="title"

View File

@ -18,13 +18,9 @@
:href="item.authorUrl"
target="_blank"
>{{ item.author }}</a> 发表在 <a
v-if="item.post.status=='PUBLISHED'"
v-if="item.post.status=='PUBLISHED' || item.post.status=='INTIMATE'"
:href="options.blog_url+'/archives/'+item.post.url"
target="_blank"
>{{ item.post.title }}</a><a
v-else-if="item.post.status=='INTIMATE'"
:href="options.blog_url+'/archives/'+item.post.url+'/password'"
target="_blank"
>{{ item.post.title }}</a><a
v-else-if="item.post.status=='DRAFT'"
href="javascript:void(0)"

View File

@ -236,7 +236,7 @@
style="margin-right: 3px;"
/>
<a
v-if="item.status=='PUBLISHED'"
v-if="item.status=='PUBLISHED' || item.status == 'INTIMATE'"
:href="options.blog_url+'/archives/'+item.url"
target="_blank"
style="text-decoration: none;"
@ -246,17 +246,6 @@
:title="'点击访问【'+item.title+'】'"
>{{ item.title }}</a-tooltip>
</a>
<a
v-else-if="item.status == 'INTIMATE'"
:href="options.blog_url+'/archives/'+item.url+'/password'"
target="_blank"
style="text-decoration: none;"
>
<a-tooltip
placement="top"
:title="'点击访问【'+item.title+'】'"
>{{ item.title }}</a-tooltip>
</a>
<a
v-else-if="item.status=='DRAFT'"
href="javascript:void(0)"
@ -328,7 +317,7 @@
style="margin-right: 3px;"
/>
<a
v-if="record.status=='PUBLISHED'"
v-if="record.status=='PUBLISHED' || record.status == 'INTIMATE'"
:href="options.blog_url+'/archives/'+record.url"
target="_blank"
style="text-decoration: none;"
@ -338,17 +327,6 @@
:title="'点击访问【'+text+'】'"
>{{ text }}</a-tooltip>
</a>
<a
v-else-if="record.status == 'INTIMATE'"
:href="options.blog_url+'/archives/'+record.url+'/password'"
target="_blank"
style="text-decoration: none;"
>
<a-tooltip
placement="top"
:title="'点击访问【'+text+'】'"
>{{ text }}</a-tooltip>
</a>
<a
v-else-if="record.status=='DRAFT'"
href="javascript:void(0)"

View File

@ -181,7 +181,7 @@
</a-menu-item>
<a-menu-item v-else-if="item.status === 'RECYCLE'">
<a-popconfirm
:title="'你确定要发布【' + item.title + '】文章'"
:title="'你确定要发布【' + item.title + '】页面'"
@confirm="handleEditStatusClick(item.id,'PUBLISHED')"
okText="确定"
cancelText="取消"
@ -191,7 +191,7 @@
</a-menu-item>
<a-menu-item v-if="item.status === 'PUBLISHED' || item.status === 'DRAFT'">
<a-popconfirm
:title="'你确定要将【' + item.title + '】文章移到回收站?'"
:title="'你确定要将【' + item.title + '】页面移到回收站?'"
@confirm="handleEditStatusClick(item.id,'RECYCLE')"
okText="确定"
cancelText="取消"
@ -201,7 +201,7 @@
</a-menu-item>
<a-menu-item v-else-if="item.status === 'RECYCLE'">
<a-popconfirm
:title="'你确定要永久删除【' + item.title + '】文章'"
:title="'你确定要永久删除【' + item.title + '】页面'"
@confirm="handleDeleteClick(item.id)"
okText="确定"
cancelText="取消"
@ -245,13 +245,6 @@
slot="title"
style="max-width: 300px;display: block;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;"
>
<a-icon
type="pushpin"
v-if="item.topPriority!=0"
theme="twoTone"
twoToneColor="red"
style="margin-right: 3px;"
/>
<a
v-if="item.status=='PUBLISHED'"
:href="options.blog_url+'/archives/'+item.url"
@ -263,17 +256,6 @@
:title="'点击访问【'+item.title+'】'"
>{{ item.title }}</a-tooltip>
</a>
<a
v-else-if="item.status == 'INTIMATE'"
:href="options.blog_url+'/archives/'+item.url+'/password'"
target="_blank"
style="text-decoration: none;"
>
<a-tooltip
placement="top"
:title="'点击访问【'+item.title+'】'"
>{{ item.title }}</a-tooltip>
</a>
<a
v-else-if="item.status=='DRAFT'"
href="javascript:void(0)"

View File

@ -127,7 +127,7 @@ export default {
title: '版本要求',
alert: {
type: 'warning',
message: '注意:要求 Halo server 版本大于 v1.1.3!你可以在 【系统 | 关于】 里面找到系统的版本信息。'
message: '注意:要求 Halo server 版本大于 v1.1.1!你可以在 【系统 | 关于】 里面找到系统的版本信息。'
}
}
]

View File

@ -161,7 +161,7 @@
</tr>
<tr>
<td>已启动时间</td>
<td>{{ system.process.uptime }} </td>
<td>{{ system.process.uptime | dayTime }} </td>
</tr>
<tr>
<td>启动目录</td>

View File

@ -13,10 +13,6 @@
</a-skeleton>
</a-form-item>
<a-form-item>
<a-button
type="primary"
style="margin-right: 8px;"
>下载</a-button>
<a-select
defaultValue="200"
style="margin-right: 8px;width: 100px"
@ -28,9 +24,11 @@
<a-select-option value="1000">1000 </a-select-option>
</a-select>
<a-button
type="dash"
type="primary"
style="margin-right: 8px;"
@click="()=>this.loadLogs()"
>刷新</a-button>
<a-button type="dash" @click="handleDownloadLogFile()"></a-button>
</a-form-item>
</a-form>
</template>
@ -67,6 +65,11 @@ export default {
this.loading = false
})
},
handleDownloadLogFile() {
adminApi.downloadLogFiles(this.logLines).then(response => {
this.$message.success('下载成功!')
})
},
handleLinesChange(value) {
this.logLines = value
}

View File

@ -29,11 +29,22 @@
<a-table
:rowKey="record => record.name"
:columns="columns"
:dataSource="statics"
:dataSource="sortedStatics"
:pagination="false"
size="middle"
:loading="loading"
>
<span
slot="name"
slot-scope="name"
>
<ellipsis
length="64"
tooltip
>
{{ name }}
</ellipsis>
</span>
<span
slot="createTime"
slot-scope="createTime"
@ -130,12 +141,12 @@ const columns = [
{
title: '文件名',
dataIndex: 'name',
scopedSlots: { customRender: 'key' }
scopedSlots: { customRender: 'name' }
},
{
title: '文件类型',
dataIndex: 'mediaType',
scopedSlots: { customRender: 'mediaType' }
dataIndex: 'mimeType',
scopedSlots: { customRender: 'mimeType' }
},
{
title: '上传时间',
@ -168,7 +179,13 @@ export default {
this.loadStaticList()
},
computed: {
...mapGetters(['options'])
...mapGetters(['options']),
sortedStatics() {
const data = this.statics.slice(0)
return data.sort(function(a, b) {
return b.createTime - a.createTime
})
}
},
methods: {
loadStaticList() {