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 @@
+
+
+
+
+
+
+ K
+
+
+
+ V
+
+
+
+
+
+
+
+
+
+ K
+
+
+
+ V
+
+
+
+
+
+
+
+
+ 新增
+
+
+
+
+
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 @@
-
+
-
+
-
- {{
- postStatus[status].text
- }}
+
+
+ {{ postStatus[status].text }}
+
- {{ category.name }}({{ category.postCount }})
+
+ {{ category.name }}({{ category.postCount }})
+
@@ -48,36 +48,26 @@
- 写文章
+ 写文章
-
+
-
+
发布
-
+
移到回收站
-
+
草稿
-
+
永久删除
@@ -93,13 +83,13 @@
-
+
@@ -109,34 +99,30 @@
{{ item.commentCount }}
-
+
-
+
编辑
还原
-
+
回收站
@@ -144,17 +130,17 @@
删除
- 设置
+
+ 设置
+
@@ -173,29 +159,29 @@
style="max-width: 300px;display: block;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;"
>
- {{ item.title }}
+ {{ item.title }}
- {{ item.title }}
+ {{ item.title }}
-
+
{{ item.title }}
@@ -207,61 +193,61 @@
v-for="(category, categoryIndex) in item.categories"
:key="'category_' + categoryIndex"
color="blue"
- @click="handleSelectCategory(category)"
style="margin-bottom: 8px"
- >{{ category.name }}
+ @click="handleSelectCategory(category)"
+ >{{ category.name }}
+
{{ tag.name }}
+ >{{ tag.name }}
+
- {{ text }}
+ {{ text }}
- {{ text }}
+ {{ text }}
-
+
{{ text }}
@@ -274,8 +260,8 @@
v-for="(category, index) in categoriesOfPost"
:key="index"
color="blue"
- @click="handleSelectCategory(category)"
style="margin-bottom: 8px;cursor:pointer"
+ @click="handleSelectCategory(category)"
>{{ category.name }}
@@ -289,14 +275,14 @@
@@ -304,8 +290,8 @@
@@ -320,17 +306,17 @@
编辑
还原
@@ -338,21 +324,21 @@
回收站
删除
@@ -364,42 +350,43 @@
-
+ :savedCallback="onPostSavedCallback"
+ :visible.sync="postSettingVisible"
+ @onClose="selectedPost = {}"
+ >
+
+
+ 上一篇
+
+
+ 下一篇
+
+
+
@@ -408,7 +395,7 @@
diff --git a/src/views/post/components/PostSettingModal.vue b/src/views/post/components/PostSettingModal.vue
new file mode 100644
index 00000000..35637433
--- /dev/null
+++ b/src/views/post/components/PostSettingModal.vue
@@ -0,0 +1,394 @@
+
+
+
+ {{ modalTitle }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 无
+
+ {{ template }}
+
+
+
+
+
+
+
+
+
+
+
+ 移除
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 关闭
+
+
+
+
+
+
+
+
diff --git a/src/views/post/components/TagSelect.vue b/src/views/post/components/TagSelect.vue
index ea44d62b..818dd5a8 100644
--- a/src/views/post/components/TagSelect.vue
+++ b/src/views/post/components/TagSelect.vue
@@ -1,16 +1,15 @@
-
+
+ {{ tag.name }}
+