poster.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. <template>
  2. <view>
  3. <l-painter
  4. css="width: 640rpx; padding-bottom: 35rpx; background-color: #ffffff; box-shadow: 0 20rpx 58rpx rgba(0,0,0,.15);border-radius: 10rpx;"
  5. isCanvasToTempFilePath @success="handleSuccess" @fail="handleFail" custom-style="position: fixed; left: 200%">
  6. <l-painter-view css="padding-left: 40rpx;">
  7. <l-painter-image :src="config.avatar"
  8. css="margin-top: 15rpx; width: 72rpx; height: 72rpx; border-radius: 50%;" />
  9. <l-painter-view css="margin-top: 30rpx; padding-left: 20rpx; display: inline-block">
  10. <l-painter-text :text="`来自${config.nickname}的分享`"
  11. css="display: block; padding-bottom: 10rpx; color: #333333; font-size: 28rpx;line-clamp:1;width: 100%;" />
  12. </l-painter-view>
  13. <l-painter-image :src="config.image"
  14. css="object-fit: cover; object-position: center; width: 560rpx; height: 560rpx;margin-top: 15rpx;" />
  15. <l-painter-view css="margin-top: 30rpx;">
  16. <!-- 商品分享海报文字内容 -->
  17. <l-painter-view :css="`display: ${type == '1' ? 'inline-block' : 'none'}; width: 400rpx;`">
  18. <l-painter-view
  19. :css="`vertical-align: bottom; color: #FF2C3C; font-size: 30rpx; line-height: 1em;`">
  20. <l-painter-text text="¥" css="vertical-align: bottom;font-size: 28rpx;" />
  21. <l-painter-text :text="price.prev" css="vertical-align: bottom; font-size: 38rpx;" />
  22. <l-painter-text :text="price.next" css="vertical-align: bottom; font-size: 30rpx;" />
  23. <l-painter-text :text="marketPrice"
  24. css="vertical-align: bottom; padding-left: 10rpx;font-size: 28rpx; font-weight: normal; text-decoration: line-through; color: #999999" />
  25. </l-painter-view>
  26. <l-painter-view css="margin-top:30rpx;">
  27. <l-painter-text
  28. css="line-clamp: 2; color: #333333; line-height: 1.5em;font-size: 30rpx; width: 378rpx; padding-right:22rpx; box-sizing: border-box"
  29. :text="config.name"></l-painter-text>
  30. </l-painter-view>
  31. </l-painter-view>
  32. <!-- 砍价分享海报文字内容 -->
  33. <l-painter-view :css="`display: ${type == '2' ? 'inline-block' : 'none'}; width: 400rpx;`">
  34. <l-painter-view>
  35. <l-painter-text
  36. :css="`line-clamp: 2; color: #FF2C3C; line-height: 1.5em;font-size: 32rpx; width: 375rpx; padding-right:22rpx; box-sizing: border-box`"
  37. text="我正在参与砍价 还差一步"></l-painter-text>
  38. </l-painter-view>
  39. <l-painter-view css="margin-top:8rpx;">
  40. <l-painter-text
  41. css="line-clamp: 2; color: #F95F2F; line-height: 1.5em;font-size: 24rpx; width: 378rpx; padding-right:22rpx; box-sizing: border-box"
  42. text="帮忙砍一刀"></l-painter-text>
  43. </l-painter-view>
  44. <l-painter-view css="margin-top:8rpx;">
  45. <l-painter-text
  46. css="line-clamp: 2; color: #333333; line-height: 1.5em;font-size: 28rpx; width: 378rpx; padding-right:22rpx; box-sizing: border-box"
  47. :text="config.name"></l-painter-text>
  48. </l-painter-view>
  49. </l-painter-view>
  50. <l-painter-view css="display: inline-block;">
  51. <!-- #ifdef H5 || APP-PLUS -->
  52. <l-painter-qrcode css="width: 168rpx; height: 168rpx;" :text="link">
  53. </l-painter-qrcode>
  54. <!-- #endif -->
  55. <!-- #ifdef MP -->
  56. <l-painter-image :src="qrcode" css="width: 168rpx; height: 168rpx;" />
  57. <!-- #endif -->
  58. <l-painter-text text="长按识别二维码"
  59. css="display: block; padding-top: 10rpx; color: #999999;font-size: 24rpx;" />
  60. </l-painter-view>
  61. </l-painter-view>
  62. </l-painter-view>
  63. </l-painter>
  64. </view>
  65. </template>
  66. <script>
  67. import lPainter from '@/components/lime-painter/components/l-painter/l-painter.vue'
  68. import lPainterImage from '@/components/lime-painter/components/l-painter-image/l-painter-image.vue'
  69. import lPainterText from '@/components/lime-painter/components/l-painter-text/l-painter-text.vue'
  70. import lPainterView from '@/components/lime-painter/components/l-painter-view/l-painter-view.vue'
  71. import lPainterQrcode from '@/components/lime-painter/components/l-painter-qrcode/l-painter-qrcode.vue'
  72. export default {
  73. name: "share-poster",
  74. components: {
  75. lPainter,
  76. lPainterImage,
  77. lPainterText,
  78. lPainterView,
  79. lPainterQrcode
  80. },
  81. props: {
  82. config: {
  83. type: Object,
  84. default: () => ({})
  85. },
  86. shareId: {
  87. type: [Number, String],
  88. default: ''
  89. },
  90. qrcode: {
  91. type: [String],
  92. default: ''
  93. },
  94. pagePath:{
  95. type: String,
  96. default: ''
  97. },
  98. link: {
  99. type: String,
  100. default: ''
  101. },
  102. type: {
  103. type: String,
  104. default: 'goods'
  105. }
  106. },
  107. data() {
  108. return {
  109. };
  110. },
  111. computed: {
  112. price() {
  113. let {
  114. price
  115. } = this.config
  116. console.log(price)
  117. if (price == undefined) return {}
  118. price = String(parseFloat(price)).split('.')
  119. return {
  120. prev: price[0],
  121. next: price[1] ? `.${price[1]}` : ''
  122. }
  123. },
  124. marketPrice() {
  125. return `¥${parseFloat(this.config.marketPrice)}`
  126. }
  127. },
  128. methods: {
  129. handleSuccess(val) {
  130. this.$emit('success', val)
  131. },
  132. handleFail(err) {
  133. this.$emit('fail')
  134. }
  135. }
  136. }
  137. </script>
  138. <style>
  139. </style>