goods.js 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. import sheep from '@/sheep';
  2. const goods = (poster) => {
  3. const width = poster.width;
  4. const userInfo = sheep.$store('user').userInfo;
  5. return {
  6. background: sheep.$url.cdn(sheep.$store('app').platform.share.posterInfo.goods_bg),
  7. list: [
  8. {
  9. name: 'nickname',
  10. type: 'text',
  11. val: userInfo.nickname,
  12. x: width * 0.22,
  13. y: width * 0.06,
  14. paintbrushProps: {
  15. fillStyle: '#333',
  16. font: {
  17. fontSize: 16,
  18. fontFamily: 'sans-serif',
  19. },
  20. },
  21. },
  22. {
  23. name: 'avatar',
  24. type: 'image',
  25. val: sheep.$url.cdn(userInfo.avatar),
  26. x: width * 0.04,
  27. y: width * 0.04,
  28. width: width * 0.14,
  29. height: width * 0.14,
  30. d: width * 0.14,
  31. },
  32. {
  33. name: 'goodsImage',
  34. type: 'image',
  35. val: poster.shareInfo.poster.image,
  36. x: width * 0.03,
  37. y: width * 0.21,
  38. width: width * 0.94,
  39. height: width * 0.94,
  40. r: 10,
  41. },
  42. {
  43. name: 'goodsTitle',
  44. type: 'text',
  45. val: poster.shareInfo.poster.title,
  46. x: width * 0.04,
  47. y: width * 1.18,
  48. maxWidth: width * 0.92,
  49. lineHeight: 5,
  50. paintbrushProps: {
  51. fillStyle: '#333',
  52. font: {
  53. fontSize: 14,
  54. },
  55. },
  56. },
  57. {
  58. name: 'goodsPrice',
  59. type: 'text',
  60. val: '¥' + poster.shareInfo.poster.price,
  61. x: width * 0.04,
  62. y: width * 1.3,
  63. paintbrushProps: {
  64. fillStyle: '#ff0000',
  65. font: {
  66. fontSize: 20,
  67. fontFamily: 'OPPOSANS',
  68. },
  69. },
  70. },
  71. {
  72. name: 'goodsOriginalPrice',
  73. type: 'text',
  74. val:
  75. poster.shareInfo.poster.original_price > 0
  76. ? '¥' + poster.shareInfo.poster.original_price
  77. : '',
  78. x: width * 0.3,
  79. y: width * 1.32,
  80. paintbrushProps: {
  81. fillStyle: '#999',
  82. font: {
  83. fontSize: 10,
  84. fontFamily: 'OPPOSANS',
  85. },
  86. },
  87. textDecoration: {
  88. line: 'line-through',
  89. style: 'solide',
  90. },
  91. },
  92. // #ifndef MP-WEIXIN
  93. {
  94. name: 'qrcode',
  95. type: 'qrcode',
  96. val: poster.shareInfo.link,
  97. x: width * 0.75,
  98. y: width * 1.3,
  99. size: width * 0.2,
  100. },
  101. // #endif
  102. // #ifdef MP-WEIXIN
  103. {
  104. name: 'wxacode',
  105. type: 'image',
  106. val: sheep.$api.third.wechat.getWxacode(poster.shareInfo.path),
  107. x: width * 0.75,
  108. y: width * 1.3,
  109. width: width * 0.2,
  110. height: width * 0.2,
  111. },
  112. // #endif
  113. ],
  114. };
  115. };
  116. export default goods;