From 4bf752b23dc31572d7b930be46b86e105d0455f4 Mon Sep 17 00:00:00 2001 From: ruibaby Date: Thu, 25 Apr 2019 22:45:28 +0800 Subject: [PATCH] Change gallery to photo. --- src/api/gallery.js | 23 -- src/api/photo.js | 30 ++ src/config/router.config.js | 6 +- src/views/attachment/AttachmentList.vue | 2 +- .../components/AttachmentDetailDrawer.vue | 25 +- src/views/sheet/SheetList.vue | 4 +- src/views/sheet/internal/GalleryList.vue | 262 ------------- src/views/sheet/internal/PhotoList.vue | 365 ++++++++++++++++++ 8 files changed, 412 insertions(+), 305 deletions(-) delete mode 100644 src/api/gallery.js create mode 100644 src/api/photo.js delete mode 100644 src/views/sheet/internal/GalleryList.vue create mode 100644 src/views/sheet/internal/PhotoList.vue diff --git a/src/api/gallery.js b/src/api/gallery.js deleted file mode 100644 index 917cd1688..000000000 --- a/src/api/gallery.js +++ /dev/null @@ -1,23 +0,0 @@ -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/api/photo.js b/src/api/photo.js new file mode 100644 index 000000000..ac0a1bc03 --- /dev/null +++ b/src/api/photo.js @@ -0,0 +1,30 @@ +import service from '@/utils/service' + +const baseUrl = '/api/admin/photos' + +const photoApi = {} + +photoApi.query = params => { + return service({ + url: baseUrl, + params: params, + method: 'get' + }) +} + +photoApi.create = (photo) => { + return service({ + url: baseUrl, + data: photo, + method: 'post' + }) +} + +photoApi.delete = photoId => { + return service({ + url: `${baseUrl}/${photoId}`, + method: 'delete' + }) +} + +export default photoApi diff --git a/src/config/router.config.js b/src/config/router.config.js index f30d17b6f..cf454c659 100644 --- a/src/config/router.config.js +++ b/src/config/router.config.js @@ -80,10 +80,10 @@ export const asyncRouterMap = [ meta: { title: '友情链接', hiddenHeaderContent: false } }, { - path: '/sheets/galleries', - name: 'GalleryList', + path: '/sheets/photos', + name: 'PhotoList', hidden: true, - component: () => import('@/views/sheet/internal/GalleryList'), + component: () => import('@/views/sheet/internal/PhotoList'), meta: { title: '图库', hiddenHeaderContent: false } }, { diff --git a/src/views/attachment/AttachmentList.vue b/src/views/attachment/AttachmentList.vue index 2e041c0e9..38d28d2f2 100644 --- a/src/views/attachment/AttachmentList.vue +++ b/src/views/attachment/AttachmentList.vue @@ -142,7 +142,7 @@ v-model="drawerVisiable" v-if="selectAttachment" :attachment="selectAttachment" - :addToGallery="true" + :addToPhoto="true" @delete="handleDelete" /> diff --git a/src/views/attachment/components/AttachmentDetailDrawer.vue b/src/views/attachment/components/AttachmentDetailDrawer.vue index a7defceb8..37d98eae8 100644 --- a/src/views/attachment/components/AttachmentDetailDrawer.vue +++ b/src/views/attachment/components/AttachmentDetailDrawer.vue @@ -122,10 +122,10 @@
import { mixin, mixinDevice } from '@/utils/mixin.js' import attachmentApi from '@/api/attachment' -import galleryApi from '@/api/gallery' +import photoApi from '@/api/photo' export default { name: 'AttachmentDetailDrawer', @@ -156,7 +156,7 @@ export default { return { detailLoading: true, editable: false, - gallery: {} + photo: {} } }, model: { @@ -168,7 +168,7 @@ export default { type: Object, required: true }, - addToGallery: { + addToPhoto: { type: Boolean, required: false, default: false @@ -239,15 +239,12 @@ 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'] = new Date().getTime() - this.gallery['location'] = '' - this.gallery['team'] = '' - galleryApi.create(this.gallery).then(response => { + handleAddToPhoto() { + this.photo['name'] = this.attachment.name + this.photo['thumbnail'] = this.attachment.thumbPath + this.photo['url'] = this.attachment.path + this.photo['takeTime'] = new Date().getTime() + photoApi.create(this.photo).then(response => { this.$message.success('添加成功!') }) }, diff --git a/src/views/sheet/SheetList.vue b/src/views/sheet/SheetList.vue index e62aaf4f5..fefe3aa56 100644 --- a/src/views/sheet/SheetList.vue +++ b/src/views/sheet/SheetList.vue @@ -53,7 +53,7 @@ 编辑 编辑 @@ -211,7 +211,7 @@ const internalPages = [ { id: '2', name: '图库页面', - url: '/galleries' + url: '/photos' }, { id: '3', diff --git a/src/views/sheet/internal/GalleryList.vue b/src/views/sheet/internal/GalleryList.vue deleted file mode 100644 index 4bf55dbbe..000000000 --- a/src/views/sheet/internal/GalleryList.vue +++ /dev/null @@ -1,262 +0,0 @@ - - - - - diff --git a/src/views/sheet/internal/PhotoList.vue b/src/views/sheet/internal/PhotoList.vue new file mode 100644 index 000000000..f682bdf62 --- /dev/null +++ b/src/views/sheet/internal/PhotoList.vue @@ -0,0 +1,365 @@ + + + + +