Commit 7d501f37c9667bc797f6198bafddd96689b08a7b
1 parent
2e6cd487
image-gallery: update previewURL to url
Showing
4 changed files
with
26 additions
and
10 deletions
front-end/h5/src/components/core/support/image-gallery/components/image-item.js
| @@ -29,7 +29,7 @@ export default { | @@ -29,7 +29,7 @@ export default { | ||
| 29 | <div | 29 | <div |
| 30 | slot="cover" | 30 | slot="cover" |
| 31 | style={{ | 31 | style={{ |
| 32 | - backgroundImage: `url(${this.item.previewURL})`, | 32 | + backgroundImage: `url(${this.item.url})`, |
| 33 | backgroundSize: 'cover', | 33 | backgroundSize: 'cover', |
| 34 | height: `${this.height}px` | 34 | height: `${this.height}px` |
| 35 | }}> | 35 | }}> |
front-end/h5/src/components/core/support/image-gallery/gallery.js
| @@ -50,7 +50,7 @@ export default { | @@ -50,7 +50,7 @@ export default { | ||
| 50 | }, | 50 | }, |
| 51 | handleSelectImage (item) { | 51 | handleSelectImage (item) { |
| 52 | this.handleClose() | 52 | this.handleClose() |
| 53 | - this.$emit('change', item.previewURL) | 53 | + this.$emit('change', item.url) |
| 54 | }, | 54 | }, |
| 55 | renderContent () { | 55 | renderContent () { |
| 56 | switch (this.activeTab) { | 56 | switch (this.activeTab) { |
| @@ -79,12 +79,12 @@ export default { | @@ -79,12 +79,12 @@ export default { | ||
| 79 | <div class="default-activator cursor-pointer "><img src={this.value} width="50%" style={{ margin: 'auto' }} /></div> | 79 | <div class="default-activator cursor-pointer "><img src={this.value} width="50%" style={{ margin: 'auto' }} /></div> |
| 80 | <div class="flex-space-between" style="margin-top: 8px;"> | 80 | <div class="flex-space-between" style="margin-top: 8px;"> |
| 81 | <a-button size="small">更换</a-button> | 81 | <a-button size="small">更换</a-button> |
| 82 | - <a-button size="small" onClick={e => { | 82 | + {/* <a-button size="small" onClick={e => { |
| 83 | e.stopPropagation() | 83 | e.stopPropagation() |
| 84 | - }}>裁剪</a-button> | 84 | + }}>裁剪</a-button> */} |
| 85 | <a-button size="small" onClick={(e) => { | 85 | <a-button size="small" onClick={(e) => { |
| 86 | e.stopPropagation() | 86 | e.stopPropagation() |
| 87 | - this.handleSelectImage({ previewURL: '' }) | 87 | + this.handleSelectImage({ url: '' }) |
| 88 | }}>移除</a-button> | 88 | }}>移除</a-button> |
| 89 | </div> | 89 | </div> |
| 90 | </div> | 90 | </div> |
front-end/h5/src/components/core/support/image-gallery/tabs/personal.js
| @@ -11,7 +11,7 @@ export default { | @@ -11,7 +11,7 @@ export default { | ||
| 11 | methods: { | 11 | methods: { |
| 12 | uploadSuccess ({ file, fileList }) { | 12 | uploadSuccess ({ file, fileList }) { |
| 13 | const response = file.response.length && file.response[0] | 13 | const response = file.response.length && file.response[0] |
| 14 | - this.items = [{ name: response.name, previewURL: response.url.replace('http://localhost:1337', '') }, ...this.cachedItems] | 14 | + this.items = [{ name: response.name, url: response.url.replace('http://localhost:1337', '') }, ...this.cachedItems] |
| 15 | }, | 15 | }, |
| 16 | beforeUpload (file) { | 16 | beforeUpload (file) { |
| 17 | this.items.unshift({ | 17 | this.items.unshift({ |
| @@ -51,10 +51,16 @@ export default { | @@ -51,10 +51,16 @@ export default { | ||
| 51 | mounted () { | 51 | mounted () { |
| 52 | // demo code | 52 | // demo code |
| 53 | axios | 53 | axios |
| 54 | - .get('https://pixabay.com/api/?key=12120348-2ad26e4cc05d9bc068097ab3b&q=yellow+flowers&image_type=photo&pretty=true') | 54 | + .get('/upload/files', { |
| 55 | + params: { | ||
| 56 | + '_limit': 10, | ||
| 57 | + '_start': 0, | ||
| 58 | + mime: 'image/png' | ||
| 59 | + } | ||
| 60 | + }) | ||
| 55 | .then(res => { | 61 | .then(res => { |
| 56 | - this.items = res.data.hits | ||
| 57 | - this.cachedItems = res.data.hits.slice(0) | 62 | + this.items = res.data |
| 63 | + this.cachedItems = [] | ||
| 58 | }) | 64 | }) |
| 59 | } | 65 | } |
| 60 | } | 66 | } |
front-end/h5/src/components/core/support/image-gallery/tabs/pixabay.js
| 1 | +/* | ||
| 2 | + * @Author: ly525 | ||
| 3 | + * @Date: 2019-12-01 18:11:50 | ||
| 4 | + * @LastEditors: ly525 | ||
| 5 | + * @LastEditTime: 2020-01-13 00:48:13 | ||
| 6 | + * @FilePath: /luban-h5/front-end/h5/src/components/core/support/image-gallery/tabs/pixabay.js | ||
| 7 | + * @Github: https://github.com/ly525/luban-h5 | ||
| 8 | + * @Description: Do not edit | ||
| 9 | + * @Copyright 2018 - 2019 luban-h5. All Rights Reserved | ||
| 10 | + */ | ||
| 1 | import axios from 'axios' | 11 | import axios from 'axios' |
| 2 | import ImageItem from '../components/image-item.js' | 12 | import ImageItem from '../components/image-item.js' |
| 3 | 13 | ||
| @@ -23,7 +33,7 @@ export default { | @@ -23,7 +33,7 @@ export default { | ||
| 23 | axios | 33 | axios |
| 24 | .get('https://pixabay.com/api/', { params: this.options }) | 34 | .get('https://pixabay.com/api/', { params: this.options }) |
| 25 | .then(res => { | 35 | .then(res => { |
| 26 | - this.items = res.data.hits | 36 | + this.items = res.data.hits.map(item => ({ ...item, url: item.previewURL })) |
| 27 | }) | 37 | }) |
| 28 | } | 38 | } |
| 29 | }, | 39 | }, |