Commit e78e22925bc455551101efdd68ba62eb9710d49a
1 parent
3e698eb7
show card cover if it exists
Showing
3 changed files
with
20 additions
and
2 deletions
front-end/h5/src/components/common/work/card-cover.js
0 → 100644
| 1 | +export default { | |
| 2 | + props: { | |
| 3 | + qrCode: String, | |
| 4 | + coverImageUrl: String | |
| 5 | + }, | |
| 6 | + render (h) { | |
| 7 | + if (this.qrcode) { | |
| 8 | + return <img src={this.qrcodeUrl} /> | |
| 9 | + } | |
| 10 | + if (this.coverImageUrl) { | |
| 11 | + return <img src={this.coverImageUrl} style="width:100%;height: 100%;" /> | |
| 12 | + } | |
| 13 | + | |
| 14 | + return <span>Luban H5</span> | |
| 15 | + } | |
| 16 | +} | ... | ... |
front-end/h5/src/views/work-manager/list.vue
| ... | ... | @@ -4,6 +4,7 @@ import QRCode from 'qrcode' |
| 4 | 4 | |
| 5 | 5 | import { API_ORIGIN } from '@/constants/api.js' |
| 6 | 6 | import PreviewDialog from '@/components/core/editor/modals/preview.vue' |
| 7 | +import CardCover from '@/components/common/work/card-cover.js' | |
| 7 | 8 | |
| 8 | 9 | const ListItemCard = { |
| 9 | 10 | props: { |
| ... | ... | @@ -42,7 +43,7 @@ const ListItemCard = { |
| 42 | 43 | return ( |
| 43 | 44 | <a-card hoverable > |
| 44 | 45 | <div slot="cover" class="flex-center" style="height: 200px;font-size: 24px;border: 1px dashed #eee;color: #aaa;background: #f7f5f557;" > |
| 45 | - { this.qrcodeUrl ? <img src={this.qrcodeUrl} /> : <span>Luban H5</span> } | |
| 46 | + <CardCover qrcodeUrl={this.qrcodeUrl} coverImageUrl={this.work.cover_image_url} /> | |
| 46 | 47 | </div> |
| 47 | 48 | <template class="ant-card-actions" slot="actions"> |
| 48 | 49 | <a-tooltip effect="dark" placement="bottom" title="编辑"> | ... | ... |
front-end/h5/src/views/work-manager/templates.vue
| ... | ... | @@ -4,6 +4,7 @@ import QRCode from 'qrcode' |
| 4 | 4 | |
| 5 | 5 | import { API_ORIGIN } from '@/constants/api.js' |
| 6 | 6 | import PreviewDialog from '@/components/core/editor/modals/preview.vue' |
| 7 | +import CardCover from '@/components/common/work/card-cover.js' | |
| 7 | 8 | |
| 8 | 9 | const ListItemCard = { |
| 9 | 10 | props: { |
| ... | ... | @@ -46,7 +47,7 @@ const ListItemCard = { |
| 46 | 47 | return ( |
| 47 | 48 | <a-card hoverable > |
| 48 | 49 | <div slot="cover" class="flex-center" style="height: 200px;font-size: 24px;border: 1px dashed #eee;color: #aaa;background: #f7f5f557;" > |
| 49 | - { this.qrcodeUrl ? <img src={this.qrcodeUrl} /> : <span>Luban H5</span> } | |
| 50 | + <CardCover qrcodeUrl={this.qrcodeUrl} coverImageUrl={this.work.cover_image_url} /> | |
| 50 | 51 | </div> |
| 51 | 52 | <template class="ant-card-actions" slot="actions"> |
| 52 | 53 | {/** | ... | ... |