mirror of https://github.com/halo-dev/halo-admin
refactor: related functions for publishing posts. (#99)
parent
b7ff9232ff
commit
865f1729a2
|
@ -6581,9 +6581,9 @@
|
||||||
"optional": true
|
"optional": true
|
||||||
},
|
},
|
||||||
"filepond": {
|
"filepond": {
|
||||||
"version": "4.12.0",
|
"version": "4.13.0",
|
||||||
"resolved": "https://registry.npmjs.org/filepond/-/filepond-4.12.0.tgz",
|
"resolved": "https://registry.npmjs.org/filepond/-/filepond-4.13.0.tgz",
|
||||||
"integrity": "sha512-43+WI8R3RtSiPsKTcofnf9CW3i26sENIJFC1VERlu593mg/c5o74SU+gUfoocRWqDWQxjwE2qrobe+CUCPRASg=="
|
"integrity": "sha512-M9bNneR2EBrhXqNMHZLDRZVRSPJ5fUa8hjKyfMuJ8dV61qW1oPsFWZY2Ubx7WmVKZXnBLJCef2WNGh6CaIoTew=="
|
||||||
},
|
},
|
||||||
"filepond-plugin-image-preview": {
|
"filepond-plugin-image-preview": {
|
||||||
"version": "4.6.1",
|
"version": "4.6.1",
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
"ant-design-vue": "^1.5.0-beta.1",
|
"ant-design-vue": "^1.5.0-beta.1",
|
||||||
"axios": "^0.19.2",
|
"axios": "^0.19.2",
|
||||||
"enquire.js": "^2.1.6",
|
"enquire.js": "^2.1.6",
|
||||||
"filepond": "^4.12.0",
|
"filepond": "^4.13.0",
|
||||||
"filepond-plugin-image-preview": "^4.6.1",
|
"filepond-plugin-image-preview": "^4.6.1",
|
||||||
"halo-editor": "^2.8.2",
|
"halo-editor": "^2.8.2",
|
||||||
"marked": "^0.8.0",
|
"marked": "^0.8.0",
|
||||||
|
|
|
@ -17,9 +17,14 @@
|
||||||
href="javascript:void(0)"
|
href="javascript:void(0)"
|
||||||
@click="showOptionModal"
|
@click="showOptionModal"
|
||||||
>
|
>
|
||||||
<span class="action">
|
<a-tooltip
|
||||||
<a-icon type="setting" />
|
placement="bottom"
|
||||||
</span>
|
title="后台布局设置"
|
||||||
|
>
|
||||||
|
<span class="action">
|
||||||
|
<a-icon type="setting" />
|
||||||
|
</span>
|
||||||
|
</a-tooltip>
|
||||||
</a>
|
</a>
|
||||||
<header-comment class="action" />
|
<header-comment class="action" />
|
||||||
<a-dropdown>
|
<a-dropdown>
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<div>
|
<div>
|
||||||
<halo-editor
|
<halo-editor
|
||||||
ref="md"
|
ref="md"
|
||||||
v-model="originalContent"
|
v-model="originalContentData"
|
||||||
:boxShadow="false"
|
:boxShadow="false"
|
||||||
:toolbars="toolbars"
|
:toolbars="toolbars"
|
||||||
:ishljs="true"
|
:ishljs="true"
|
||||||
|
|
|
@ -189,7 +189,7 @@
|
||||||
v-if="selectAttachment"
|
v-if="selectAttachment"
|
||||||
:attachment="selectAttachment"
|
:attachment="selectAttachment"
|
||||||
:addToPhoto="true"
|
:addToPhoto="true"
|
||||||
@delete="() => this.loadAttachments()"
|
@delete="loadAttachments()"
|
||||||
/>
|
/>
|
||||||
</page-view>
|
</page-view>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -107,7 +107,7 @@ export default {
|
||||||
drawerWidth: {
|
drawerWidth: {
|
||||||
type: Number,
|
type: Number,
|
||||||
required: false,
|
required: false,
|
||||||
default: 460
|
default: 480
|
||||||
},
|
},
|
||||||
title: {
|
title: {
|
||||||
type: String,
|
type: String,
|
||||||
|
|
|
@ -233,7 +233,7 @@
|
||||||
>
|
>
|
||||||
<a
|
<a
|
||||||
href="javascript:void(0);"
|
href="javascript:void(0);"
|
||||||
@click="()=>this.logListDrawerVisible = true"
|
@click="logListDrawerVisible = true"
|
||||||
>
|
>
|
||||||
<a-icon type="ellipsis" />
|
<a-icon type="ellipsis" />
|
||||||
</a>
|
</a>
|
||||||
|
|
|
@ -128,7 +128,7 @@
|
||||||
<a
|
<a
|
||||||
rel="noopener noreferrer"
|
rel="noopener noreferrer"
|
||||||
href="javascript:void(0);"
|
href="javascript:void(0);"
|
||||||
@click="()=>this.uploadThemeVisible = true"
|
@click="uploadThemeVisible = true"
|
||||||
>安装主题</a>
|
>安装主题</a>
|
||||||
</a-menu-item>
|
</a-menu-item>
|
||||||
<a-menu-item>
|
<a-menu-item>
|
||||||
|
|
|
@ -40,7 +40,7 @@
|
||||||
<a
|
<a
|
||||||
href="javascript:void(0);"
|
href="javascript:void(0);"
|
||||||
slot="addonAfter"
|
slot="addonAfter"
|
||||||
@click="()=>this.thumbnailDrawerVisible = true"
|
@click="thumbnailDrawerVisible = true"
|
||||||
>
|
>
|
||||||
<a-icon type="picture" />
|
<a-icon type="picture" />
|
||||||
</a>
|
</a>
|
||||||
|
|
|
@ -12,17 +12,16 @@
|
||||||
|
|
||||||
<div id="editor">
|
<div id="editor">
|
||||||
<MarkdownEditor
|
<MarkdownEditor
|
||||||
v-if="postToStage.editorType=='MARKDOWN'"
|
|
||||||
:originalContent="postToStage.originalContent"
|
:originalContent="postToStage.originalContent"
|
||||||
@onSaveDraft="handleSaveDraft(true)"
|
@onSaveDraft="handleSaveDraft(true)"
|
||||||
@onContentChange="onContentChange"
|
@onContentChange="onContentChange"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<RichTextEditor
|
<!-- <RichTextEditor
|
||||||
v-else
|
v-else
|
||||||
:originalContent="postToStage.originalContent"
|
:originalContent="postToStage.originalContent"
|
||||||
@onContentChange="onContentChange"
|
@onContentChange="onContentChange"
|
||||||
/>
|
/> -->
|
||||||
</div>
|
</div>
|
||||||
</a-col>
|
</a-col>
|
||||||
</a-row>
|
</a-row>
|
||||||
|
@ -61,7 +60,7 @@
|
||||||
>发布</a-button>
|
>发布</a-button>
|
||||||
<a-button
|
<a-button
|
||||||
type="dashed"
|
type="dashed"
|
||||||
@click="()=>this.attachmentDrawerVisible = true"
|
@click="attachmentDrawerVisible = true"
|
||||||
style="margin-left: 8px;"
|
style="margin-left: 8px;"
|
||||||
>附件库</a-button>
|
>附件库</a-button>
|
||||||
</footer-tool-bar>
|
</footer-tool-bar>
|
||||||
|
@ -70,13 +69,13 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { mixin, mixinDevice } from '@/utils/mixin.js'
|
import { mixin, mixinDevice } from '@/utils/mixin.js'
|
||||||
import { mapGetters } from 'vuex'
|
// import { mapGetters } from 'vuex'
|
||||||
import moment from 'moment'
|
import moment from 'moment'
|
||||||
import PostSettingDrawer from './components/PostSettingDrawer'
|
import PostSettingDrawer from './components/PostSettingDrawer'
|
||||||
import AttachmentDrawer from '../attachment/components/AttachmentDrawer'
|
import AttachmentDrawer from '../attachment/components/AttachmentDrawer'
|
||||||
import FooterToolBar from '@/components/FooterToolbar'
|
import FooterToolBar from '@/components/FooterToolbar'
|
||||||
import MarkdownEditor from '@/components/editor/MarkdownEditor'
|
import MarkdownEditor from '@/components/editor/MarkdownEditor'
|
||||||
import RichTextEditor from '@/components/editor/RichTextEditor'
|
// import RichTextEditor from '@/components/editor/RichTextEditor'
|
||||||
|
|
||||||
import postApi from '@/api/post'
|
import postApi from '@/api/post'
|
||||||
export default {
|
export default {
|
||||||
|
@ -85,8 +84,8 @@ export default {
|
||||||
PostSettingDrawer,
|
PostSettingDrawer,
|
||||||
FooterToolBar,
|
FooterToolBar,
|
||||||
AttachmentDrawer,
|
AttachmentDrawer,
|
||||||
MarkdownEditor,
|
MarkdownEditor
|
||||||
RichTextEditor
|
// RichTextEditor
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
@ -160,9 +159,9 @@ export default {
|
||||||
}
|
}
|
||||||
return '当前页面数据未保存,确定要离开吗?'
|
return '当前页面数据未保存,确定要离开吗?'
|
||||||
}
|
}
|
||||||
if (!this.postToStage.editorType) {
|
// if (!this.postToStage.editorType) {
|
||||||
this.postToStage.editorType = this.options.default_editor
|
// this.postToStage.editorType = this.options.default_editor
|
||||||
}
|
// }
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
temporaryContent: function(newValue, oldValue) {
|
temporaryContent: function(newValue, oldValue) {
|
||||||
|
@ -174,8 +173,8 @@ export default {
|
||||||
computed: {
|
computed: {
|
||||||
temporaryContent() {
|
temporaryContent() {
|
||||||
return this.postToStage.originalContent
|
return this.postToStage.originalContent
|
||||||
},
|
}
|
||||||
...mapGetters(['options'])
|
// ...mapGetters(['options'])
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
handleSaveDraft(draftOnly = false) {
|
handleSaveDraft(draftOnly = false) {
|
||||||
|
|
|
@ -490,8 +490,6 @@
|
||||||
:metas="selectedMetas"
|
:metas="selectedMetas"
|
||||||
:needTitle="true"
|
:needTitle="true"
|
||||||
:saveDraftButton="false"
|
:saveDraftButton="false"
|
||||||
:savePublishButton="false"
|
|
||||||
:saveButton="true"
|
|
||||||
:visible="postSettingVisible"
|
:visible="postSettingVisible"
|
||||||
@close="onPostSettingsClose"
|
@close="onPostSettingsClose"
|
||||||
@onRefreshPost="onRefreshPostFromSetting"
|
@onRefreshPost="onRefreshPostFromSetting"
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
<a
|
<a
|
||||||
href="javascript:void(0);"
|
href="javascript:void(0);"
|
||||||
slot="addonAfter"
|
slot="addonAfter"
|
||||||
@click="()=>this.thumbnailDrawerVisible = true"
|
@click="thumbnailDrawerVisible = true"
|
||||||
>
|
>
|
||||||
<a-icon type="picture" />
|
<a-icon type="picture" />
|
||||||
</a>
|
</a>
|
||||||
|
|
|
@ -176,7 +176,7 @@
|
||||||
<img
|
<img
|
||||||
class="img"
|
class="img"
|
||||||
:src="selectedPost.thumbnail || '/images/placeholder.jpg'"
|
:src="selectedPost.thumbnail || '/images/placeholder.jpg'"
|
||||||
@click="()=>this.thumbDrawerVisible=true"
|
@click="thumbDrawerVisible=true"
|
||||||
>
|
>
|
||||||
|
|
||||||
<a-form layout="vertial">
|
<a-form layout="vertial">
|
||||||
|
@ -202,7 +202,7 @@
|
||||||
<AttachmentSelectDrawer
|
<AttachmentSelectDrawer
|
||||||
v-model="thumbDrawerVisible"
|
v-model="thumbDrawerVisible"
|
||||||
@listenToSelect="handleSelectPostThumb"
|
@listenToSelect="handleSelectPostThumb"
|
||||||
:drawerWidth="460"
|
:drawerWidth="480"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<a-drawer
|
<a-drawer
|
||||||
|
@ -279,7 +279,7 @@
|
||||||
<a-button
|
<a-button
|
||||||
style="marginRight: 8px"
|
style="marginRight: 8px"
|
||||||
type="dashed"
|
type="dashed"
|
||||||
@click="()=>this.advancedVisible = true"
|
@click="advancedVisible = true"
|
||||||
>高级</a-button>
|
>高级</a-button>
|
||||||
<a-button
|
<a-button
|
||||||
style="marginRight: 8px"
|
style="marginRight: 8px"
|
||||||
|
@ -290,15 +290,8 @@
|
||||||
<a-button
|
<a-button
|
||||||
@click="handlePublishClick"
|
@click="handlePublishClick"
|
||||||
type="primary"
|
type="primary"
|
||||||
v-if="savePublishButton"
|
|
||||||
:disabled="saving"
|
:disabled="saving"
|
||||||
>发布</a-button>
|
> {{ selectedPost.id?'保存':'发布' }} </a-button>
|
||||||
<a-button
|
|
||||||
@click="handlePublishClick"
|
|
||||||
type="primary"
|
|
||||||
v-if="saveButton"
|
|
||||||
:disabled="saving"
|
|
||||||
>保存</a-button>
|
|
||||||
</div>
|
</div>
|
||||||
</a-drawer>
|
</a-drawer>
|
||||||
</template>
|
</template>
|
||||||
|
@ -354,11 +347,6 @@ export default {
|
||||||
type: Array,
|
type: Array,
|
||||||
required: true
|
required: true
|
||||||
},
|
},
|
||||||
visible: {
|
|
||||||
type: Boolean,
|
|
||||||
required: false,
|
|
||||||
default: true
|
|
||||||
},
|
|
||||||
needTitle: {
|
needTitle: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
required: false,
|
required: false,
|
||||||
|
@ -369,15 +357,10 @@ export default {
|
||||||
required: false,
|
required: false,
|
||||||
default: true
|
default: true
|
||||||
},
|
},
|
||||||
savePublishButton: {
|
visible: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
required: false,
|
required: false,
|
||||||
default: true
|
default: true
|
||||||
},
|
|
||||||
saveButton: {
|
|
||||||
type: Boolean,
|
|
||||||
required: false,
|
|
||||||
default: false
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
|
@ -484,20 +467,13 @@ export default {
|
||||||
},
|
},
|
||||||
handleDraftClick() {
|
handleDraftClick() {
|
||||||
this.selectedPost.status = 'DRAFT'
|
this.selectedPost.status = 'DRAFT'
|
||||||
this.savePost()
|
this.createOrUpdatePost()
|
||||||
},
|
},
|
||||||
handlePublishClick() {
|
handlePublishClick() {
|
||||||
this.selectedPost.status = 'PUBLISHED'
|
this.selectedPost.status = 'PUBLISHED'
|
||||||
this.savePost()
|
this.createOrUpdatePost()
|
||||||
},
|
},
|
||||||
savePost() {
|
createOrUpdatePost() {
|
||||||
this.createOrUpdatePost(
|
|
||||||
() => this.$message.success('文章发布成功'),
|
|
||||||
() => this.$message.success('文章发布成功'),
|
|
||||||
false
|
|
||||||
)
|
|
||||||
},
|
|
||||||
createOrUpdatePost(createSuccess, updateSuccess, autoSave) {
|
|
||||||
if (!this.selectedPost.title) {
|
if (!this.selectedPost.title) {
|
||||||
this.$notification['error']({
|
this.$notification['error']({
|
||||||
message: '提示',
|
message: '提示',
|
||||||
|
@ -515,14 +491,18 @@ export default {
|
||||||
if (this.selectedPost.id) {
|
if (this.selectedPost.id) {
|
||||||
// Update the post
|
// Update the post
|
||||||
postApi
|
postApi
|
||||||
.update(this.selectedPost.id, this.selectedPost, autoSave)
|
.update(this.selectedPost.id, this.selectedPost, false)
|
||||||
.then(response => {
|
.then(response => {
|
||||||
this.$log.debug('Updated post', response.data.data)
|
this.$log.debug('Updated post', response.data.data)
|
||||||
if (updateSuccess) {
|
|
||||||
updateSuccess()
|
if (this.selectedPost.status === 'DRAFT') {
|
||||||
this.$emit('onSaved', true)
|
this.$message.success('草稿保存成功!')
|
||||||
this.$router.push({ name: 'PostList' })
|
} else {
|
||||||
|
this.$message.success('文章更新成功!')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.$emit('onSaved', true)
|
||||||
|
this.$router.push({ name: 'PostList' })
|
||||||
})
|
})
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
this.saving = false
|
this.saving = false
|
||||||
|
@ -530,14 +510,18 @@ export default {
|
||||||
} else {
|
} else {
|
||||||
// Create the post
|
// Create the post
|
||||||
postApi
|
postApi
|
||||||
.create(this.selectedPost, autoSave)
|
.create(this.selectedPost, false)
|
||||||
.then(response => {
|
.then(response => {
|
||||||
this.$log.debug('Created post', response.data.data)
|
this.$log.debug('Created post', response.data.data)
|
||||||
if (createSuccess) {
|
|
||||||
createSuccess()
|
if (this.selectedPost.status === 'DRAFT') {
|
||||||
this.$emit('onSaved', true)
|
this.$message.success('草稿保存成功!')
|
||||||
this.$router.push({ name: 'PostList' })
|
} else {
|
||||||
|
this.$message.success('文章发布成功!')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.$emit('onSaved', true)
|
||||||
|
this.$router.push({ name: 'PostList' })
|
||||||
this.selectedPost = response.data.data
|
this.selectedPost = response.data.data
|
||||||
})
|
})
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
|
|
|
@ -12,17 +12,16 @@
|
||||||
|
|
||||||
<div id="editor">
|
<div id="editor">
|
||||||
<MarkdownEditor
|
<MarkdownEditor
|
||||||
v-if="sheetToStage.editorType=='MARKDOWN'"
|
|
||||||
:originalContent="sheetToStage.originalContent"
|
:originalContent="sheetToStage.originalContent"
|
||||||
@onSaveDraft="handleSaveDraft(true)"
|
@onSaveDraft="handleSaveDraft(true)"
|
||||||
@onContentChange="onContentChange"
|
@onContentChange="onContentChange"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<RichTextEditor
|
<!-- <RichTextEditor
|
||||||
v-else
|
v-else
|
||||||
:originalContent="sheetToStage.originalContent"
|
:originalContent="sheetToStage.originalContent"
|
||||||
@onContentChange="onContentChange"
|
@onContentChange="onContentChange"
|
||||||
/>
|
/> -->
|
||||||
</div>
|
</div>
|
||||||
</a-col>
|
</a-col>
|
||||||
</a-row>
|
</a-row>
|
||||||
|
@ -57,7 +56,7 @@
|
||||||
<a-button
|
<a-button
|
||||||
type="dashed"
|
type="dashed"
|
||||||
style="margin-left: 8px;"
|
style="margin-left: 8px;"
|
||||||
@click="()=>this.attachmentDrawerVisible = true"
|
@click="attachmentDrawerVisible = true"
|
||||||
>附件库</a-button>
|
>附件库</a-button>
|
||||||
</footer-tool-bar>
|
</footer-tool-bar>
|
||||||
</div>
|
</div>
|
||||||
|
@ -65,13 +64,13 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { mixin, mixinDevice } from '@/utils/mixin.js'
|
import { mixin, mixinDevice } from '@/utils/mixin.js'
|
||||||
import { mapGetters } from 'vuex'
|
// import { mapGetters } from 'vuex'
|
||||||
import moment from 'moment'
|
import moment from 'moment'
|
||||||
import SheetSettingDrawer from './components/SheetSettingDrawer'
|
import SheetSettingDrawer from './components/SheetSettingDrawer'
|
||||||
import AttachmentDrawer from '../attachment/components/AttachmentDrawer'
|
import AttachmentDrawer from '../attachment/components/AttachmentDrawer'
|
||||||
import FooterToolBar from '@/components/FooterToolbar'
|
import FooterToolBar from '@/components/FooterToolbar'
|
||||||
import MarkdownEditor from '@/components/editor/MarkdownEditor'
|
import MarkdownEditor from '@/components/editor/MarkdownEditor'
|
||||||
import RichTextEditor from '@/components/editor/RichTextEditor'
|
// import RichTextEditor from '@/components/editor/RichTextEditor'
|
||||||
|
|
||||||
import sheetApi from '@/api/sheet'
|
import sheetApi from '@/api/sheet'
|
||||||
export default {
|
export default {
|
||||||
|
@ -79,8 +78,8 @@ export default {
|
||||||
FooterToolBar,
|
FooterToolBar,
|
||||||
AttachmentDrawer,
|
AttachmentDrawer,
|
||||||
SheetSettingDrawer,
|
SheetSettingDrawer,
|
||||||
MarkdownEditor,
|
MarkdownEditor
|
||||||
RichTextEditor
|
// RichTextEditor
|
||||||
},
|
},
|
||||||
mixins: [mixin, mixinDevice],
|
mixins: [mixin, mixinDevice],
|
||||||
data() {
|
data() {
|
||||||
|
@ -151,9 +150,9 @@ export default {
|
||||||
}
|
}
|
||||||
return '当前页面数据未保存,确定要离开吗?'
|
return '当前页面数据未保存,确定要离开吗?'
|
||||||
}
|
}
|
||||||
if (!this.sheetToStage.editorType) {
|
// if (!this.sheetToStage.editorType) {
|
||||||
this.sheetToStage.editorType = this.options.default_editor
|
// this.sheetToStage.editorType = this.options.default_editor
|
||||||
}
|
// }
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
temporaryContent: function(newValue, oldValue) {
|
temporaryContent: function(newValue, oldValue) {
|
||||||
|
@ -165,8 +164,8 @@ export default {
|
||||||
computed: {
|
computed: {
|
||||||
temporaryContent() {
|
temporaryContent() {
|
||||||
return this.sheetToStage.originalContent
|
return this.sheetToStage.originalContent
|
||||||
},
|
}
|
||||||
...mapGetters(['options'])
|
// ...mapGetters(['options'])
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
handleSaveDraft(draftOnly = false) {
|
handleSaveDraft(draftOnly = false) {
|
||||||
|
|
|
@ -321,6 +321,7 @@
|
||||||
:metas="selectedMetas"
|
:metas="selectedMetas"
|
||||||
:visible="sheetSettingVisible"
|
:visible="sheetSettingVisible"
|
||||||
:needTitle="true"
|
:needTitle="true"
|
||||||
|
:saveDraftButton="false"
|
||||||
@close="onSheetSettingsClose"
|
@close="onSheetSettingsClose"
|
||||||
@onRefreshSheet="onRefreshSheetFromSetting"
|
@onRefreshSheet="onRefreshSheetFromSetting"
|
||||||
@onRefreshSheetMetas="onRefreshSheetMetasFromSetting"
|
@onRefreshSheetMetas="onRefreshSheetMetasFromSetting"
|
||||||
|
|
|
@ -94,7 +94,7 @@
|
||||||
<img
|
<img
|
||||||
class="img"
|
class="img"
|
||||||
:src="selectedSheet.thumbnail || '/images/placeholder.jpg'"
|
:src="selectedSheet.thumbnail || '/images/placeholder.jpg'"
|
||||||
@click="()=>this.thumbDrawerVisible = true"
|
@click="thumbDrawerVisible = true"
|
||||||
>
|
>
|
||||||
|
|
||||||
<a-form layout="vertial">
|
<a-form layout="vertial">
|
||||||
|
@ -120,7 +120,7 @@
|
||||||
<AttachmentSelectDrawer
|
<AttachmentSelectDrawer
|
||||||
v-model="thumbDrawerVisible"
|
v-model="thumbDrawerVisible"
|
||||||
@listenToSelect="handleSelectSheetThumb"
|
@listenToSelect="handleSelectSheetThumb"
|
||||||
:drawerWidth="460"
|
:drawerWidth="480"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<a-drawer
|
<a-drawer
|
||||||
|
@ -197,9 +197,10 @@
|
||||||
<a-button
|
<a-button
|
||||||
style="marginRight: 8px"
|
style="marginRight: 8px"
|
||||||
type="dashed"
|
type="dashed"
|
||||||
@click="()=>this.advancedVisible = true"
|
@click="advancedVisible = true"
|
||||||
>高级</a-button>
|
>高级</a-button>
|
||||||
<a-button
|
<a-button
|
||||||
|
v-if="saveDraftButton"
|
||||||
style="marginRight: 8px"
|
style="marginRight: 8px"
|
||||||
@click="handleDraftClick"
|
@click="handleDraftClick"
|
||||||
:disabled="saving"
|
:disabled="saving"
|
||||||
|
@ -208,7 +209,7 @@
|
||||||
type="primary"
|
type="primary"
|
||||||
@click="handlePublishClick"
|
@click="handlePublishClick"
|
||||||
:disabled="saving"
|
:disabled="saving"
|
||||||
>发布</a-button>
|
>{{ selectedSheet.id?'保存':'发布' }}</a-button>
|
||||||
</div>
|
</div>
|
||||||
</a-drawer>
|
</a-drawer>
|
||||||
</template>
|
</template>
|
||||||
|
@ -249,6 +250,11 @@ export default {
|
||||||
required: false,
|
required: false,
|
||||||
default: false
|
default: false
|
||||||
},
|
},
|
||||||
|
saveDraftButton: {
|
||||||
|
type: Boolean,
|
||||||
|
required: false,
|
||||||
|
default: true
|
||||||
|
},
|
||||||
visible: {
|
visible: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
required: false,
|
required: false,
|
||||||
|
@ -325,20 +331,13 @@ export default {
|
||||||
},
|
},
|
||||||
handlePublishClick() {
|
handlePublishClick() {
|
||||||
this.selectedSheet.status = 'PUBLISHED'
|
this.selectedSheet.status = 'PUBLISHED'
|
||||||
this.saveSheet()
|
this.createOrUpdateSheet()
|
||||||
},
|
},
|
||||||
handleDraftClick() {
|
handleDraftClick() {
|
||||||
this.selectedSheet.status = 'DRAFT'
|
this.selectedSheet.status = 'DRAFT'
|
||||||
this.saveSheet()
|
this.createOrUpdateSheet()
|
||||||
},
|
},
|
||||||
saveSheet() {
|
createOrUpdateSheet() {
|
||||||
this.createOrUpdateSheet(
|
|
||||||
() => this.$message.success('页面发布成功!'),
|
|
||||||
() => this.$message.success('页面发布成功!'),
|
|
||||||
false
|
|
||||||
)
|
|
||||||
},
|
|
||||||
createOrUpdateSheet(createSuccess, updateSuccess, autoSave) {
|
|
||||||
if (!this.selectedSheet.title) {
|
if (!this.selectedSheet.title) {
|
||||||
this.$notification['error']({
|
this.$notification['error']({
|
||||||
message: '提示',
|
message: '提示',
|
||||||
|
@ -350,28 +349,36 @@ export default {
|
||||||
this.saving = true
|
this.saving = true
|
||||||
if (this.selectedSheet.id) {
|
if (this.selectedSheet.id) {
|
||||||
sheetApi
|
sheetApi
|
||||||
.update(this.selectedSheet.id, this.selectedSheet, autoSave)
|
.update(this.selectedSheet.id, this.selectedSheet, false)
|
||||||
.then(response => {
|
.then(response => {
|
||||||
this.$log.debug('Updated sheet', response.data.data)
|
this.$log.debug('Updated sheet', response.data.data)
|
||||||
if (updateSuccess) {
|
|
||||||
updateSuccess()
|
if (this.selectedSheet.status === 'DRAFT') {
|
||||||
this.$emit('onSaved', true)
|
this.$message.success('草稿保存成功!')
|
||||||
this.$router.push({ name: 'SheetList' })
|
} else {
|
||||||
|
this.$message.success('页面更新成功!')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.$emit('onSaved', true)
|
||||||
|
this.$router.push({ name: 'SheetList' })
|
||||||
})
|
})
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
this.saving = false
|
this.saving = false
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
sheetApi
|
sheetApi
|
||||||
.create(this.selectedSheet, autoSave)
|
.create(this.selectedSheet, false)
|
||||||
.then(response => {
|
.then(response => {
|
||||||
this.$log.debug('Created sheet', response.data.data)
|
this.$log.debug('Created sheet', response.data.data)
|
||||||
if (createSuccess) {
|
|
||||||
createSuccess()
|
if (this.selectedSheet.status === 'DRAFT') {
|
||||||
this.$emit('onSaved', true)
|
this.$message.success('草稿保存成功!')
|
||||||
this.$router.push({ name: 'SheetList' })
|
} else {
|
||||||
|
this.$message.success('页面发布成功!')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.$emit('onSaved', true)
|
||||||
|
this.$router.push({ name: 'SheetList' })
|
||||||
this.selectedSheet = response.data.data
|
this.selectedSheet = response.data.data
|
||||||
})
|
})
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
|
|
|
@ -163,7 +163,7 @@
|
||||||
shape="circle"
|
shape="circle"
|
||||||
icon="setting"
|
icon="setting"
|
||||||
size="large"
|
size="large"
|
||||||
@click="()=>this.optionFormVisible=true"
|
@click="optionFormVisible=true"
|
||||||
></a-button>
|
></a-button>
|
||||||
</div>
|
</div>
|
||||||
<a-modal
|
<a-modal
|
||||||
|
@ -205,7 +205,7 @@
|
||||||
<template slot="footer">
|
<template slot="footer">
|
||||||
<a-button
|
<a-button
|
||||||
type="dashed"
|
type="dashed"
|
||||||
@click="()=>this.attachmentDrawerVisible = true"
|
@click="attachmentDrawerVisible = true"
|
||||||
>附件库</a-button>
|
>附件库</a-button>
|
||||||
<a-button
|
<a-button
|
||||||
key="submit"
|
key="submit"
|
||||||
|
|
|
@ -202,7 +202,7 @@
|
||||||
shape="circle"
|
shape="circle"
|
||||||
icon="setting"
|
icon="setting"
|
||||||
size="large"
|
size="large"
|
||||||
@click="()=>this.optionFormVisible=true"
|
@click="optionFormVisible=true"
|
||||||
></a-button>
|
></a-button>
|
||||||
</div>
|
</div>
|
||||||
<a-modal
|
<a-modal
|
||||||
|
|
|
@ -122,7 +122,7 @@
|
||||||
shape="circle"
|
shape="circle"
|
||||||
icon="setting"
|
icon="setting"
|
||||||
size="large"
|
size="large"
|
||||||
@click="()=>this.optionFormVisible=true"
|
@click="optionFormVisible=true"
|
||||||
></a-button>
|
></a-button>
|
||||||
</div>
|
</div>
|
||||||
<a-modal
|
<a-modal
|
||||||
|
@ -298,7 +298,7 @@
|
||||||
<AttachmentSelectDrawer
|
<AttachmentSelectDrawer
|
||||||
v-model="thumDrawerVisible"
|
v-model="thumDrawerVisible"
|
||||||
@listenToSelect="selectPhotoThumb"
|
@listenToSelect="selectPhotoThumb"
|
||||||
:drawerWidth="460"
|
:drawerWidth="480"
|
||||||
/>
|
/>
|
||||||
<a-divider class="divider-transparent" />
|
<a-divider class="divider-transparent" />
|
||||||
<div class="bottom-control">
|
<div class="bottom-control">
|
||||||
|
|
|
@ -68,7 +68,7 @@
|
||||||
<a-button
|
<a-button
|
||||||
type="primary"
|
type="primary"
|
||||||
style="float:right"
|
style="float:right"
|
||||||
@click="()=>this.backupDrawerVisible = true"
|
@click="backupDrawerVisible = true"
|
||||||
>备份</a-button>
|
>备份</a-button>
|
||||||
</a-card>
|
</a-card>
|
||||||
</a-col>
|
</a-col>
|
||||||
|
|
|
@ -59,7 +59,7 @@
|
||||||
<a-button
|
<a-button
|
||||||
type="primary"
|
type="primary"
|
||||||
icon="plus"
|
icon="plus"
|
||||||
@click="()=>this.formVisible=true"
|
@click="formVisible=true"
|
||||||
>新增</a-button>
|
>新增</a-button>
|
||||||
</div>
|
</div>
|
||||||
<div style="margin-top:15px">
|
<div style="margin-top:15px">
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
<a-button
|
<a-button
|
||||||
type="primary"
|
type="primary"
|
||||||
style="margin-right: 8px;"
|
style="margin-right: 8px;"
|
||||||
@click="()=>this.loadLogs()"
|
@click="loadLogs()"
|
||||||
>刷新</a-button>
|
>刷新</a-button>
|
||||||
<a-button
|
<a-button
|
||||||
type="dashed"
|
type="dashed"
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
<a
|
<a
|
||||||
href="javascript:void(0);"
|
href="javascript:void(0);"
|
||||||
slot="addonAfter"
|
slot="addonAfter"
|
||||||
@click="()=>this.logoDrawerVisible = true"
|
@click="logoDrawerVisible = true"
|
||||||
>
|
>
|
||||||
<a-icon type="picture" />
|
<a-icon type="picture" />
|
||||||
</a>
|
</a>
|
||||||
|
@ -29,7 +29,7 @@
|
||||||
<a
|
<a
|
||||||
href="javascript:void(0);"
|
href="javascript:void(0);"
|
||||||
slot="addonAfter"
|
slot="addonAfter"
|
||||||
@click="()=>this.faviconDrawerVisible = true"
|
@click="faviconDrawerVisible = true"
|
||||||
>
|
>
|
||||||
<a-icon type="picture" />
|
<a-icon type="picture" />
|
||||||
</a>
|
</a>
|
||||||
|
|
|
@ -4,12 +4,12 @@
|
||||||
layout="vertical"
|
layout="vertical"
|
||||||
:wrapperCol="wrapperCol"
|
:wrapperCol="wrapperCol"
|
||||||
>
|
>
|
||||||
<a-form-item label="默认编辑器:">
|
<!-- <a-form-item label="默认编辑器:">
|
||||||
<a-select v-model="options.default_editor">
|
<a-select v-model="options.default_editor">
|
||||||
<a-select-option value="MARKDOWN">Markdown 编辑器</a-select-option>
|
<a-select-option value="MARKDOWN">Markdown 编辑器</a-select-option>
|
||||||
<a-select-option value="RICHTEXT">富文本编辑器</a-select-option>
|
<a-select-option value="RICHTEXT">富文本编辑器</a-select-option>
|
||||||
</a-select>
|
</a-select>
|
||||||
</a-form-item>
|
</a-form-item> -->
|
||||||
<a-form-item label="首页文章排序:">
|
<a-form-item label="首页文章排序:">
|
||||||
<a-select v-model="options.post_index_sort">
|
<a-select v-model="options.post_index_sort">
|
||||||
<a-select-option value="createTime">创建时间</a-select-option>
|
<a-select-option value="createTime">创建时间</a-select-option>
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
<div class="avatar">
|
<div class="avatar">
|
||||||
<img
|
<img
|
||||||
:src="user.avatar || '//cn.gravatar.com/avatar/?s=256&d=mm'"
|
:src="user.avatar || '//cn.gravatar.com/avatar/?s=256&d=mm'"
|
||||||
@click="()=>this.attachmentDrawerVisible = true"
|
@click="attachmentDrawerVisible = true"
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
</a-tooltip>
|
</a-tooltip>
|
||||||
|
|
Loading…
Reference in New Issue