diff --git a/src/components/Post/MetaEditor.vue b/src/components/Post/MetaEditor.vue new file mode 100644 index 00000000..5a8d70b5 --- /dev/null +++ b/src/components/Post/MetaEditor.vue @@ -0,0 +1,151 @@ + + diff --git a/src/filters/filter.js b/src/filters/filter.js index f734772e..d537b9b0 100644 --- a/src/filters/filter.js +++ b/src/filters/filter.js @@ -7,14 +7,6 @@ import { timeAgo } from '@/utils/datetime' dayjs.locale('zh-cn') -Vue.filter('NumberFormat', function(value) { - if (!value) { - return '0' - } - // 将整数部分逢三一断 - return value.toString().replace(/(\d)(?=(?:\d{3})+$)/g, '$1,') -}) - Vue.filter('moment', function(dataStr, pattern = 'YYYY-MM-DD HH:mm') { return dayjs(dataStr).format(pattern) }) diff --git a/src/views/post/PostEdit.vue b/src/views/post/PostEdit.vue index ef71002e..cf9bd5f8 100644 --- a/src/views/post/PostEdit.vue +++ b/src/views/post/PostEdit.vue @@ -32,18 +32,11 @@ - @@ -54,7 +47,7 @@ import { mixin, mixinDevice, mixinPostEdit } from '@/mixins/mixin.js' import { datetimeFormat } from '@/utils/datetime' -import PostSettingDrawer from './components/PostSettingDrawer' +import PostSettingModal from './components/PostSettingModal' import AttachmentDrawer from '../attachment/components/AttachmentDrawer' import MarkdownEditor from '@/components/Editor/MarkdownEditor' import { PageView } from '@/layouts' @@ -64,7 +57,7 @@ import postApi from '@/api/post' export default { mixins: [mixin, mixinDevice, mixinPostEdit], components: { - PostSettingDrawer, + PostSettingModal, AttachmentDrawer, MarkdownEditor, PageView @@ -74,9 +67,6 @@ export default { attachmentDrawerVisible: false, postSettingVisible: false, postToStage: {}, - selectedTagIds: [], - selectedCategoryIds: [], - selectedMetas: [], contentChanges: 0, draftSaving: false, previewSaving: false, @@ -89,19 +79,12 @@ export default { next(vm => { if (postId) { postApi.get(postId).then(response => { - const post = response.data.data - vm.postToStage = post - vm.selectedTagIds = post.tagIds - vm.selectedCategoryIds = post.categoryIds - vm.selectedMetas = post.metas + vm.postToStage = response.data.data }) } }) }, - destroyed: function() { - if (this.postSettingVisible) { - this.postSettingVisible = false - } + destroyed() { if (this.attachmentDrawerVisible) { this.attachmentDrawerVisible = false } @@ -110,9 +93,6 @@ export default { } }, beforeRouteLeave(to, from, next) { - if (this.postSettingVisible) { - this.postSettingVisible = false - } if (this.attachmentDrawerVisible) { this.attachmentDrawerVisible = false } @@ -247,17 +227,12 @@ export default { this.contentChanges++ this.postToStage.originalContent = val }, - onRefreshPostFromSetting(post) { - this.postToStage = post - }, - onRefreshTagIdsFromSetting(tagIds) { - this.selectedTagIds = tagIds - }, - onRefreshCategoryIdsFromSetting(categoryIds) { - this.selectedCategoryIds = categoryIds + onPostSavedCallback() { + this.contentChanges = 0 + this.$router.push({ name: 'PostList' }) }, - onRefreshPostMetasFromSetting(metas) { - this.selectedMetas = metas + onUpdateFromSetting(post) { + this.postToStage = post } } } diff --git a/src/views/post/PostList.vue b/src/views/post/PostList.vue index 27df5a1c..9677ea8e 100644 --- a/src/views/post/PostList.vue +++ b/src/views/post/PostList.vue @@ -1,35 +1,35 @@