Commit e78e22925bc455551101efdd68ba62eb9710d49a

Authored by ly525
1 parent 3e698eb7

show card cover if it exists

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 &#39;qrcode&#39; @@ -4,6 +4,7 @@ import QRCode from &#39;qrcode&#39;
4 4
5 import { API_ORIGIN } from '@/constants/api.js' 5 import { API_ORIGIN } from '@/constants/api.js'
6 import PreviewDialog from '@/components/core/editor/modals/preview.vue' 6 import PreviewDialog from '@/components/core/editor/modals/preview.vue'
  7 +import CardCover from '@/components/common/work/card-cover.js'
7 8
8 const ListItemCard = { 9 const ListItemCard = {
9 props: { 10 props: {
@@ -42,7 +43,7 @@ const ListItemCard = { @@ -42,7 +43,7 @@ const ListItemCard = {
42 return ( 43 return (
43 <a-card hoverable > 44 <a-card hoverable >
44 <div slot="cover" class="flex-center" style="height: 200px;font-size: 24px;border: 1px dashed #eee;color: #aaa;background: #f7f5f557;" > 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 </div> 47 </div>
47 <template class="ant-card-actions" slot="actions"> 48 <template class="ant-card-actions" slot="actions">
48 <a-tooltip effect="dark" placement="bottom" title="编辑"> 49 <a-tooltip effect="dark" placement="bottom" title="编辑">
front-end/h5/src/views/work-manager/templates.vue
@@ -4,6 +4,7 @@ import QRCode from &#39;qrcode&#39; @@ -4,6 +4,7 @@ import QRCode from &#39;qrcode&#39;
4 4
5 import { API_ORIGIN } from '@/constants/api.js' 5 import { API_ORIGIN } from '@/constants/api.js'
6 import PreviewDialog from '@/components/core/editor/modals/preview.vue' 6 import PreviewDialog from '@/components/core/editor/modals/preview.vue'
  7 +import CardCover from '@/components/common/work/card-cover.js'
7 8
8 const ListItemCard = { 9 const ListItemCard = {
9 props: { 10 props: {
@@ -46,7 +47,7 @@ const ListItemCard = { @@ -46,7 +47,7 @@ const ListItemCard = {
46 return ( 47 return (
47 <a-card hoverable > 48 <a-card hoverable >
48 <div slot="cover" class="flex-center" style="height: 200px;font-size: 24px;border: 1px dashed #eee;color: #aaa;background: #f7f5f557;" > 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 </div> 51 </div>
51 <template class="ant-card-actions" slot="actions"> 52 <template class="ant-card-actions" slot="actions">
52 {/** 53 {/**