新增页面自定义发表时间功能

pull/35/head
guqing 2019-07-17 15:38:34 +08:00
parent 0b714a948f
commit 2965076601
2 changed files with 32 additions and 0 deletions

View File

@ -288,6 +288,10 @@ export default {
},
computed: {
pickerDefaultValue() {
if (this.postToStage.createTime) {
var date = new Date(this.postToStage.createTime)
return moment(date, 'YYYY-MM-DD HH:mm:ss')
}
return moment(new Date(), 'YYYY-MM-DD HH:mm:ss')
}
},

View File

@ -57,6 +57,18 @@
<a-radio :value="true">关闭</a-radio>
</a-radio-group>
</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-select v-model="sheetToStage.template">
<a-select-option
@ -139,6 +151,7 @@ import sheetApi from '@/api/sheet'
import themeApi from '@/api/theme'
import optionApi from '@/api/option'
import attachmentApi from '@/api/attachment'
import moment from 'moment'
export default {
components: {
mavonEditor,
@ -197,6 +210,15 @@ export default {
}
})
},
computed: {
pickerDefaultValue() {
if (this.sheetToStage.createTime) {
var date = new Date(this.sheetToStage.createTime)
return moment(date, 'YYYY-MM-DD HH:mm:ss')
}
return moment(new Date(), 'YYYY-MM-DD HH:mm:ss')
}
},
methods: {
loadCustomTpls() {
themeApi.customTpls().then(response => {
@ -274,6 +296,12 @@ export default {
this.$message.error('图片上传失败:' + responseObject.message)
}
})
},
onChange(value, dateString) {
this.sheetToStage.createTime = value.valueOf()
},
onOk(value) {
this.sheetToStage.createTime = value.valueOf()
}
}
}