diff --git a/package.json b/package.json
index 57dfbe1bf..719d12c67 100644
--- a/package.json
+++ b/package.json
@@ -13,6 +13,8 @@
"ant-design-vue": "^1.3.16",
"axios": "^0.18.0",
"enquire.js": "^2.1.6",
+ "filepond": "^4.6.1",
+ "filepond-plugin-image-preview": "^4.4.0",
"halo-editor": "^2.7.6",
"marked": "^0.6.3",
"moment": "^2.24.0",
@@ -22,6 +24,7 @@
"vue-clipboard2": "^0.3.0",
"vue-codemirror-lite": "^1.0.4",
"vue-count-to": "^1.0.13",
+ "vue-filepond": "^5.1.3",
"vue-ls": "^3.2.1",
"vue-router": "^3.1.2",
"vue-video-player": "^5.0.2",
diff --git a/src/api/backup.js b/src/api/backup.js
index bd3e9c902..df891b400 100644
--- a/src/api/backup.js
+++ b/src/api/backup.js
@@ -6,7 +6,7 @@ const backupApi = {}
backupApi.importMarkdown = (formData, uploadProgress, cancelToken) => {
return service({
- url: `${baseUrl}/import/markdowns`,
+ url: `${baseUrl}/import/markdown`,
timeout: 8640000, // 24 hours
data: formData, // form data
onUploadProgress: uploadProgress,
diff --git a/src/api/post.js b/src/api/post.js
index 5709a6a02..88580d9db 100644
--- a/src/api/post.js
+++ b/src/api/post.js
@@ -66,6 +66,13 @@ postApi.delete = postId => {
})
}
+postApi.preview = postId => {
+ return service({
+ url: `${baseUrl}/preview/${postId}`,
+ method: 'get'
+ })
+}
+
postApi.postStatus = {
PUBLISHED: {
color: 'green',
diff --git a/src/api/sheet.js b/src/api/sheet.js
index 4f815e2e3..e106e71b4 100644
--- a/src/api/sheet.js
+++ b/src/api/sheet.js
@@ -61,6 +61,13 @@ sheetApi.delete = sheetId => {
})
}
+sheetApi.preview = sheetId => {
+ return service({
+ url: `${baseUrl}/preview/${sheetId}`,
+ method: 'get'
+ })
+}
+
sheetApi.sheetStatus = {
PUBLISHED: {
color: 'green',
diff --git a/src/components/Upload/FilePondUpload.vue b/src/components/Upload/FilePondUpload.vue
new file mode 100644
index 000000000..8072cae41
--- /dev/null
+++ b/src/components/Upload/FilePondUpload.vue
@@ -0,0 +1,132 @@
+
+
+
+
+
+
+
+
diff --git a/src/components/Upload/UpdateTheme.vue b/src/components/Upload/UpdateTheme.vue
deleted file mode 100644
index fe0b348ff..000000000
--- a/src/components/Upload/UpdateTheme.vue
+++ /dev/null
@@ -1,110 +0,0 @@
-
-
-
-
-
-
-
diff --git a/src/components/index.js b/src/components/index.js
index 8b6eb14ce..8cecd912e 100644
--- a/src/components/index.js
+++ b/src/components/index.js
@@ -4,13 +4,13 @@ import Vue from 'vue'
import Ellipsis from '@/components/Ellipsis'
import FooterToolbar from '@/components/FooterToolbar'
import Upload from '@/components/Upload/Upload'
-import UpdateTheme from '@/components/Upload/UpdateTheme'
+import FilePondUpload from '@/components/Upload/FilePondUpload'
const _components = {
Ellipsis,
FooterToolbar,
Upload,
- UpdateTheme
+ FilePondUpload
}
const components = {}
diff --git a/src/store/modules/option.js b/src/store/modules/option.js
index d27dba80b..1e84bc9e6 100644
--- a/src/store/modules/option.js
+++ b/src/store/modules/option.js
@@ -3,7 +3,12 @@ import {
OPTIONS
} from '@/store/mutation-types'
import optionApi from '@/api/option'
-const keys = ['blog_url']
+const keys = [
+ 'blog_url',
+ 'attachment_upload_image_preview_enable',
+ 'attachment_upload_max_parallel_uploads',
+ 'attachment_upload_max_files'
+]
const option = {
state: {
options: []
diff --git a/src/views/attachment/AttachmentList.vue b/src/views/attachment/AttachmentList.vue
index 4bdc4ecb3..efc763ecf 100644
--- a/src/views/attachment/AttachmentList.vue
+++ b/src/views/attachment/AttachmentList.vue
@@ -136,18 +136,12 @@
v-model="uploadVisible"
:footer="null"
:afterClose="onUploadClose"
+ destroyOnClose
>
-
-
-
-
- 点击选择文件或将文件拖拽到此处
- 支持单个或批量上传
-
+ >
-
+
-
-
-
-
- 点击选择文件或将文件拖拽到此处
- 支持单个或批量上传
-
+
@@ -128,7 +122,7 @@ export default {
},
attachments: [],
selectedAttachment: {},
- attachmentUploadHandler: attachmentApi.upload
+ uploadHandler: attachmentApi.upload
}
},
computed: {
@@ -183,6 +177,7 @@ export default {
this.loadAttachments()
},
onUploadClose() {
+ this.$refs.upload.handleClearFileList()
this.loadSkeleton()
this.loadAttachments()
},
diff --git a/src/views/attachment/components/AttachmentSelectDrawer.vue b/src/views/attachment/components/AttachmentSelectDrawer.vue
index d509bb3d7..1f2895d58 100644
--- a/src/views/attachment/components/AttachmentSelectDrawer.vue
+++ b/src/views/attachment/components/AttachmentSelectDrawer.vue
@@ -67,18 +67,12 @@
v-model="uploadVisible"
:footer="null"
:afterClose="onUploadClose"
+ destroyOnClose
>
-
-
-
-
- 点击选择文件或将文件拖拽到此处
- 支持单个或批量上传
-
+
@@ -126,7 +120,7 @@ export default {
sort: ''
},
attachments: [],
- attachmentUploadHandler: attachmentApi.upload
+ uploadHandler: attachmentApi.upload
}
},
created() {
@@ -174,6 +168,7 @@ export default {
this.loadAttachments()
},
onUploadClose() {
+ this.$refs.upload.handleClearFileList()
this.loadSkeleton()
this.loadAttachments()
},
diff --git a/src/views/comment/components/CommentTab.vue b/src/views/comment/components/CommentTab.vue
index d911ebc6d..1dd697b28 100644
--- a/src/views/comment/components/CommentTab.vue
+++ b/src/views/comment/components/CommentTab.vue
@@ -235,6 +235,7 @@
:title="'回复给:'+selectComment.author"
v-model="replyCommentVisible"
@close="onReplyClose"
+ destroyOnClose
>
@@ -201,20 +203,15 @@
tab="本地上传"
key="2"
>
-
-
-
-
- 点击选择主题包或将主题包拖拽到此处
- 支持单个或批量上传,仅支持 ZIP 格式的文件
-
+
@@ -223,21 +220,20 @@
title="更新主题"
v-model="uploadNewThemeVisible"
:footer="null"
+ destroyOnClose
+ :afterClose="onThemeUploadClose"
>
-
-
-
-
- 点击选择主题包或将主题包拖拽到此处
- 请选择最新的主题包,仅支持 ZIP 格式的文件
-
+
@@ -313,26 +309,6 @@ export default {
this.loadThemes()
})
},
- onThemeSettingsClose() {
- this.themeSettingVisible = false
- this.selectedTheme = {}
- },
- handleUploadChange(info) {
- const status = info.file.status
- if (status === 'done') {
- this.$message.success(`${info.file.name} 主题上传成功!`)
- } else if (status === 'error') {
- this.$message.error(`${info.file.name} 主题上传失败!`)
- }
- },
- handleNewThemeUploadChange(info) {
- const status = info.file.status
- if (status === 'done') {
- this.$message.success(`${info.file.name} 主题更新成功!`)
- } else if (status === 'error') {
- this.$message.error(`${info.file.name} 主题更新失败!`)
- }
- },
handleUploadSuccess() {
if (this.uploadThemeVisible) {
this.uploadThemeVisible = false
@@ -375,13 +351,25 @@ export default {
})
},
handleShowUpdateNewThemeModal(item) {
- console.log(item)
this.prepareUpdateTheme = item
this.uploadNewThemeVisible = true
},
handleShowThemeSetting(theme) {
this.selectedTheme = theme
this.themeSettingVisible = true
+ },
+ onThemeUploadClose() {
+ if (this.uploadThemeVisible) {
+ this.$refs.upload.handleClearFileList()
+ }
+ if (this.uploadNewThemeVisible) {
+ this.$refs.updateByupload.handleClearFileList()
+ }
+ this.loadThemes()
+ },
+ onThemeSettingsClose() {
+ this.themeSettingVisible = false
+ this.selectedTheme = {}
}
}
}
diff --git a/src/views/post/PostEdit.vue b/src/views/post/PostEdit.vue
index f8b21e977..4a3add21e 100644
--- a/src/views/post/PostEdit.vue
+++ b/src/views/post/PostEdit.vue
@@ -187,14 +187,18 @@ export default {
// Update the post
postApi.update(this.postToStage.id, this.postToStage, false).then(response => {
this.$log.debug('Updated post', response.data.data)
- window.open(`${this.options.blog_url}/api/admin/posts/preview/${this.postToStage.id}`, '_blank')
+ postApi.preview(this.postToStage.id).then(response => {
+ window.open(response.data, '_blank')
+ })
})
} else {
// Create the post
postApi.create(this.postToStage, false).then(response => {
this.$log.debug('Created post', response.data.data)
this.postToStage = response.data.data
- window.open(`${this.options.blog_url}/api/admin/posts/preview/${this.postToStage.id}`, '_blank')
+ postApi.preview(this.postToStage.id).then(response => {
+ window.open(response.data, '_blank')
+ })
})
}
},
diff --git a/src/views/post/PostList.vue b/src/views/post/PostList.vue
index 9ef811037..997f24551 100644
--- a/src/views/post/PostList.vue
+++ b/src/views/post/PostList.vue
@@ -143,10 +143,10 @@
twoToneColor="red"
/>
{{ text }}
{{ text }}
{{ text }}
{{ text }}
@@ -564,6 +564,11 @@ export default {
this.postSettingVisible = true
})
},
+ handlePreview(postId) {
+ postApi.preview(postId).then(response => {
+ window.open(response.data, '_blank')
+ })
+ },
// 关闭文章设置抽屉
onPostSettingsClose() {
this.postSettingVisible = false
diff --git a/src/views/sheet/SheetEdit.vue b/src/views/sheet/SheetEdit.vue
index c5c24e42e..3bad874dc 100644
--- a/src/views/sheet/SheetEdit.vue
+++ b/src/views/sheet/SheetEdit.vue
@@ -174,13 +174,17 @@ export default {
if (this.sheetToStage.id) {
sheetApi.update(this.sheetToStage.id, this.sheetToStage, false).then(response => {
this.$log.debug('Updated sheet', response.data.data)
- window.open(`${this.options.blog_url}/api/admin/sheets/preview/${this.sheetToStage.id}`, '_blank')
+ sheetApi.preview(this.sheetToStage.id).then(response => {
+ window.open(response.data, '_blank')
+ })
})
} else {
sheetApi.create(this.sheetToStage, false).then(response => {
this.$log.debug('Created sheet', response.data.data)
this.sheetToStage = response.data.data
- window.open(`${this.options.blog_url}/api/admin/sheets/preview/${this.sheetToStage.id}`, '_blank')
+ sheetApi.preview(this.sheetToStage.id).then(response => {
+ window.open(response.data, '_blank')
+ })
})
}
},
diff --git a/src/views/sheet/SheetList.vue b/src/views/sheet/SheetList.vue
index dc116a3ca..19a49ed1d 100644
--- a/src/views/sheet/SheetList.vue
+++ b/src/views/sheet/SheetList.vue
@@ -83,10 +83,10 @@
style="max-width: 150px;display: block;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;"
>
{{ text }}
{{ text }}
{{ text }}
@@ -390,6 +390,11 @@ export default {
this.sheetSettingVisible = true
})
},
+ handlePreview(sheetId) {
+ sheetApi.preview(sheetId).then(response => {
+ window.open(response.data, '_blank')
+ })
+ },
onSheetSettingsClose() {
this.sheetSettingVisible = false
this.selectedSheet = {}
diff --git a/src/views/system/OptionForm.vue b/src/views/system/OptionForm.vue
index 72a527977..79f7159c5 100644
--- a/src/views/system/OptionForm.vue
+++ b/src/views/system/OptionForm.vue
@@ -251,6 +251,30 @@
附件设置
+
+
+
+
+
+
+
+
+
-
-
-
-
- 拖拽或点击选择 Markdown 文件到此处
- 支持多个文件同时上传
-
+ >
@@ -69,6 +65,9 @@ export default {
} else if (status === 'error') {
this.$message.error(`${info.file.name} 导入失败!`)
}
+ },
+ onUploadClose() {
+ this.$refs.upload.handleClearFileList()
}
}
}