添加草稿功能

This commit is contained in:
2020-09-16 23:35:24 +08:00
parent 35e5523b93
commit 24a603c755
8 changed files with 218 additions and 102 deletions

View File

@ -161,7 +161,7 @@
Icon(:icon='["fas", "chevron-right"]')
modal(name='setting')
div
| ok
| 此功能正在开发中敬请期待
.vue-module-buttons
button.vue-module-button(
type='button',
@ -175,8 +175,16 @@ import remark from 'remark'
import strip from 'strip-markdown'
export default {
async asyncData ({ route, app, $axios }) {
const data = await $axios.$get(`/public/article/details?id=${route.params.id}`)
async asyncData ({ route, app, $axios, redirect }) {
let draftStr = ''
if (route.query && route.query.draft === 'true') {
draftStr = '&draft=true'
}
const data = await $axios.$get(`/public/article/details?id=${route.params.id}${draftStr}`)
if (data.status === 404) {
redirect('/404')
return
}
const result = data.result
result.post_date = app.$moment(result.post_date).utc().format('lll')// 格式化时间
// 热度值计算