新增自定义文章发布时间功能

pull/35/head
guqing 2019-07-17 15:05:51 +08:00
parent a8434eb04b
commit a1a7c0db61
1 changed files with 27 additions and 0 deletions

View File

@ -44,6 +44,20 @@
> >
<a-input v-model="postToStage.url" /> <a-input v-model="postToStage.url" />
</a-form-item> </a-form-item>
<a-form-item
label="发表时间:"
>
<a-date-picker
showTime
:defaultValue="pickerDefaultValue"
format="YYYY-MM-DD HH:mm:ss"
placeholder="Select Publish Time"
@change="onChange"
@ok="onOk"
/>
</a-form-item>
<a-form-item label="开启评论:"> <a-form-item label="开启评论:">
<a-radio-group <a-radio-group
v-model="postToStage.disallowComment" v-model="postToStage.disallowComment"
@ -205,6 +219,7 @@ import categoryApi from '@/api/category'
import postApi from '@/api/post' import postApi from '@/api/post'
import optionApi from '@/api/option' import optionApi from '@/api/option'
import attachmentApi from '@/api/attachment' import attachmentApi from '@/api/attachment'
import moment from 'moment'
export default { export default {
components: { components: {
TagSelect, TagSelect,
@ -272,6 +287,11 @@ export default {
} }
}) })
}, },
computed: {
pickerDefaultValue() {
return moment(new Date(), 'YYYY-MM-DD HH:mm:ss')
}
},
methods: { methods: {
loadCategories() { loadCategories() {
categoryApi.listAll().then(response => { categoryApi.listAll().then(response => {
@ -365,6 +385,13 @@ export default {
this.$message.error('图片上传失败:' + responseObject.message) this.$message.error('图片上传失败:' + responseObject.message)
} }
}) })
},
onChange(value, dateString) {
this.postToStage.createTime = value.valueOf()
},
onOk(value) {
var dateString = value.format('YYYY-MM-DD HH:mm:ss')
this.postToStage.createTime = value.valueOf()
} }
} }
} }