From ae5ffd9d3aafed48cf4f90849e159dc1c043ce60 Mon Sep 17 00:00:00 2001 From: ruibaby Date: Thu, 25 Apr 2019 01:40:50 +0800 Subject: [PATCH] Create Gallery page. --- src/api/gallery.js | 23 ++ src/views/attachment/AttachmentList.vue | 1 + .../components/AttachmentDetailDrawer.vue | 33 ++- src/views/sheet/SheetList.vue | 10 +- src/views/sheet/internal/GalleryList.vue | 258 +++++++++++++++++- 5 files changed, 316 insertions(+), 9 deletions(-) create mode 100644 src/api/gallery.js diff --git a/src/api/gallery.js b/src/api/gallery.js new file mode 100644 index 00000000..917cd168 --- /dev/null +++ b/src/api/gallery.js @@ -0,0 +1,23 @@ +import service from '@/utils/service' + +const baseUrl = '/api/admin/galleries' + +const galleryApi = {} + +galleryApi.query = params => { + return service({ + url: baseUrl, + params: params, + method: 'get' + }) +} + +galleryApi.create = (gallery) => { + return service({ + url: baseUrl, + data: gallery, + method: 'post' + }) +} + +export default galleryApi diff --git a/src/views/attachment/AttachmentList.vue b/src/views/attachment/AttachmentList.vue index 0d6d5bcd..2e041c0e 100644 --- a/src/views/attachment/AttachmentList.vue +++ b/src/views/attachment/AttachmentList.vue @@ -142,6 +142,7 @@ v-model="drawerVisiable" v-if="selectAttachment" :attachment="selectAttachment" + :addToGallery="true" @delete="handleDelete" /> diff --git a/src/views/attachment/components/AttachmentDetailDrawer.vue b/src/views/attachment/components/AttachmentDetailDrawer.vue index 4f7d5312..2b169bd7 100644 --- a/src/views/attachment/components/AttachmentDetailDrawer.vue +++ b/src/views/attachment/components/AttachmentDetailDrawer.vue @@ -120,6 +120,18 @@
+ + 添加到图库 + import { mixin, mixinDevice } from '@/utils/mixin.js' import attachmentApi from '@/api/attachment' +import galleryApi from '@/api/gallery' export default { name: 'AttachmentDetailDrawer', @@ -142,7 +155,8 @@ export default { data() { return { detailLoading: true, - editable: false + editable: false, + gallery: {} } }, model: { @@ -154,6 +168,11 @@ export default { type: Object, required: true }, + addToGallery: { + type: Boolean, + required: false, + default: false + }, visiable: { type: Boolean, required: false, @@ -220,6 +239,18 @@ export default { this.$message.error('复制失败') }) }, + handleAddToGallery() { + this.gallery['name'] = this.attachment.name + this.gallery['thumbnail'] = this.attachment.thumbPath + this.gallery['url'] = this.attachment.path + this.gallery['description'] = '' + this.gallery['takeTime'] = '' + this.gallery['location'] = '' + this.gallery['team'] = '' + galleryApi.create(this.gallery).then(response => { + this.$message.success('添加成功!') + }) + }, onClose() { this.$emit('close', false) } diff --git a/src/views/sheet/SheetList.vue b/src/views/sheet/SheetList.vue index f86a8598..e62aaf4f 100644 --- a/src/views/sheet/SheetList.vue +++ b/src/views/sheet/SheetList.vue @@ -46,11 +46,6 @@ slot="action" slot-scope="text, record" > - 查看 - 编辑 + + 查看 diff --git a/src/views/sheet/internal/GalleryList.vue b/src/views/sheet/internal/GalleryList.vue index 13408aed..4bf55dbb 100644 --- a/src/views/sheet/internal/GalleryList.vue +++ b/src/views/sheet/internal/GalleryList.vue @@ -1,10 +1,262 @@ -