diff --git a/src/views/markdown/index.vue b/src/views/markdown/index.vue
index d0414c0..7e3e120 100644
--- a/src/views/markdown/index.vue
+++ b/src/views/markdown/index.vue
@@ -24,8 +24,8 @@
- 保存草稿
- {{ editStatus?'发布文章':'更新文章' }}
+ 保存草稿
+ {{ editStatus?'发布文章':'更新文章' }}
@@ -155,6 +156,8 @@
moreSetting: false,
contentEditor: '',
categories: [],
+ categoryIds: [],
+ draft: false,
articleLink: `${window.origin}/artiles/`
}
},
@@ -218,6 +221,24 @@
categoryTree() {
categoryApi.categoryTree({userId: this.$store.state.user.userId}).then(res => {
this.categories = res.data
+
+ let ss = ["5fbf6857aff038ad2c1d686d", "5fbf685eaff038ad2c1d686e", "5fbf6863aff038ad2c1d686f", "5fbf689baff038ad2c1d6874"]
+ this.findCategoryIds(this.categories, ss)
+ console.log(this.categoryIds)
+ })
+ },
+ findCategoryIds(categories, ss) {
+ categories.forEach(category => {
+ let ids = []
+ if(category.ids){
+ ids = category.ids
+ }
+ ids.push(category.id)
+ category['ids'] = ids
+ if(ss.includes(category.id)){
+ this.categoryIds.push(ids)
+ }
+ this.findCategoryIds(categories.children)
})
},
vditorInit(content){
@@ -312,8 +333,28 @@
}
return true
},
+ saveDraft() {
+ this.draft = true
+ this.update('保存草稿成功')
+ },
+ release() {
+ this.draft = false
+ this.update()
+ },
+ selectCategory(val){
+ console.log(val)
+ let categoryIds = []
+ this.categoryIds.forEach(categoryIdList => {
+ categoryIds.push(categoryIdList[categoryIdList.length - 1])
+ })
+ console.log(categoryIds)
+ },
// update
- update(){
+ update(message){
+ let categoryIds = []
+ this.categoryIds.forEach(categoryIdList => {
+ categoryIds.push(categoryIdList[categoryIdList.length - 1])
+ })
if(!this.checkParam()){
return
}
@@ -326,15 +367,16 @@
username: this.$store.state.user.name,
filename: filename,
cover: this.file.cover,
- slug: this.file.slug,
- categoryIds: this.file.categoryIds,
+ isDraft: this.draft,
+ slug: this.file.slug ? this.file.slug : this.filename,
+ categoryIds: categoryIds,
currentDirectory: this.storageLocation,
contentText: this.contentEditor.getValue()
}).then(() => {
this.$emit('update:hasChange', false)
this.updating = false
this.$message({
- message: "发布成功",
+ message: message ? message : "发布成功",
type: 'success',
duration : 1000
});
diff --git a/src/views/setting/articles/articleManager.vue b/src/views/setting/articles/articleManager.vue
index 519c209..7293896 100644
--- a/src/views/setting/articles/articleManager.vue
+++ b/src/views/setting/articles/articleManager.vue
@@ -23,27 +23,30 @@
-
- 可用
+
+ 可用
+ 已发布
草稿
作者:
-
- 所有
- 我的
+
+ 所有
+ 我的
- 筛选
+ 筛选
- {{ scope.row.release?'已发布':'未发布' }}
+ 草稿
+ 已发布
+ 未发布
{
+ markdownApi.getMarkdown({
+ pageIndex: this.pagination.pageIndex,
+ pageSize: this.pagination.pageSize,
+ userId: this.query.radioUser === 'my' ? this.$store.state.user.userId : null,
+ isRelease: this.query.radioStatus === 'release',
+ isDraft: this.query.radioStatus === 'draft',
+ keyword: this.query.keyword
+ }).then((res) => {
this.articleList = res.data
this.pagination.total = res.count
this.$nextTick(() => {
@@ -242,6 +254,7 @@ export default {
window.onbeforeunload = null
this.pageTitle = '文章管理'
this.hasChange = false
+ this.getArticleList()
}
}
}
diff --git a/src/views/setting/articles/categoryManager.vue b/src/views/setting/articles/categoryManager.vue
index ea0eb77..1c8f22e 100644
--- a/src/views/setting/articles/categoryManager.vue
+++ b/src/views/setting/articles/categoryManager.vue
@@ -63,7 +63,7 @@
- {{ scope.row.children.length }}个分类
新增
@@ -243,7 +243,7 @@ export default {
this.multipleSelection.forEach(category => {
categoryIds.push(category.id)
})
- this.$confirm('所选分类下的所有内容都将被删除, 您确认要删除吗?', '提示', {
+ this.$confirm('所选分类下的所有内容(包括文章)都将被删除,\r\n 您确认要删除吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'