From f0192844f2adb5a2d37de8dcee42f31c93d85951 Mon Sep 17 00:00:00 2001 From: guqing <1484563614@qq.com> Date: Mon, 15 Jul 2019 21:22:47 +0800 Subject: [PATCH 01/12] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=96=87=E7=AB=A0?= =?UTF-8?q?=E7=BC=96=E8=BE=91toolbar=E5=9B=BE=E7=89=87=E4=B8=8A=E4=BC=A0?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/const.js | 3 ++- src/views/post/PostEdit.vue | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/src/core/const.js b/src/core/const.js index c6e3e42d..67a458ba 100644 --- a/src/core/const.js +++ b/src/core/const.js @@ -18,7 +18,8 @@ const toolbars = { trash: true, // 清空 navigation: true, // 导航目录 subfield: true, // 单双栏模式 - preview: true // 预览 + preview: true, // 预览 + imagelink: true // 图片链接 } export { toolbars } diff --git a/src/views/post/PostEdit.vue b/src/views/post/PostEdit.vue index baed7cf0..99adad7a 100644 --- a/src/views/post/PostEdit.vue +++ b/src/views/post/PostEdit.vue @@ -13,11 +13,13 @@
@@ -202,6 +204,7 @@ import 'mavon-editor/dist/css/index.css' import categoryApi from '@/api/category' import postApi from '@/api/post' import optionApi from '@/api/option' +import attachmentApi from '@/api/attachment' export default { components: { TagSelect, @@ -347,6 +350,21 @@ export default { this.autoSavePost() }, 15000) } + }, + pictureUploadHandle(pos, $file) { + var formdata = new FormData() + formdata.append('file', $file) + attachmentApi.upload(formdata).then((response) => { + var responseObject = response.data + + if (responseObject.status === 200) { + var MavonEditor = this.$refs.md + MavonEditor.$img2Url(pos, responseObject.data.path) + this.$message.success('图片上传成功') + } else { + this.$message.error('图片上传失败:' + responseObject.message) + } + }) } } } From 2f794716730e43cd026d787c97227a914ffcfd65 Mon Sep 17 00:00:00 2001 From: ruibaby Date: Mon, 15 Jul 2019 23:42:24 +0800 Subject: [PATCH 02/12] Change post list updateTime to createTime. --- src/views/post/PostList.vue | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/views/post/PostList.vue b/src/views/post/PostList.vue index c9fdfc87..5f9f5eec 100644 --- a/src/views/post/PostList.vue +++ b/src/views/post/PostList.vue @@ -180,9 +180,9 @@ {{ updateTime | timeAgo }} + slot="createTime" + slot-scope="createTime" + >{{ createTime | timeAgo }} Date: Mon, 15 Jul 2019 23:49:53 +0800 Subject: [PATCH 03/12] Support upload image in editor. --- src/views/sheet/SheetEdit.vue | 18 ++++++++++++++++++ src/views/sheet/SheetList.vue | 12 ++++++------ 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/src/views/sheet/SheetEdit.vue b/src/views/sheet/SheetEdit.vue index f68faf0d..c3b15246 100644 --- a/src/views/sheet/SheetEdit.vue +++ b/src/views/sheet/SheetEdit.vue @@ -12,11 +12,13 @@
@@ -136,6 +138,7 @@ import 'mavon-editor/dist/css/index.css' import sheetApi from '@/api/sheet' import themeApi from '@/api/theme' import optionApi from '@/api/option' +import attachmentApi from '@/api/attachment' export default { components: { mavonEditor, @@ -256,6 +259,21 @@ export default { this.autoSaveSheet() }, 15000) } + }, + pictureUploadHandle(pos, $file) { + var formdata = new FormData() + formdata.append('file', $file) + attachmentApi.upload(formdata).then((response) => { + var responseObject = response.data + + if (responseObject.status === 200) { + var MavonEditor = this.$refs.md + MavonEditor.$img2Url(pos, responseObject.data.path) + this.$message.success('图片上传成功') + } else { + this.$message.error('图片上传失败:' + responseObject.message) + } + }) } } } diff --git a/src/views/sheet/SheetList.vue b/src/views/sheet/SheetList.vue index 4c33157b..dbbfde75 100644 --- a/src/views/sheet/SheetList.vue +++ b/src/views/sheet/SheetList.vue @@ -116,9 +116,9 @@ {{ statusProperty.text }}
{{ updateTime | timeAgo }} + slot="createTime" + slot-scope="createTime" + >{{ createTime | timeAgo }} Date: Tue, 16 Jul 2019 21:43:20 +0800 Subject: [PATCH 04/12] Encode attachment url. --- src/views/post/PostEdit.vue | 4 ++-- src/views/post/PostList.vue | 2 +- src/views/sheet/SheetEdit.vue | 4 ++-- src/views/sheet/internal/PhotoList.vue | 2 +- src/views/system/OptionForm.vue | 4 ++-- src/views/user/Profile.vue | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/views/post/PostEdit.vue b/src/views/post/PostEdit.vue index 99adad7a..74a02934 100644 --- a/src/views/post/PostEdit.vue +++ b/src/views/post/PostEdit.vue @@ -341,7 +341,7 @@ export default { }) }, handleSelectPostThumb(data) { - this.postToStage.thumbnail = data.path + this.postToStage.thumbnail = encodeURI(data.path) this.thumDrawerVisible = false }, autoSaveTimer() { @@ -359,7 +359,7 @@ export default { if (responseObject.status === 200) { var MavonEditor = this.$refs.md - MavonEditor.$img2Url(pos, responseObject.data.path) + MavonEditor.$img2Url(pos, encodeURI(responseObject.data.path)) this.$message.success('图片上传成功') } else { this.$message.error('图片上传失败:' + responseObject.message) diff --git a/src/views/post/PostList.vue b/src/views/post/PostList.vue index 5f9f5eec..326b631e 100644 --- a/src/views/post/PostList.vue +++ b/src/views/post/PostList.vue @@ -620,7 +620,7 @@ export default { }) }, handleSelectPostThumb(data) { - this.selectedPost.thumbnail = data.path + this.selectedPost.thumbnail = encodeURI(data.path) this.thumDrawerVisible = false }, handlerRemoveThumb() { diff --git a/src/views/sheet/SheetEdit.vue b/src/views/sheet/SheetEdit.vue index c3b15246..399dcedd 100644 --- a/src/views/sheet/SheetEdit.vue +++ b/src/views/sheet/SheetEdit.vue @@ -250,7 +250,7 @@ export default { } }, handleSelectSheetThumb(data) { - this.sheetToStage.thumbnail = data.path + this.sheetToStage.thumbnail = encodeURI(data.path) this.thumDrawerVisible = false }, autoSaveTimer() { @@ -268,7 +268,7 @@ export default { if (responseObject.status === 200) { var MavonEditor = this.$refs.md - MavonEditor.$img2Url(pos, responseObject.data.path) + MavonEditor.$img2Url(pos, encodeURI(responseObject.data.path)) this.$message.success('图片上传成功') } else { this.$message.error('图片上传失败:' + responseObject.message) diff --git a/src/views/sheet/internal/PhotoList.vue b/src/views/sheet/internal/PhotoList.vue index 727d0676..e747f049 100644 --- a/src/views/sheet/internal/PhotoList.vue +++ b/src/views/sheet/internal/PhotoList.vue @@ -364,7 +364,7 @@ export default { this.thumDrawerVisible = true }, selectPhotoThumb(data) { - this.photo.url = data.path + this.photo.url = encodeURI(data.path) this.thumDrawerVisible = false }, resetParam() { diff --git a/src/views/system/OptionForm.vue b/src/views/system/OptionForm.vue index 1cd9e6f1..540499d8 100644 --- a/src/views/system/OptionForm.vue +++ b/src/views/system/OptionForm.vue @@ -649,7 +649,7 @@ export default { } }, handleSelectLogo(data) { - this.options.blog_logo = data.path + this.options.blog_logo = encodeURI(data.path) this.logoDrawerVisible = false }, handleTestMailClick() { @@ -658,7 +658,7 @@ export default { }) }, handleSelectFavicon(data) { - this.options.blog_favicon = data.path + this.options.blog_favicon = encodeURI(data.path) this.faviconDrawerVisible = false } } diff --git a/src/views/user/Profile.vue b/src/views/user/Profile.vue index 7a302378..67f9a676 100644 --- a/src/views/user/Profile.vue +++ b/src/views/user/Profile.vue @@ -218,7 +218,7 @@ export default { }) }, handleSelectAvatar(data) { - this.user.avatar = data.path + this.user.avatar = encodeURI(data.path) this.attachmentDrawerVisible = false }, handleSelectGravatar() { From a1a7c0db61396b4238ff9386ac4e2edf987f5031 Mon Sep 17 00:00:00 2001 From: guqing <1484563614@qq.com> Date: Wed, 17 Jul 2019 15:05:51 +0800 Subject: [PATCH 05/12] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E8=87=AA=E5=AE=9A?= =?UTF-8?q?=E4=B9=89=E6=96=87=E7=AB=A0=E5=8F=91=E5=B8=83=E6=97=B6=E9=97=B4?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/post/PostEdit.vue | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/views/post/PostEdit.vue b/src/views/post/PostEdit.vue index 74a02934..446ea898 100644 --- a/src/views/post/PostEdit.vue +++ b/src/views/post/PostEdit.vue @@ -44,6 +44,20 @@ > + + + + + { @@ -365,6 +385,13 @@ export default { this.$message.error('图片上传失败:' + responseObject.message) } }) + }, + onChange(value, dateString) { + this.postToStage.createTime = value.valueOf() + }, + onOk(value) { + var dateString = value.format('YYYY-MM-DD HH:mm:ss') + this.postToStage.createTime = value.valueOf() } } } From 0b714a948f8a046a017cbd68bf025432e0f47308 Mon Sep 17 00:00:00 2001 From: guqing <1484563614@qq.com> Date: Wed, 17 Jul 2019 15:12:07 +0800 Subject: [PATCH 06/12] =?UTF-8?q?=E4=BF=AE=E5=A4=8Deslint=E9=94=99?= =?UTF-8?q?=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/post/PostEdit.vue | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/views/post/PostEdit.vue b/src/views/post/PostEdit.vue index 446ea898..0793e8e6 100644 --- a/src/views/post/PostEdit.vue +++ b/src/views/post/PostEdit.vue @@ -57,7 +57,6 @@ @ok="onOk" /> - Date: Wed, 17 Jul 2019 15:38:34 +0800 Subject: [PATCH 07/12] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E8=87=AA=E5=AE=9A=E4=B9=89=E5=8F=91=E8=A1=A8=E6=97=B6=E9=97=B4?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/post/PostEdit.vue | 4 ++++ src/views/sheet/SheetEdit.vue | 28 ++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/src/views/post/PostEdit.vue b/src/views/post/PostEdit.vue index 0793e8e6..698b4703 100644 --- a/src/views/post/PostEdit.vue +++ b/src/views/post/PostEdit.vue @@ -288,6 +288,10 @@ export default { }, computed: { pickerDefaultValue() { + if (this.postToStage.createTime) { + var date = new Date(this.postToStage.createTime) + return moment(date, 'YYYY-MM-DD HH:mm:ss') + } return moment(new Date(), 'YYYY-MM-DD HH:mm:ss') } }, diff --git a/src/views/sheet/SheetEdit.vue b/src/views/sheet/SheetEdit.vue index 399dcedd..0d1e4c92 100644 --- a/src/views/sheet/SheetEdit.vue +++ b/src/views/sheet/SheetEdit.vue @@ -57,6 +57,18 @@ 关闭 + + + { @@ -274,6 +296,12 @@ export default { this.$message.error('图片上传失败:' + responseObject.message) } }) + }, + onChange(value, dateString) { + this.sheetToStage.createTime = value.valueOf() + }, + onOk(value) { + this.sheetToStage.createTime = value.valueOf() } } } From 1268cafde77357b37c47dfe03aaf9096252c5c71 Mon Sep 17 00:00:00 2001 From: ruibaby Date: Wed, 17 Jul 2019 23:03:02 +0800 Subject: [PATCH 08/12] Perfect post edit datetime picker style. --- src/components/global.less | 4 ++++ src/views/sheet/SheetEdit.vue | 24 +++++++++++------------- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/src/components/global.less b/src/components/global.less index 929a6ab8..badaccb9 100644 --- a/src/components/global.less +++ b/src/components/global.less @@ -708,4 +708,8 @@ body { .post-thum-remove { margin-top: 16px; } +} + +.ant-calendar-picker{ + width: 100%!important; } \ No newline at end of file diff --git a/src/views/sheet/SheetEdit.vue b/src/views/sheet/SheetEdit.vue index 0d1e4c92..9d1bc39d 100644 --- a/src/views/sheet/SheetEdit.vue +++ b/src/views/sheet/SheetEdit.vue @@ -48,18 +48,7 @@ > - - - 开启 - 关闭 - - - + + + + 开启 + 关闭 + + { + attachmentApi.upload(formdata).then(response => { var responseObject = response.data if (responseObject.status === 200) { From cbe48c5481861d3d9520f44a723c52a09fca5d74 Mon Sep 17 00:00:00 2001 From: ruibaby Date: Fri, 19 Jul 2019 22:26:26 +0800 Subject: [PATCH 09/12] Completed #33 --- .../components/AttachmentDetailDrawer.vue | 1 + src/views/post/CategoryList.vue | 46 +++++++++++++++---- src/views/sheet/SheetList.vue | 42 +++++++++++++++-- 3 files changed, 76 insertions(+), 13 deletions(-) diff --git a/src/views/attachment/components/AttachmentDetailDrawer.vue b/src/views/attachment/components/AttachmentDetailDrawer.vue index 4495ce7b..6d8f3cbc 100644 --- a/src/views/attachment/components/AttachmentDetailDrawer.vue +++ b/src/views/attachment/components/AttachmentDetailDrawer.vue @@ -290,6 +290,7 @@ export default { this.photo['takeTime'] = new Date().getTime() photoApi.create(this.photo).then(response => { this.$message.success('添加成功!') + this.photo = {} }) }, onClose() { diff --git a/src/views/post/CategoryList.vue b/src/views/post/CategoryList.vue index 706daddc..b123b952 100644 --- a/src/views/post/CategoryList.vue +++ b/src/views/post/CategoryList.vue @@ -92,14 +92,34 @@ @click="handleEditCategory(record)" >编辑 - - 删除 - + + 更多 + + + + 添加到菜单 + + + + + 删除 + + + + @@ -111,6 +131,7 @@