-
-
- 确 定
-
+
- {{ articleLink }}
-
+ {{ articleLink }}
+
-
-
+ placeholder="缩略名"
+ can-edit
+ >
+
-
+
保存草稿
- {{ editStatus?'更新文章':'发布文章' }}
+ 发布文章
-
文章封面:
-
-
+
发布日期:
+
+
分类:
-
该标签已存在
+ 新增标签
+
+ 其他:
+
+ 更多设置
@@ -94,12 +91,12 @@
更多设置
文章封面:
-
-
+
+
+
+
+
+
@@ -115,10 +112,10 @@
import "vditor/src/assets/scss/index.scss"
import categoryApi from "@/api/category";
import tagApi from "@/api/tag";
+ import EditElement from "@/views/markdown/EditElement";
let toolbar = [
'emoji',
- 'headings',
'bold',
'italic',
'strike',
@@ -130,10 +127,7 @@
'outdent',
'indent',
'|',
- 'quote',
'line',
- 'code',
- 'inline-code',
'insert-before',
'insert-after',
'|',
@@ -145,14 +139,13 @@
'redo',
'|',
'edit-mode',
- 'content-theme',
'code-theme',
'outline',
'preview',
+ 'fullscreen',
{
name: 'more',
toolbar: [
- 'fullscreen',
'export',
'both',
'info',
@@ -163,6 +156,7 @@
export default {
name: 'MarkdownEditor',
components: {
+ EditElement,
DirTree, Vditor
},
props: {
@@ -173,13 +167,13 @@
},
data() {
return {
+ activeNames: ['1'],
file: {},
editStatus: false,
html:'', // 及时转的html
filename: '',
- clientHeight: document.documentElement.clientHeight - 210,
+ clientHeight: document.documentElement.clientHeight,
updating: false,
- isFullScreen: false,
storageLocation: '/',
selectLocationVisible: false,
moreSetting: false,
@@ -197,17 +191,14 @@
vditorLoading: true,
treeProps: {
label: 'name',
- }
+ },
+ releaseTime: undefined
}
},
mounted() {
this.getMarkdown()
this.categoryTree()
this.getTags()
- const that = this
- window.onresize = function temp() {
- that.reHeight()
- }
},
watch: {
file(){
@@ -222,15 +213,6 @@
}
},
computed: {
- text () {
- return function (value) {
- if (value === '' || value === 0) {
- return '100%'
- } else {
- return String(value).length * 14 - 30 + 'px'
- }
- }
- }
},
methods: {
reload() {
@@ -288,6 +270,9 @@
}
}
},
+ moreSet() {
+ this.moreSetting = true
+ },
categoryTree() {
categoryApi.categoryTree().then(res => {
this.categories = res.data
@@ -314,22 +299,30 @@
});
},
handleInputConfirm() {
- let inputValue = this.inputValue
- if (inputValue) {
- if (this.dynamicTags.includes(inputValue)){
- this.inputValueExist = true
- return
+ const that = this
+ setTimeout(function (){
+ let inputValue = that.inputValue
+ if (inputValue) {
+ if (that.dynamicTags.includes(inputValue)){
+ that.inputValueExist = true
+ return
+ }
+ that.dynamicTags.push(inputValue)
}
- this.dynamicTags.push(inputValue)
- }
- this.inputValueExist = false
- this.inputVisible = false
- this.inputValue = ''
+ that.inputValueExist = false
+ that.inputVisible = false
+ that.inputValue = ''
+ },100)
},
vditorInit(content){
this.contentEditor = new Vditor('vditor', {
height: this.clientHeight,
- toolbar,
+ resize: {
+ "enable": true
+ },
+ toolbar: [
+ ...toolbar
+ ],
toolbarConfig: {
pin: true,
},
@@ -337,13 +330,14 @@
mode: 'both',
hljs: {
lineNumber: true
- }
+ },
},
cache: {
enable: false,
},
after: () => {
this.contentEditor.setValue(content)
+ this.vditorLoading = false
},
input: (val) => {
this.valueHasChanged()
@@ -386,17 +380,6 @@
}
}
},
- fullScreen(status) {
- this.isFullScreen = status
- this.reHeight()
- },
- reHeight(){
- if(this.isFullScreen){
- this.clientHeight = document.documentElement.clientHeight
- }else{
- this.clientHeight = document.documentElement.clientHeight - 210
- }
- },
save(){
if(this.editStatus){
this.update()
@@ -444,11 +427,13 @@
filename: filename,
cover: this.file.cover,
isDraft: this.draft,
+ isRelease: this.file.release,
slug: this.file.slug ? this.file.slug : this.filename,
categoryIds: this.file.categoryIds,
tagNames: this.dynamicTags,
currentDirectory: this.storageLocation,
- contentText: this.contentEditor.getValue()
+ contentText: this.contentEditor.getValue(),
+ uploadDate: this.file.uploadDate,
}).then(() => {
this.$emit('update:hasChange', false)
this.updating = false
@@ -476,7 +461,7 @@
diff --git a/src/views/setting/articles/articleManager.vue b/src/views/setting/articles/articleManager.vue
index 905f3f6..bb48a39 100644
--- a/src/views/setting/articles/articleManager.vue
+++ b/src/views/setting/articles/articleManager.vue
@@ -18,6 +18,9 @@
文章管理
新建文章
+
@@ -55,6 +58,7 @@
0) {
+ this.multipleSelection.forEach(value => {
+ fileIds.push(value.id)
+ })
+ }
+ this.$confirm('此操作将永久删除选中的文章, 是否继续?', '提示', {
+ confirmButtonText: '确定',
+ cancelButtonText: '取消',
+ type: 'warning'
+ }).then(() => {
+ api.delete({
+ username: this.$store.state.user.name,
+ fileIds: fileIds
+ }).then(() => {
+ // 移除列表
+ this.getArticleList()
+ }).then(() => {
+ this.$notify({
+ title: '删除成功',
+ type: 'success',
+ duration: 1000
+ })
+ })
+ })
+ },
beforeunloadFn(){
return '确定要退出吗?'
},
@@ -343,4 +379,7 @@ export default {
/deep/.el-card__body {
min-width: 1080px;
}
+/deep/ .el-dialog__body {
+ padding: 0 20px;
+}